diff options
author | sjaakola <seppo.jaakola@iki.fi> | 2020-05-19 11:12:26 +0300 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2020-07-22 08:20:10 +0300 |
commit | 7bffe468b239645d2f27d1d5625cb9c914ae994d (patch) | |
tree | d980763c5d4d0ae5050f146b474d04a8a0cac50a /sql/wsrep_dummy.cc | |
parent | 4ec032b492de5c392f66c9c1764cbf72442ed3a9 (diff) | |
download | mariadb-git-7bffe468b239645d2f27d1d5625cb9c914ae994d.tar.gz |
MDEV-21910 Deadlock between BF abort and manual KILL commandbb-10.5-MDEV-21910
When high priority replication slave applier encounters lock conflict in innodb,
it will force the conflicting lock holder transaction (victim) to rollback.
This is a must in multi-master sychronous replication model to avoid cluster lock-up.
This high priority victim abort (aka "brute force" (BF) abort), is started
from innodb lock manager while holding the victim's transaction's (trx) mutex.
Depending on the execution state of the victim transaction, it may happen that the
BF abort will call for THD::awake() to wake up the victim transaction for the rollback.
Now, if BF abort requires THD::awake() to be called, then the applier thread executed
locking protocol of: victim trx mutex -> victim THD::LOCK_thd_data
If, at the same time another DBMS super user issues KILL command to abort the same victim,
it will execute locking protocol of: victim THD::LOCK_thd_data -> victim trx mutex.
These two locking protocol acquire mutexes in opposite order, hence unresolvable mutex locking
deadlock may occur.
The fix in this commit adds THD::wsrep_aborter flag to synchronize who can kill the victim
This flag is set both when BF is called for from innodb and by KILL command.
Either path of victim killing will bail out if victim's wsrep_killed is already
set to avoid mutex conflicts with the other aborter execution. THD::wsrep_aborter
records the aborter THD's ID. This is needed to preserve the right to kill
the victim from different locations for the same aborter thread.
It is also good error logging, to see who is reponsible for the abort.
A new test case was added in galera.galera_bf_kill_debug.test for scenario where
wsrep applier thread and manual KILL command try to kill same idle victim
Diffstat (limited to 'sql/wsrep_dummy.cc')
-rw-r--r-- | sql/wsrep_dummy.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/wsrep_dummy.cc b/sql/wsrep_dummy.cc index 6405a5d2cb7..139cd5cd7ae 100644 --- a/sql/wsrep_dummy.cc +++ b/sql/wsrep_dummy.cc @@ -149,4 +149,6 @@ my_bool wsrep_thd_has_ignored_error(const THD*) void wsrep_thd_set_ignored_error(THD*, my_bool) { } ulong wsrep_OSU_method_get(const THD*) +{ return 0;} +bool wsrep_thd_set_wsrep_aborter(THD*, THD*) { return 0;}
\ No newline at end of file |