diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2021-05-06 08:11:09 +0300 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2021-05-06 09:49:27 +0300 |
commit | 4501f7889459f9ee14e38a700a7b3319db6014e5 (patch) | |
tree | 4c2acef80331af945da42875706a464192b2e2a0 | |
parent | cf67ca48d6731ba43dcde385991ae1efaff40675 (diff) | |
download | mariadb-git-bb-10.2-MDEV-25609.tar.gz |
MDEV-25609 : Signal 11 on wsrep_mysqld.cc:2620bb-10.2-MDEV-25609
Victim thread might not be found from thread list if it was
already killed or it was disconnected. Similarly, victim_trx
coulb be already rolled back or committed. In these cases
we should not continue killing it.
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index e431b3f3595..6c4bf70ec46 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -19633,36 +19633,36 @@ static void bg_wsrep_kill_trx( bool awake = false; DBUG_ENTER("bg_wsrep_kill_trx"); - if (thd) { - victim_trx= thd_to_trx(thd); - /* Victim trx might not exist e.g. on MDL-conflict. */ - if (victim_trx) { - lock_mutex_enter(); - trx_mutex_enter(victim_trx); - if (victim_trx->id != arg->trx_id || - victim_trx->state == TRX_STATE_COMMITTED_IN_MEMORY) - { - /* Victim was meanwhile rolled back or - committed */ - trx_mutex_exit(victim_trx); - lock_mutex_exit(); - wsrep_thd_UNLOCK(thd); - victim_trx= NULL; - } - } else { - /* find_thread_by_id locked - THD::LOCK_thd_data */ + if (!thd) + goto ret; // Victim was already killed or disconnected + + victim_trx= thd_to_trx(thd); + + if (victim_trx) { + lock_mutex_enter(); + trx_mutex_enter(victim_trx); + if (victim_trx->id != arg->trx_id || + victim_trx->state == TRX_STATE_COMMITTED_IN_MEMORY) + { + /* Victim was meanwhile rolled back or + committed */ + trx_mutex_exit(victim_trx); + lock_mutex_exit(); wsrep_thd_UNLOCK(thd); + victim_trx= NULL; + goto ret; } - } - - if (!victim_trx) { + } else { /* Victim trx might not exist (MDL-conflict) or victim was meanwhile rolled back or committed because of a KILL statement or a disconnect. */ + /* find_thread_by_id locked THD::LOCK_thd_data */ + wsrep_thd_UNLOCK(thd); goto ret; } + ut_ad(thd && victim_trx); + WSREP_DEBUG("BF kill (" ULINTPF ", seqno: " INT64PF "), victim: (%lu) trx: " TRX_ID_FMT, arg->signal, arg->bf_seqno, @@ -19683,7 +19683,7 @@ static void bg_wsrep_kill_trx( if (wsrep_thd_exec_mode(thd) != LOCAL_STATE) { WSREP_DEBUG("withdraw for BF trx: " TRX_ID_FMT ", state: %d", victim_trx->id, - wsrep_thd_get_conflict_state(thd)); + wsrep_thd_get_conflict_state(thd)); } switch (wsrep_thd_get_conflict_state(thd)) { |