mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-5492 - Reduce usage of LOCK_open: TABLE::in_use
Move TABLE::in_use out of LOCK_open. This is done with assumtion that foreign threads accessing TABLE::in_use will only need consistent value _after_ marking table for flush and purging unused table instances. In this case TABLE::in_use will always point to a valid thread object. Previously FLUSH TABLES thread may wait for tables flushed subsequently by concurrent threads which breaks the above assumption, e.g.: open tables: t1 (version= 1) thr1 (FLUSH TABLES): refresh_version++ thr1 (FLUSH TABLES): purge table cache open tables: none thr2 (SELECT * FROM t1): open tables: t1 open tables: t1 (version= 2) thr2 (FLUSH TABLES): refresh_version++ thr2 (FLUSH TABLES): purge table cache thr1 (FLUSH TABLES): wait for old tables (including t1 with version 2) It is fixed so that FLUSH TABLES waits only for tables that were open heretofore.
This commit is contained in:
@ -1135,7 +1135,7 @@ void mysql_ha_flush(THD *thd)
|
||||
((hash_tables->table->mdl_ticket &&
|
||||
hash_tables->table->mdl_ticket->has_pending_conflicting_lock()) ||
|
||||
(!hash_tables->table->s->tmp_table &&
|
||||
hash_tables->table->s->has_old_version())))
|
||||
hash_tables->table->s->tdc.flushed)))
|
||||
mysql_ha_close_table(hash_tables);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user