1# The test verifies a few server/engine recovery option combinations. 2# Specifically, MDEV-13437,13438 are concerned with no crashes 3# due to InnoDB being read-only during --tc-heuristic-recover=ROLLBACK|COMMIT. 4# 5# Initially the test commits a transaction and in the following proceeds 6# throughout some phases. 7# Within them the server is shut down and attempted to restart, to succeed 8# that in the end. 9# All this proves no crashes and effective rollback of the transaction. 10# 11--source include/have_innodb.inc 12# The test logic really requires --log-bin. 13--source include/have_binlog_format_mixed.inc 14--source include/have_debug_sync.inc 15--source include/not_embedded.inc 16 17call mtr.add_suppression("Can't init tc log"); 18call mtr.add_suppression("Found 1 prepared transactions!"); 19call mtr.add_suppression("Aborting"); 20 21# Now take a shapshot of the last time server options. 22# 23# The "restart" expect-file facility can't be engaged because the server 24# having conflicting options may not succeed to boot up. 25--let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err 26 27CREATE TABLE t1 (i INT) ENGINE=InnoDB; 28SET GLOBAL innodb_flush_log_at_trx_commit=1; 29FLUSH TABLES; # we need the table post crash-restart, see MDEV-8841. 30 31# Run transaction in a separate "prey" connection 32--connect (con1,localhost,root,,) 33# The signal won't arrive though 34set debug_sync='ha_commit_trans_after_prepare WAIT_FOR go'; 35--send INSERT INTO t1 VALUES (1); 36 37--connection default 38 39--let $table= information_schema.processlist 40--let $where= where state = 'debug sync point: ha_commit_trans_after_prepare' 41--let $wait_condition= SELECT count(*) = 1 FROM $table $where 42--source include/wait_condition.inc 43 44--echo # Prove that no COMMIT or ROLLBACK occurred yet. 45SELECT * FROM t1; 46SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; 47SELECT * FROM t1; 48 49# TODO: MDEV-12700 Allow innodb_read_only startup without prior slow shutdown. 50--source include/kill_mysqld.inc 51--error 1 52--exec $MYSQLD_LAST_CMD --log-bin=master-bin --binlog-format=mixed --core-file --loose-debug-sync-timeout=300 --innodb-force-recovery=4 53 54--let SEARCH_PATTERN= was in the XA prepared state 55--source include/search_pattern_in_file.inc 56--let SEARCH_PATTERN= Found 1 prepared transactions! 57--source include/search_pattern_in_file.inc 58--let SEARCH_PATTERN= \\[ERROR\\] Can\\'t init tc log 59--source include/search_pattern_in_file.inc 60 61--error 1 62--exec $MYSQLD_LAST_CMD --log-bin=master-bin --binlog-format=mixed --core-file --loose-debug-sync-timeout=300 --innodb-force-recovery=4 --tc-heuristic-recover=COMMIT 63--let SEARCH_PATTERN= was in the XA prepared state 64--source include/search_pattern_in_file.inc 65--let SEARCH_PATTERN= Found 1 prepared transactions! 66--source include/search_pattern_in_file.inc 67--let SEARCH_PATTERN= \\[ERROR\\] Can\\'t init tc log 68--source include/search_pattern_in_file.inc 69--let SEARCH_PATTERN= Please restart mysqld without --tc-heuristic-recover 70--source include/search_pattern_in_file.inc 71 72--error 1 73--exec $MYSQLD_LAST_CMD --log-bin=master-bin --binlog-format=mixed --core-file --loose-debug-sync-timeout=300 --tc-heuristic-recover=ROLLBACK 74 75--let SEARCH_PATTERN= was in the XA prepared state 76--source include/search_pattern_in_file.inc 77--let SEARCH_PATTERN= Found 1 prepared transactions! 78--source include/search_pattern_in_file.inc 79--let SEARCH_PATTERN= \\[ERROR\\] Can\\'t init tc log 80--source include/search_pattern_in_file.inc 81--let SEARCH_PATTERN= Please restart mysqld without --tc-heuristic-recover 82--source include/search_pattern_in_file.inc 83 84--source include/start_mysqld.inc 85 86--let SEARCH_PATTERN= was in the XA prepared state 87--source include/search_pattern_in_file.inc 88--let SEARCH_PATTERN= Found 1 prepared transactions! 89--source include/search_pattern_in_file.inc 90 91SET TRANSACTION ISOLATION LEVEL READ COMMITTED; 92SELECT * FROM t1; 93SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; 94SELECT * FROM t1; 95# 96# Cleanup 97# 98DROP TABLE t1; 99