Commit f8e77f45 authored by Kristian Nielsen's avatar Kristian Nielsen

MDEV-25611: RESET MASTER causes the server to hang

RESET MASTER waits for storage engines to reply to a binlog checkpoint
requests. If this response is delayed for a long time for some reason, then
RESET MASTER can hang.

Fix this by forcing a log sync in all engines just before waiting for the
checkpoint reply.

(Waiting for old checkpoint responses is needed to preserve durability of
any commits that were synced to disk in the to-be-deleted binlog but not yet
synced in the engine.)
Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
parent 74048efb
...@@ -4435,6 +4435,9 @@ bool MYSQL_BIN_LOG::reset_logs(THD *thd, bool create_new_log, ...@@ -4435,6 +4435,9 @@ bool MYSQL_BIN_LOG::reset_logs(THD *thd, bool create_new_log,
mark_xids_active(current_binlog_id, 1); mark_xids_active(current_binlog_id, 1);
do_checkpoint_request(current_binlog_id); do_checkpoint_request(current_binlog_id);
/* Flush all engine logs to force checkpoint responses to come through. */
ha_flush_logs();
/* Now wait for all checkpoint requests and pending unlog() to complete. */ /* Now wait for all checkpoint requests and pending unlog() to complete. */
mysql_mutex_lock(&LOCK_xid_list); mysql_mutex_lock(&LOCK_xid_list);
for (;;) for (;;)
......
...@@ -1583,7 +1583,7 @@ innobase_start_trx_and_assign_read_view( ...@@ -1583,7 +1583,7 @@ innobase_start_trx_and_assign_read_view(
@return false */ @return false */
static bool innobase_flush_logs(handlerton*) static bool innobase_flush_logs(handlerton*)
{ {
if (!srv_read_only_mode && srv_flush_log_at_trx_commit) if (!srv_read_only_mode)
/* Write any outstanding redo log. Durably if /* Write any outstanding redo log. Durably if
innodb_flush_log_at_trx_commit=1. */ innodb_flush_log_at_trx_commit=1. */
log_buffer_flush_to_disk(srv_flush_log_at_trx_commit == 1); log_buffer_flush_to_disk(srv_flush_log_at_trx_commit == 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment