From c5d4dd253348655a663d37985a3e61b20d17ed20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 30 Jul 2020 09:24:36 +0300 Subject: [PATCH] MDEV-23339 innodb_force_recovery=2 may still abort the rollback of recovered transactions trx_rollback_active(), trx_rollback_resurrected(): Replace an incorrect condition that we failed to replace in commit b68f1d847f1fc00eed795e20162effc8fbc4119b (MDEV-21217). --- mysql-test/suite/innodb/disabled.def | 1 - .../suite/innodb/r/innodb_force_recovery_rollback.result | 2 +- mysql-test/suite/innodb/t/innodb_force_recovery_rollback.test | 3 ++- storage/innobase/trx/trx0roll.cc | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/innodb/disabled.def b/mysql-test/suite/innodb/disabled.def index 4484417afce..35c941f8af7 100644 --- a/mysql-test/suite/innodb/disabled.def +++ b/mysql-test/suite/innodb/disabled.def @@ -11,4 +11,3 @@ ############################################################################## create-index-debug : MDEV-13680 InnoDB may crash when btr_page_alloc() fails -innodb_force_recovery_rollback : MDEV-22889 InnoDB occasionally breaks ACID diff --git a/mysql-test/suite/innodb/r/innodb_force_recovery_rollback.result b/mysql-test/suite/innodb/r/innodb_force_recovery_rollback.result index dc037fd6c97..42cf8adfc13 100644 --- a/mysql-test/suite/innodb/r/innodb_force_recovery_rollback.result +++ b/mysql-test/suite/innodb/r/innodb_force_recovery_rollback.result @@ -12,6 +12,6 @@ SET GLOBAL innodb_flush_log_at_trx_commit=1; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; disconnect con0; connection default; -SELECT * FROM t0 LOCK IN SHARE MODE; +SELECT * FROM t0 LIMIT 0 LOCK IN SHARE MODE; a DROP TABLE t0,t1; diff --git a/mysql-test/suite/innodb/t/innodb_force_recovery_rollback.test b/mysql-test/suite/innodb/t/innodb_force_recovery_rollback.test index ad234eba72e..f1d14c45aaf 100644 --- a/mysql-test/suite/innodb/t/innodb_force_recovery_rollback.test +++ b/mysql-test/suite/innodb/t/innodb_force_recovery_rollback.test @@ -30,5 +30,6 @@ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; disconnect con0; connection default; # If the rollback was aborted, we would end up in a lock wait here. -SELECT * FROM t0 LOCK IN SHARE MODE; +# The LIMIT 0 works around MDEV-22889 InnoDB occasionally breaks ACID +SELECT * FROM t0 LIMIT 0 LOCK IN SHARE MODE; DROP TABLE t0,t1; diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index de749f993e7..ef3d93cd65e 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -611,7 +611,7 @@ trx_rollback_active( if (trx->error_state != DB_SUCCESS) { ut_ad(trx->error_state == DB_INTERRUPTED); - ut_ad(!srv_is_being_started); + ut_ad(srv_shutdown_state != SRV_SHUTDOWN_NONE); ut_ad(!srv_undo_sources); ut_ad(srv_fast_shutdown); ut_ad(!dictionary_locked); @@ -701,7 +701,7 @@ func_exit: trx_free_resurrected(trx); return(TRUE); case TRX_STATE_ACTIVE: - if (!srv_is_being_started + if (srv_shutdown_state != SRV_SHUTDOWN_NONE && !srv_undo_sources && srv_fast_shutdown) { fake_prepared: trx->state = TRX_STATE_PREPARED;