Skip to content

Commit 1cbba45

Browse files
committed
Attempt to fix rare race in test for MDEV-8031
The error-injection inject_mdev8031 simulates a deadlock kill in a specific place, by setting killed_for_retry to RETRY_KILL_KILLED directly. If a real deadlock kill triggers at the same time, it is possible for the thread to complete its transaction retry and set rgi_slave to NULL before the real readlock kill can complete in the background. This will cause a segfault due to null-pointer access. Fix by changing the error injection to do a real background deadlock kill, which ensures that the thread will wait for any pending background kills to complete. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
1 parent a204ce2 commit 1cbba45

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sql/rpl_parallel.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,8 +856,7 @@ retry_event_group(rpl_group_info *rgi, rpl_parallel_thread *rpt,
856856
thd->wait_for_commit_ptr->unregister_wait_for_prior_commit();
857857
DBUG_EXECUTE_IF("inject_mdev8031", {
858858
/* Simulate that we get deadlock killed at this exact point. */
859-
rgi->killed_for_retry= rpl_group_info::RETRY_KILL_KILLED;
860-
thd->set_killed(KILL_CONNECTION);
859+
slave_background_kill_request(thd);
861860
});
862861
#ifdef ENABLED_DEBUG_SYNC
863862
DBUG_EXECUTE_IF("rpl_parallel_simulate_wait_at_retry", {

0 commit comments

Comments
 (0)