1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

MDEV-4702 - Reduce usage of LOCK_open

Following variables do not require LOCK_open protection anymore:
- table_def_cache (renamed to tdc_hash) is protected by rw-lock
  LOCK_tdc_hash;
- table_def_shutdown_in_progress doesn't need LOCK_open protection;
- last_table_id use atomics;
- TABLE_SHARE::ref_count (renamed to TABLE_SHARE::tdc.ref_count)
  is protected by TABLE_SHARE::tdc.LOCK_table_share;
- TABLE_SHARE::next, ::prev (renamed to tdc.next and tdc.prev),
  oldest_unused_share, end_of_unused_share are protected by
  LOCK_unused_shares;
- TABLE_SHARE::m_flush_tickets (renamed to tdc.m_flush_tickets)
  is protected by TABLE_SHARE::tdc.LOCK_table_share;
- refresh_version (renamed to tdc_version) use atomics.
This commit is contained in:
Sergey Vojtovich
2013-08-14 12:48:50 +04:00
parent b882a3e83e
commit b7f9c89423
25 changed files with 1651 additions and 1247 deletions

View File

@@ -4718,7 +4718,7 @@ static my_bool discover_handlerton(THD *thd, plugin_ref plugin,
{
if (error)
{
DBUG_ASSERT(share->error); // get_cached_table_share needs that
DBUG_ASSERT(share->error); // tdc_lock_share needs that
/*
report an error, unless it is "generic" and a more
specific one was already reported
@@ -4856,29 +4856,27 @@ bool ha_table_exists(THD *thd, const char *db, const char *table_name,
Table_exists_error_handler no_such_table_handler;
thd->push_internal_handler(&no_such_table_handler);
TABLE_SHARE *share= get_table_share(thd, db, table_name, flags);
TABLE_SHARE *share= tdc_acquire_share(thd, db, table_name, flags);
thd->pop_internal_handler();
if (hton && share)
{
*hton= share->db_type();
mysql_mutex_lock(&LOCK_open);
release_table_share(share);
mysql_mutex_unlock(&LOCK_open);
tdc_release_share(share);
}
// the table doesn't exist if we've caught ER_NO_SUCH_TABLE and nothing else
DBUG_RETURN(!no_such_table_handler.safely_trapped_errors());
}
mysql_mutex_lock(&LOCK_open);
TABLE_SHARE *share= get_cached_table_share(db, table_name);
if (hton && share)
*hton= share->db_type();
mysql_mutex_unlock(&LOCK_open);
TABLE_SHARE *share= tdc_lock_share(db, table_name);
if (share)
{
if (hton)
*hton= share->db_type();
tdc_unlock_share(share);
DBUG_RETURN(TRUE);
}
char path[FN_REFLEN + 1];
size_t path_len = build_table_filename(path, sizeof(path) - 1,