1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Fixes to streaming replication BF aborts

The InnoDB DeadlockChecker::check_and_resolve() was missing a
call to wsrep_handle_SR_rollback() in the case when the
transaction running deadlock detection was chosen as victim.

Refined wsrep_handle_SR_rollback() to skip store_globals() calls
if the transaction was BF aborting itself.

Made mysql-wsrep-features#165 more deterministic by waiting until
the update is in progress before sending next update.
This commit is contained in:
Teemu Ollakka
2019-02-19 14:08:29 +02:00
committed by Jan Lindström
parent 31b65d3dd2
commit 6edfeb82fd
5 changed files with 314 additions and 4 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -53,6 +53,10 @@ SELECT * FROM t1;
--connection node_1a --connection node_1a
--send UPDATE t1 SET f2 = 'a' WHERE f1 = 2 --send UPDATE t1 SET f2 = 'a' WHERE f1 = 2
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER != 'system user' AND STATE = 'Updating';
--source include/wait_condition.inc
# Will deadlock # Will deadlock
--connection node_1b --connection node_1b
SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue'; SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
@@ -101,4 +105,5 @@ SELECT * FROM t1;
SELECT * FROM t1; SELECT * FROM t1;
--connection node_1 --connection node_1
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1; DROP TABLE t1;

View File

@@ -145,8 +145,11 @@ extern "C" void wsrep_handle_SR_rollback(THD *bf_thd,
victim_thd->wsrep_trx_id(), victim_thd->wsrep_trx_id(),
victim_thd->wsrep_sr().fragments_certified(), victim_thd->wsrep_sr().fragments_certified(),
wsrep_thd_transaction_state_str(victim_thd)); wsrep_thd_transaction_state_str(victim_thd));
if (bf_thd) victim_thd->store_globals(); if (bf_thd && bf_thd != victim_thd)
if (!bf_thd) {
victim_thd->store_globals();
}
else
{ {
DEBUG_SYNC(victim_thd, "wsrep_before_SR_rollback"); DEBUG_SYNC(victim_thd, "wsrep_before_SR_rollback");
} }
@@ -158,7 +161,10 @@ extern "C" void wsrep_handle_SR_rollback(THD *bf_thd,
{ {
wsrep_thd_self_abort(victim_thd); wsrep_thd_self_abort(victim_thd);
} }
if (bf_thd) bf_thd->store_globals(); if (bf_thd && bf_thd != victim_thd)
{
bf_thd->store_globals();
}
} }
extern "C" my_bool wsrep_thd_bf_abort(const THD *bf_thd, THD *victim_thd, extern "C" my_bool wsrep_thd_bf_abort(const THD *bf_thd, THD *victim_thd,

View File

@@ -7084,6 +7084,12 @@ DeadlockChecker::check_and_resolve(const lock_t* lock, trx_t* trx)
if (victim_trx != NULL) { if (victim_trx != NULL) {
print("*** WE ROLL BACK TRANSACTION (2)\n"); print("*** WE ROLL BACK TRANSACTION (2)\n");
#ifdef WITH_WSREP
if (wsrep_on(trx->mysql_thd)) {
wsrep_handle_SR_rollback(trx->mysql_thd,
victim_trx->mysql_thd);
}
#endif
lock_deadlock_found = true; lock_deadlock_found = true;
} }