mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Making FLUSH TABLES WITH READ LOCK block COMMITs of existing transactions,
in a deadlock-free manner. This splits locking the global read lock in two steps. This fixes a consequence of this bug, known as: BUG#4953 'mysqldump --master-data may report incorrect binlog position if using InnoDB' And a test. sql/handler.cc: making COMMIT wait if FLUSH TABLES WITH READ LOCK happened. sql/lock.cc: an additional stage so that FLUSH TABLES WITH READ LOCK blocks COMMIT: make_global_read_lock_block_commit(): taking the global read lock is TWO steps (2nd step is optional; without it, COMMIT of existing transactions will be allowed): lock_global_read_lock() THEN make_global_read_lock_block_commit(). sql/mysql_priv.h: new argument to wait_if_global_read_lock() sql/sql_class.h: THD::global_read_lock now an uint to reflect the 2 steps of global read lock (does not block COMMIT / does) sql/sql_db.cc: update for new prototype sql/sql_parse.cc: implementing the two steps of global read lock so that FLUSH TABLES WITH READ LOCK can block COMMIT without deadlocking with COMMITs.
This commit is contained in:
@@ -3708,8 +3708,12 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables)
|
||||
{
|
||||
if (lock_global_read_lock(thd))
|
||||
return 1;
|
||||
result=close_cached_tables(thd,(options & REFRESH_FAST) ? 0 : 1,
|
||||
tables);
|
||||
make_global_read_lock_block_commit(thd);
|
||||
}
|
||||
result=close_cached_tables(thd,(options & REFRESH_FAST) ? 0 : 1, tables);
|
||||
else
|
||||
result=close_cached_tables(thd,(options & REFRESH_FAST) ? 0 : 1, tables);
|
||||
}
|
||||
if (options & REFRESH_HOSTS)
|
||||
hostname_cache_refresh();
|
||||
|
||||
Reference in New Issue
Block a user