Commit 3c1f324a authored by Kristian Nielsen's avatar Kristian Nielsen

MDEV-32672: Don't hold LOCK_thd_data over commit_ordered

Partial revert of this commit:

  commit 6b685ea7
  Author: Sergei Golubchik <serg@mariadb.org>
  Date:   Wed Sep 28 18:55:15 2022 +0200

Don't hold LOCK_thd_data over run_commit_ordered(). Holding the mutex
is unnecessary and will deadlock if any code in a commit_ordered
handlerton call tries to take the mutex to change THD local data.

Instead, set the current_thd for the duration of the call to keep
asserts happy around LOCK_thd_data.
Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
parent b06ac9a8
......@@ -8556,13 +8556,10 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
DEBUG_SYNC(leader->thd, "commit_loop_entry_commit_ordered");
++num_commits;
set_current_thd(current->thd);
if (current->cache_mngr->using_xa && likely(!current->error) &&
DBUG_EVALUATE_IF("skip_commit_ordered", 0, 1))
{
mysql_mutex_lock(&current->thd->LOCK_thd_data);
run_commit_ordered(current->thd, current->all);
mysql_mutex_unlock(&current->thd->LOCK_thd_data);
}
current->thd->wakeup_subsequent_commits(current->error);
/*
......@@ -8579,6 +8576,7 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
}
current= next;
}
set_current_thd(leader->thd);
DEBUG_SYNC(leader->thd, "commit_after_group_run_commit_ordered");
mysql_mutex_unlock(&LOCK_commit_ordered);
DEBUG_SYNC(leader->thd, "commit_after_group_release_commit_ordered");
......
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