LP #1647741: Backport "InnoDB shutdown hangs if innodb_force_recovery >= 3 skipped any rollback" from 5.7
General
Escalation
General
Escalation
Description
**Reported in Launchpad by Laurynas Biveinis last update 09-12-2016 10:48:59
On 5.6 trunk, innodb.innodb_bug-13628249 fails intermittently with
innodb.innodb_bug-13628249 w4 [ fail ] Test ended at 2016-12-02 15:20:31
CURRENT_TEST: innodb.innodb_bug-13628249 mysqltest: In included file "./include/wait_until_connected_again.inc": included from ./include/wait_until_connected_again.inc at line 25: At line 25: Server failed to restart
The result from queries just before the failure was: call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'"mysql"."slave_master_info"\' in the cache'); call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'"mysql"."slave_relay_log_info"\' in the cache'); call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'"mysql"."slave_worker_info"\' in the cache'); call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'"test"."t1"\' in the cache'); call mtr.add_suppression('InnoDB: Allocated tablespace [0-9], old maximum was [0-9]');
Stop server
Restart server.
Restart server. CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0; BEGIN; INSERT INTO t1 VALUES(1), (2), (3), (4); SET SESSION debug="+d,crash_commit_before"; COMMIT; ERROR HY000: Lost connection to MySQL server during query SELECT COUNT IN (0,4) yes FROM t1; yes 1 safe_process[30106]: Child process: 30107, exit: 1 ... 2016-12-02 18:12:07 30206 [Note] InnoDB: Starting shutdown... 2016-12-02 18:13:07 30206 [Note] InnoDB: Waiting for 1 active transactions to finish 2016-12-02 18:14:07 30206 [Note] InnoDB: Waiting for 1 active transactions to finish 2016-12-02 18:15:12 30206 [Note] InnoDB: Waiting for 1 active transactions to finish 2016-12-02 18:16:13 30206 [Note] InnoDB: Waiting for 1 active transactions to finish 2016-12-02 18:17:13 30206 [Note] InnoDB: Waiting for 1 active transactions to finish 2016-12-02 18:18:13 30206 [Note] InnoDB: Waiting for 1 active transactions to finish 2016-12-02 18:19:13 30206 [Note] InnoDB: Waiting for 1 active transactions to finish 2016-12-02 18:20:13 30206 [Note] InnoDB: Waiting for 1 active transactions to finish
Bug#20874411 INNODB SHUTDOWN HANGS IF INNODB_FORCE_RECOVERY>=3 SKIPPED ANY ROLLBACK
trx_sys_any_active_transactions(): If any prepared ACTIVE transactions exist, and their rollback was prevented by innodb_force_recovery, convert these transactions to XA PREPARE state in the main-memory data structures, so that shutdown will proceed normally. These transactions will again recover as ACTIVE on the next restart, and they will be rolled back unless innodb_force_recovery>=3 again.
trx_undo_fake_prepared(): An auxiliary function to set an undo log to PREPARED state.
RB: 8610 Reviewed-by: Jimmy Yang <jimmy.yang@oracle.com>
**Reported in Launchpad by Laurynas Biveinis last update 09-12-2016 10:48:59
On 5.6 trunk, innodb.innodb_bug-13628249 fails intermittently with
innodb.innodb_bug-13628249 w4 [ fail ]
Test ended at 2016-12-02 15:20:31
CURRENT_TEST: innodb.innodb_bug-13628249
mysqltest: In included file "./include/wait_until_connected_again.inc":
included from ./include/wait_until_connected_again.inc at line 25:
At line 25: Server failed to restart
The result from queries just before the failure was:
call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'"mysql"."slave_master_info"\' in the cache');
call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'"mysql"."slave_relay_log_info"\' in the cache');
call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'"mysql"."slave_worker_info"\' in the cache');
call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'"test"."t1"\' in the cache');
call mtr.add_suppression('InnoDB: Allocated tablespace [0-9], old maximum was [0-9]');
Stop server
Restart server.
Restart server.
CREATE TABLE t1(c1 INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
BEGIN;
INSERT INTO t1 VALUES(1), (2), (3), (4);
SET SESSION debug="+d,crash_commit_before";
COMMIT;
ERROR HY000: Lost connection to MySQL server during query
SELECT COUNT IN (0,4) yes FROM t1;
yes
1
safe_process[30106]: Child process: 30107, exit: 1
...
2016-12-02 18:12:07 30206 [Note] InnoDB: Starting shutdown...
2016-12-02 18:13:07 30206 [Note] InnoDB: Waiting for 1 active transactions to finish
2016-12-02 18:14:07 30206 [Note] InnoDB: Waiting for 1 active transactions to finish
2016-12-02 18:15:12 30206 [Note] InnoDB: Waiting for 1 active transactions to finish
2016-12-02 18:16:13 30206 [Note] InnoDB: Waiting for 1 active transactions to finish
2016-12-02 18:17:13 30206 [Note] InnoDB: Waiting for 1 active transactions to finish
2016-12-02 18:18:13 30206 [Note] InnoDB: Waiting for 1 active transactions to finish
2016-12-02 18:19:13 30206 [Note] InnoDB: Waiting for 1 active transactions to finish
2016-12-02 18:20:13 30206 [Note] InnoDB: Waiting for 1 active transactions to finish
The fix appears to backport
commit b7a0c7f5527647e8e3bdae9c7bbef922f8a1b5e4
Author: Marko M<C3><A4>kel<C3><A4> <marko.makela@oracle.com>
Date: Tue Apr 14 09:25:23 2015 +0300
Bug#20874411 INNODB SHUTDOWN HANGS IF INNODB_FORCE_RECOVERY>=3
SKIPPED ANY ROLLBACK
trx_sys_any_active_transactions(): If any prepared ACTIVE transactions
exist, and their rollback was prevented by innodb_force_recovery,
convert these transactions to XA PREPARE state in the main-memory
data structures, so that shutdown will proceed normally. These transactions
will again recover as ACTIVE on the next restart, and they will be rolled
back unless innodb_force_recovery>=3 again.
trx_undo_fake_prepared(): An auxiliary function to set an undo log to
PREPARED state.
RB: 8610
Reviewed-by: Jimmy Yang <jimmy.yang@oracle.com>