summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 09804b75cdb..49a319eb29d 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -6984,6 +6984,9 @@ int MYSQL_BIN_LOG::rotate_and_purge(bool force_rotate,
bool check_purge= false;
mysql_mutex_lock(&LOCK_log);
+
+ DEBUG_SYNC(current_thd, "rotate_after_acquire_LOCK_log");
+
prev_binlog_id= current_binlog_id;
if ((err_gtid= do_delete_gtid_domain(domain_drop_lex)))
@@ -6994,11 +6997,22 @@ int MYSQL_BIN_LOG::rotate_and_purge(bool force_rotate,
}
else if (unlikely((error= rotate(force_rotate, &check_purge))))
check_purge= false;
+
+ DEBUG_SYNC(current_thd, "rotate_after_rotate");
+
/*
NOTE: Run purge_logs wo/ holding LOCK_log because it does not need
the mutex. Otherwise causes various deadlocks.
+ Explicit binlog rotation must be synchronized with a concurrent
+ binlog ordered commit, in particular not let binlog
+ checkpoint notification request until early binlogged
+ concurrent commits have has been completed.
*/
+ mysql_mutex_lock(&LOCK_after_binlog_sync);
mysql_mutex_unlock(&LOCK_log);
+ mysql_mutex_lock(&LOCK_commit_ordered);
+ mysql_mutex_unlock(&LOCK_after_binlog_sync);
+ mysql_mutex_unlock(&LOCK_commit_ordered);
if (check_purge)
checkpoint_and_purge(prev_binlog_id);
@@ -8199,7 +8213,12 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
}
DEBUG_SYNC(leader->thd, "commit_before_get_LOCK_commit_ordered");
+
mysql_mutex_lock(&LOCK_commit_ordered);
+ DBUG_EXECUTE_IF("crash_before_engine_commit",
+ {
+ DBUG_SUICIDE();
+ });
last_commit_pos_offset= commit_offset;
/*