Skip to content

Commit 7728b90

Browse files
committed
Removed possible deadlock betwen LOCK_log and LOCK_global_system_variables
The lock order of the mutex must be LOCK_log followed by LOCK_global_system_variables as InnoDB can lock LOCK_global_system_variables during a transaction commit when LOCK_log is hold. Fix is to temporarly unlock LOCK_global_system_variables when setting global binlog variables that needs to use LOCK_log.
1 parent f099f77 commit 7728b90

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

sql/log.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3784,7 +3784,6 @@ void MYSQL_BIN_LOG::init_pthread_objects()
37843784
mysql_cond_init(key_BINLOG_COND_binlog_background_thread_end,
37853785
&COND_binlog_background_thread_end, 0);
37863786

3787-
/* Fix correct mutex order to catch violations quicker (MDEV-35197). */
37883787
mysql_mutex_record_order(&LOCK_log, &LOCK_global_system_variables);
37893788
}
37903789

sql/sys_vars.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,9 +1847,8 @@ Sys_max_binlog_stmt_cache_size(
18471847

18481848
static bool fix_max_binlog_size(sys_var *self, THD *thd, enum_var_type type)
18491849
{
1850-
ulong saved= max_binlog_size;
18511850
mysql_mutex_unlock(&LOCK_global_system_variables);
1852-
mysql_bin_log.set_max_size(saved);
1851+
mysql_bin_log.set_max_size(max_binlog_size);
18531852
mysql_mutex_lock(&LOCK_global_system_variables);
18541853
return false;
18551854
}

0 commit comments

Comments
 (0)