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

Function tdc_release_share

sql/table_cache.cc:977–1021  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

975*/
976
977void tdc_release_share(TABLE_SHARE *share)
978{
979 DBUG_ENTER("tdc_release_share");
980
981 mysql_mutex_lock(&share->tdc->LOCK_table_share);
982 DBUG_PRINT("enter",
983 ("share: %p table: %s.%s ref_count: %u",
984 share, share->db.str, share->table_name.str,
985 share->tdc->ref_count));
986 DBUG_ASSERT(share->tdc->ref_count);
987
988 if (share->tdc->ref_count > 1)
989 {
990 share->tdc->ref_count--;
991 if (!share->is_view)
992 mysql_cond_broadcast(&share->tdc->COND_release);
993 mysql_mutex_unlock(&share->tdc->LOCK_table_share);
994 DBUG_VOID_RETURN;
995 }
996 mysql_mutex_unlock(&share->tdc->LOCK_table_share);
997
998 mysql_mutex_lock(&LOCK_unused_shares);
999 mysql_mutex_lock(&share->tdc->LOCK_table_share);
1000 if (--share->tdc->ref_count)
1001 {
1002 if (!share->is_view)
1003 mysql_cond_broadcast(&share->tdc->COND_release);
1004 mysql_mutex_unlock(&share->tdc->LOCK_table_share);
1005 mysql_mutex_unlock(&LOCK_unused_shares);
1006 DBUG_VOID_RETURN;
1007 }
1008 if (share->tdc->flushed || tdc_records() > tdc_size)
1009 {
1010 mysql_mutex_unlock(&LOCK_unused_shares);
1011 tdc_delete_share_from_hash(share->tdc);
1012 DBUG_VOID_RETURN;
1013 }
1014 /* Link share last in used_table_share list */
1015 DBUG_PRINT("info", ("moving share to unused list"));
1016 DBUG_ASSERT(share->tdc->next == 0);
1017 unused_shares.push_back(share->tdc);
1018 mysql_mutex_unlock(&share->tdc->LOCK_table_share);
1019 mysql_mutex_unlock(&LOCK_unused_shares);
1020 DBUG_VOID_RETURN;
1021}
1022
1023
1024void tdc_remove_referenced_share(THD *thd, TABLE_SHARE *share)

Callers 12

intern_close_tableFunction · 0.85
tdc_acquire_shareFunction · 0.85
ha_table_existsFunction · 0.85
do_commitMethod · 0.85
mysql_rm_table_no_locksFunction · 0.85
lock_tableMethod · 0.85
prepare_for_repairFunction · 0.85
flush_tablesFunction · 0.85
open_tableFunction · 0.85
tdc_open_viewFunction · 0.85

Calls 3

tdc_recordsFunction · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected