diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-04-22 07:51:33 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-04-22 07:51:33 +0300 |
commit | ee455e6f2e6c9cda921c0801210786123d9f8b95 (patch) | |
tree | dc71eaa125629058cad9d91b50350f97bbcbb3cc /sql/log.cc | |
parent | 0d267f7caa1421f9e2b22412694546e499845488 (diff) | |
parent | 6f271302b649ee11e7987b46fe24824c2ca2be7c (diff) | |
download | mariadb-git-ee455e6f2e6c9cda921c0801210786123d9f8b95.tar.gz |
Merge 10.3 into 10.4st-10.4
Diffstat (limited to 'sql/log.cc')
-rw-r--r-- | sql/log.cc | 19 |
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; /* |