Skip to content

Commit 3da4b4f

Browse files
committed
Fix for MW-286 test
This patch will fix BF aborting of native threads, e.g. threads which have declared wsrep_on=OFF. Earlier, we have used, for innodb trx locks, was_chosen_as_deadlock_victim flag, for marking inodb transactions, which are victims for wsrep BF abort. With native threads (wsrep_on==OFF), re-using was_chosen_as_deadlock_victim flag may lead to inteference with real deadlock, and to deal with this, the patch has added new flag for marking wsrep BF aborts only: was_chosen_as_wsrep_victim
1 parent 29a11d3 commit 3da4b4f

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

storage/innobase/handler/ha_innodb.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5130,7 +5130,7 @@ static void innobase_kill_query(handlerton*, THD* thd, enum thd_kill_levels)
51305130

51315131
if (trx_t* trx = thd_to_trx(thd)) {
51325132
#ifdef WITH_WSREP
5133-
bool locked= trx->lock.was_chosen_as_deadlock_victim && (wsrep_on(thd));
5133+
bool locked= trx->lock.was_chosen_as_wsrep_victim;
51345134
if (locked) {
51355135
lock_mutex_exit();
51365136
trx_mutex_exit(trx);
@@ -18556,8 +18556,7 @@ wsrep_innobase_kill_one_trx(
1855618556
* which is already marked as BF victim
1855718557
* lock_sys is held until this vicitm has aborted
1855818558
*/
18559-
bool was_chosen_as_deadlock_victim= victim_trx->lock.was_chosen_as_deadlock_victim;
18560-
victim_trx->lock.was_chosen_as_deadlock_victim= TRUE;
18559+
victim_trx->lock.was_chosen_as_wsrep_victim= TRUE;
1856118560

1856218561
wsrep_thd_UNLOCK(thd);
1856318562
if (wsrep_thd_bf_abort(bf_thd, thd, signal))
@@ -18576,7 +18575,7 @@ wsrep_innobase_kill_one_trx(
1857618575
}
1857718576
else {
1857818577
/* victim was not BF aborted, after all */
18579-
victim_trx->lock.was_chosen_as_deadlock_victim= was_chosen_as_deadlock_victim;
18578+
victim_trx->lock.was_chosen_as_wsrep_victim= TRUE;
1858018579
}
1858118580

1858218581
DBUG_RETURN(0);

storage/innobase/include/trx0trx.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,9 @@ struct trx_lock_t {
596596
lock_sys.mutex. Otherwise, this may
597597
only be modified by the thread that is
598598
serving the running transaction. */
599+
bool was_chosen_as_wsrep_victim;
600+
/*!< high priority wsrep thread has
601+
marked this trx to abort */
599602

600603
/** Pre-allocated record locks */
601604
struct {

storage/innobase/trx/trx0roll.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ trx_rollback_to_savepoint_for_mysql_low(
457457
trx->lock.was_chosen_as_deadlock_victim) {
458458
trx->lock.was_chosen_as_deadlock_victim = FALSE;
459459
}
460+
trx->lock.was_chosen_as_wsrep_victim = FALSE;
460461
#endif
461462
return(err);
462463
}

storage/innobase/trx/trx0trx.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,7 @@ trx_commit_in_memory(
14481448
if (trx->mysql_thd && wsrep_on(trx->mysql_thd)) {
14491449
trx->lock.was_chosen_as_deadlock_victim = FALSE;
14501450
}
1451+
trx->lock.was_chosen_as_wsrep_victim = FALSE;
14511452
#endif
14521453

14531454
DBUG_LOG("trx", "Commit in memory: " << trx);

0 commit comments

Comments
 (0)