Commit 6edfeb82 authored by Teemu Ollakka's avatar Teemu Ollakka Committed by Jan Lindström

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.
parent 31b65d3d
......@@ -53,6 +53,10 @@ SELECT * FROM t1;
--connection node_1a
--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
--connection node_1b
SET DEBUG_SYNC = 'wsrep_before_SR_rollback SIGNAL wait WAIT_FOR continue';
......@@ -101,4 +105,5 @@ SELECT * FROM t1;
SELECT * FROM t1;
--connection node_1
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
......@@ -145,8 +145,11 @@ extern "C" void wsrep_handle_SR_rollback(THD *bf_thd,
victim_thd->wsrep_trx_id(),
victim_thd->wsrep_sr().fragments_certified(),
wsrep_thd_transaction_state_str(victim_thd));
if (bf_thd) victim_thd->store_globals();
if (!bf_thd)
if (bf_thd && bf_thd != victim_thd)
{
victim_thd->store_globals();
}
else
{
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);
}
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,
......
......@@ -7084,6 +7084,12 @@ DeadlockChecker::check_and_resolve(const lock_t* lock, trx_t* trx)
if (victim_trx != NULL) {
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;
}
......
Subproject commit 0b09871ad5a10a773c4cbad28e681021d8d234b6
Subproject commit ab0e5f5d776f1bb7472a6c7e50c475312e562bfb
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment