mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
The log tables are by nature PERFORMANCE_SCHEMA tables, which should not be affected by SET GLOBAL READ_ONLY or FLUSH TABLES WITH READ LOCK. The implementation of FLUSH TABLES WITH READ LOCK already ignored log tables. Now with this patch, the implementation of LOCK TABLE also ignore a global read lock for log tables, which was the missing symmetry.
This commit is contained in:

parent
e0adab8ce7
commit
f47b82906d
@ -4018,6 +4018,11 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen)
|
||||
{
|
||||
DBUG_ASSERT(thd->lock == 0); // You must lock everything at once
|
||||
TABLE **start,**ptr;
|
||||
uint lock_flag= MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN;
|
||||
|
||||
/* Don't honor the GLOBAL READ LOCK if called from a logger */
|
||||
if (logger.is_privileged_thread(thd))
|
||||
lock_flag|= MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK;
|
||||
|
||||
if (!(ptr=start=(TABLE**) thd->alloc(sizeof(TABLE*)*count)))
|
||||
DBUG_RETURN(-1);
|
||||
@ -4046,8 +4051,7 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen)
|
||||
}
|
||||
|
||||
if (! (thd->lock= mysql_lock_tables(thd, start, (uint) (ptr - start),
|
||||
MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN,
|
||||
need_reopen)))
|
||||
lock_flag, need_reopen)))
|
||||
{
|
||||
if (thd->lex->requires_prelocking())
|
||||
{
|
||||
|
Reference in New Issue
Block a user