100
101
return not (returnable == open_cache.end());
104
table::Concurrent *tables; /* Used by mysql_test */
106
table::Concurrent *getTable() const
111
table::Concurrent *setTable(Table *arg)
113
return tables= dynamic_cast<table::Concurrent *>(arg);
120
/* Free cache if too big */
121
while (cached_open_tables() > table_cache_size && getTable())
122
remove_table(getTable());
127
while (getTable() && not getTable()->getShare()->getVersion())
128
remove_table(getTable());
131
void link(table::Concurrent *table)
135
table->setNext(getTable()); /* Link in last */
136
table->setPrev(getTable()->getPrev());
137
getTable()->setPrev(table);
138
table->getPrev()->setNext(table);
142
table->setPrev(setTable(table));
143
table->setNext(table->getPrev());
144
assert(table->getNext() == table && table->getPrev() == table);
149
void unlink(table::Concurrent *table)
153
/* Unlink the table from "unused_tables" list. */
154
if (table == getTable())
156
setTable(getTable()->getNext()); // Remove from link
157
if (table == getTable())
162
/* move table first in unused links */
164
void relink(table::Concurrent *table)
166
if (table != getTable())
170
table->setNext(getTable()); /* Link in unused tables */
171
table->setPrev(getTable()->getPrev());
172
getTable()->getPrev()->setNext(table);
173
getTable()->setPrev(table);
182
remove_table(getTable());
194
static UnusedTables unused_tables;
196
104
unsigned char *table_cache_key(const unsigned char *record,
4187
4095
table->getMutableShare()->resetVersion(); /* Free when thread is ready */
4188
4096
if (not table->in_use)
4189
unused_tables.relink(table);
4097
getUnused().relink(table);
4193
unused_tables.cullByVersion();
4101
getUnused().cullByVersion();
4231
4139
table->getMutableShare()->resetVersion(); /* Free when thread is ready */
4232
4140
if (not (in_use= table->in_use))
4234
unused_tables.relink(table);
4142
getUnused().relink(table);
4236
4144
else if (in_use != session)