MCPcopy Create free account
hub / github.com/MariaDB/server / tc_acquire_table

Function tc_acquire_table

sql/table_cache.cc:398–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

396*/
397
398TABLE *tc_acquire_table(THD *thd, TDC_element *element)
399{
400 uint32_t n_instances= tc_active_instances.load(std::memory_order_relaxed);
401 uint32_t i= thd->thread_id % n_instances;
402 TABLE *table;
403
404 tc[i].lock_and_check_contention(n_instances, i);
405 table= element->free_tables[i].list.pop_front();
406 if (table)
407 {
408 DBUG_ASSERT(!table->in_use);
409 table->in_use= thd;
410 /* The ex-unused table must be fully functional. */
411 DBUG_ASSERT(table->db_stat && table->file);
412 /* The children must be detached from the table. */
413 DBUG_ASSERT(!table->file->extra(HA_EXTRA_IS_ATTACHED_CHILDREN));
414 tc[i].free_tables.remove(table);
415 }
416 mysql_mutex_unlock(&tc[i].LOCK_table_cache);
417 return table;
418}
419
420
421/**

Callers 2

tdc_acquire_shareFunction · 0.85
flush_tablesFunction · 0.85

Calls 5

loadMethod · 0.45
pop_frontMethod · 0.45
extraMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected