mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Sdditional fix-up for bug #26380: LOCK TABLES + FLUSH LOGS causes deadlock
FLUSH LOGS should ignore SET GLOBAL READ_ONLY.
This commit is contained in:

parent
6ab97748fe
commit
5b22bc3bd5
11
sql/lock.cc
11
sql/lock.cc
@@ -92,6 +92,7 @@ static void print_lock_error(int error, const char *);
|
|||||||
count The number of tables to lock.
|
count The number of tables to lock.
|
||||||
flags Options:
|
flags Options:
|
||||||
MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK Ignore a global read lock
|
MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK Ignore a global read lock
|
||||||
|
MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY Ignore SET GLOBAL READ_ONLY
|
||||||
MYSQL_LOCK_IGNORE_FLUSH Ignore a flush tables.
|
MYSQL_LOCK_IGNORE_FLUSH Ignore a flush tables.
|
||||||
MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN Instead of reopening altered
|
MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN Instead of reopening altered
|
||||||
or dropped tables by itself,
|
or dropped tables by itself,
|
||||||
@@ -150,11 +151,11 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( write_lock_used
|
if (!(flags & MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY) &&
|
||||||
&& opt_readonly
|
write_lock_used &&
|
||||||
&& ! (thd->security_ctx->master_access & SUPER_ACL)
|
opt_readonly &&
|
||||||
&& ! thd->slave_thread
|
!(thd->security_ctx->master_access & SUPER_ACL) &&
|
||||||
)
|
!thd->slave_thread)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Someone has issued SET GLOBAL READ_ONLY=1 and we want a write lock.
|
Someone has issued SET GLOBAL READ_ONLY=1 and we want a write lock.
|
||||||
|
@@ -1765,6 +1765,7 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **table, uint count,
|
|||||||
#define MYSQL_LOCK_IGNORE_FLUSH 0x0002
|
#define MYSQL_LOCK_IGNORE_FLUSH 0x0002
|
||||||
#define MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN 0x0004
|
#define MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN 0x0004
|
||||||
#define MYSQL_OPEN_TEMPORARY_ONLY 0x0008
|
#define MYSQL_OPEN_TEMPORARY_ONLY 0x0008
|
||||||
|
#define MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY 0x0010
|
||||||
|
|
||||||
void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock);
|
void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock);
|
||||||
void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);
|
void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock);
|
||||||
|
@@ -4020,9 +4020,10 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen)
|
|||||||
TABLE **start,**ptr;
|
TABLE **start,**ptr;
|
||||||
uint lock_flag= MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN;
|
uint lock_flag= MYSQL_LOCK_NOTIFY_IF_NEED_REOPEN;
|
||||||
|
|
||||||
/* Don't honor the GLOBAL READ LOCK if called from a logger */
|
/* Ignore GLOBAL READ LOCK and GLOBAL READ_ONLY if called from a logger */
|
||||||
if (logger.is_privileged_thread(thd))
|
if (logger.is_privileged_thread(thd))
|
||||||
lock_flag|= MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK;
|
lock_flag|= (MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK |
|
||||||
|
MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY);
|
||||||
|
|
||||||
if (!(ptr=start=(TABLE**) thd->alloc(sizeof(TABLE*)*count)))
|
if (!(ptr=start=(TABLE**) thd->alloc(sizeof(TABLE*)*count)))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
Reference in New Issue
Block a user