summaryrefslogtreecommitdiff
path: root/storage/innobase/trx/trx0trx.cc
diff options
context:
space:
mode:
authorVlad Lesin <vlad_lesin@mail.ru>2022-08-24 17:06:57 +0300
committerVlad Lesin <vlad_lesin@mail.ru>2022-08-24 17:06:57 +0300
commit8ff10969996a5349e906fab44b45c6e3ec53eea0 (patch)
tree162bf147cafba8fa5781e122a4e957525ed08928 /storage/innobase/trx/trx0trx.cc
parent5b4c832c7ebd59d9f5a5e7feef570568e20e5b86 (diff)
downloadmariadb-git-8ff10969996a5349e906fab44b45c6e3ec53eea0.tar.gz
MDEV-29081 trx_t::lock.was_chosen_as_deadlock_victim race in lock_wait_end()
The issue is that trx_t::lock.was_chosen_as_deadlock_victim can be reset before the transaction check it and set trx_t::error_state. The fix is to reset trx_t::lock.was_chosen_as_deadlock_victim only in trx_t::commit_in_memory(), which is invoked on full rollback. There is also no need to have separate bit in trx_t::lock.was_chosen_as_deadlock_victim to flag transaction it was chosen as a victim of Galera conflict resolution, the same variable can be used for both cases except debug build. For debug build we need to distinguish deadlock and Galera's abort victims for debug checks. Also there is no need to check for deadlock in lock_table_enqueue_waiting() for Galera as the coresponding check presents in lock_wait(). Local variable "error_state" in lock_wait() was replaced with trx->error_state, because before the replace lock_sys_t::cancel<false>(trx, lock) and lock_sys.deadlock_check() could change trx->error_state, which then could be overwritten with the local "error_state" variable value. The lock_wait_suspend_thread_enter DEBUG_SYNC point name is misleading, because lock_wait_suspend_thread was eliminated in e71e613. It was renamed to lock_wait_start. Reviewed by: Marko Mäkelä, Jan Lindström.
Diffstat (limited to 'storage/innobase/trx/trx0trx.cc')
-rw-r--r--storage/innobase/trx/trx0trx.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 95bc6273e48..a8f8d7dcc79 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1379,9 +1379,8 @@ TRANSACTIONAL_INLINE inline void trx_t::commit_in_memory(const mtr_t *mtr)
wsrep= false;
wsrep_commit_ordered(mysql_thd);
}
- ut_ad(!(lock.was_chosen_as_deadlock_victim & byte(~2U)));
- lock.was_chosen_as_deadlock_victim= false;
#endif /* WITH_WSREP */
+ lock.was_chosen_as_deadlock_victim= false;
}
void trx_t::commit_cleanup()