280
280
move one table to free list
283
bool Session::free_cached_table(boost::mutex::scoped_lock &scopedLock)
283
bool Open_tables_state::free_cached_table()
285
bool found_old_table= false;
289
table::Concurrent *table= static_cast<table::Concurrent *>(open_tables.open_tables_);
285
table::Concurrent *table= static_cast<table::Concurrent *>(open_tables_);
291
287
safe_mutex_assert_owner(table::Cache::mutex().native_handle());
292
288
assert(table->key_read == 0);
293
assert(!table->cursor || table->cursor->inited == Cursor::NONE);
289
assert(not table->cursor || table->cursor->inited == Cursor::NONE);
295
open_tables.open_tables_= table->getNext();
291
open_tables_= table->getNext();
297
293
if (table->needs_reopen_or_name_lock() ||
298
open_tables.version != g_refresh_version || !table->db_stat)
294
version != g_refresh_version || !table->db_stat)
300
296
table::remove_table(table);
301
found_old_table= true;
306
Open placeholders have Table::db_stat set to 0, so they should be
307
handled by the first alternative.
309
assert(not table->open_placeholder);
311
/* Free memory and reset for next loop */
312
table->cursor->ha_reset();
315
table::getUnused().link(table);
318
return found_old_table;
300
Open placeholders have Table::db_stat set to 0, so they should be
301
handled by the first alternative.
303
assert(not table->open_placeholder);
305
/* Free memory and reset for next loop */
306
table->cursor->ha_reset();
309
table::getUnused().link(table);
336
328
boost::mutex::scoped_lock scoped_lock(table::Cache::mutex()); /* Close all open tables on Session */
338
while (open_tables.open_tables_)
340
found_old_table|= free_cached_table(scoped_lock);
332
found_old_table|= free_cached_table();
343
334
if (found_old_table)
345
336
/* Tell threads waiting for refresh that something has happened */