summaryrefslogtreecommitdiff
path: root/sql/sql_plugin_services.ic
diff options
context:
space:
mode:
authorsjaakola <seppo.jaakola@iki.fi>2020-05-19 11:12:26 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2020-06-23 13:58:12 +0300
commit5463ad35a3d070a6aed8a266a0b834613dadfc29 (patch)
tree3c410f7cc6c5f9ebe0bf7f486ff6bc7556e49676 /sql/sql_plugin_services.ic
parent37c88445e30d52c965bcb19b19fa710c3eb4fad9 (diff)
downloadmariadb-git-bb-10.1-MDEV-21910-2.tar.gz
MDEV-21910 Deadlock between BF abort and manual KILL commandbb-10.1-MDEV-21910-2
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 global lock_sys->mutex and 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: lock_sys->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 -> lock_sys->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_killed 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. A new test case was added in galera.galera_bf_kill.test for scenario where wsrep applier thread and manual KILL command try to kill same idle victim
Diffstat (limited to 'sql/sql_plugin_services.ic')
-rw-r--r--sql/sql_plugin_services.ic3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_plugin_services.ic b/sql/sql_plugin_services.ic
index 6cf2a31f76b..96052668bf9 100644
--- a/sql/sql_plugin_services.ic
+++ b/sql/sql_plugin_services.ic
@@ -181,7 +181,8 @@ static struct wsrep_service_st wsrep_handler = {
wsrep_trx_is_aborting,
wsrep_trx_order_before,
wsrep_unlock_rollback,
- wsrep_set_data_home_dir
+ wsrep_set_data_home_dir,
+ wsrep_thd_set_wsrep_killed
};
static struct thd_specifics_service_st thd_specifics_handler=