mariadb/mysql-test/t/tc_heuristic_recover.test
Marko Mäkelä a36c369bda Merge 10.1 into 10.2
For running the Galera tests, the variable my_disable_leak_check
was set to true in order to avoid assertions due to memory leaks
at shutdown.

Some adjustments due to MDEV-13625 (merge InnoDB tests from MySQL 5.6)
were performed. The most notable behaviour changes from 10.0 and 10.1
are the following:

* innodb.innodb-table-online: adjustments for the DROP COLUMN
behaviour change (MDEV-11114, MDEV-13613)

* innodb.innodb-index-online-fk: the removal of a (1,NULL) record
from the result; originally removed in MySQL 5.7 in the
Oracle Bug #16244691 fix
377774689b

* innodb.create-index-debug: disabled due to MDEV-13680
(the MySQL Bug #77497 fix was not merged from 5.6 to 5.7.10)

* innodb.innodb-alter-autoinc: MariaDB 10.2 behaves like MySQL 5.6/5.7,
while MariaDB 10.0 and 10.1 assign different values when
auto_increment_increment or auto_increment_offset are used.
Also MySQL 5.6/5.7 exhibit different behaviour between
LGORITHM=INPLACE and ALGORITHM=COPY, so something needs to be tested
and fixed in both MariaDB 10.0 and 10.2.

* innodb.innodb-wl5980-alter: disabled because it would trigger an
InnoDB assertion failure (MDEV-13668 may need additional effort in 10.2)
2017-08-31 09:30:40 +03:00

106 lines
4 KiB
Text

# The test verifies a few server/engine recovery option combinations.
# Specifically, MDEV-13437,13438 are concerned with no crashes
# due to InnoDB being read-only during --tc-heuristic-recover=ROLLBACK|COMMIT.
#
# Initially the test commits a transaction and in the following proceeds
# throughout some phases.
# Within them the server is shut down and attempted to restart, to succeed
# that in the end.
# All this proves no crashes and effective rollback of the transaction.
#
--source include/have_innodb.inc
# The test logics really requires --log-bin.
--source include/have_binlog_format_mixed.inc
--source include/have_debug_sync.inc
--source include/not_embedded.inc
call mtr.add_suppression("Can't init tc log");
call mtr.add_suppression("Found 1 prepared transactions!");
call mtr.add_suppression("Aborting");
# Now take a shapshot of the last time server options.
#
# The "restart" expect-file facility can't be engaged because the server
# having conflicting options may not succeed to boot up.
# Also notice $MYSQLD_CMD is too "static" being unaware of the actual options
# of the last (before shutdown or kill) server run.
# That's why $MYSQLD_LAST_CMD that allows for the server new start
# with more options appended to a stub set which is settled at this very point.
--let $mysqld_stub_cmd= $MYSQLD_LAST_CMD
--let $error_log= $MYSQLTEST_VARDIR/log/mysqld.1.err
--let SEARCH_FILE= $error_log
set debug_sync='RESET';
CREATE TABLE t1 (i INT) ENGINE=InnoDB;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
FLUSH TABLES; # we need the table post crash-restart, see MDEV-8841.
# Run transaction in a separate "prey" connection
--connect (con1,localhost,root,,)
# The signal won't arrive though
set debug_sync='ha_commit_trans_after_prepare WAIT_FOR go';
--send INSERT INTO t1 VALUES (1);
--connection default
--let $table= information_schema.processlist
--let $where= where state = 'debug sync point: ha_commit_trans_after_prepare'
--let $wait_condition= SELECT count(*) = 1 FROM $table $where
--source include/wait_condition.inc
--echo # Prove that no COMMIT or ROLLBACK occurred yet.
SELECT * FROM t1;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t1;
# TODO: MDEV-12700 Allow innodb_read_only startup without prior slow shutdown.
--source include/kill_mysqld.inc
--let $restart_parameters= --innodb-force-recovery=4
--source include/fail_start_mysqld.inc
--let SEARCH_PATTERN= was in the XA prepared state
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= Found 1 prepared transactions!
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= \\[ERROR\\] Can\\'t init tc log
--source include/search_pattern_in_file.inc
--let $restart_parameters= --innodb-force-recovery=4 --tc-heuristic-recover=COMMIT
--source include/fail_start_mysqld.inc
--let SEARCH_PATTERN= was in the XA prepared state
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= Found 1 prepared transactions!
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= \\[ERROR\\] Can\\'t init tc log
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= Please restart mysqld without --tc-heuristic-recover
--source include/search_pattern_in_file.inc
--let $restart_parameters= --tc-heuristic-recover=ROLLBACK
--source include/fail_start_mysqld.inc
--let SEARCH_PATTERN= was in the XA prepared state
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= Found 1 prepared transactions!
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= \\[ERROR\\] Can\\'t init tc log
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= Please restart mysqld without --tc-heuristic-recover
--source include/search_pattern_in_file.inc
--let $restart_parameters=
--source include/start_mysqld.inc
--let SEARCH_PATTERN= was in the XA prepared state
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= Found 1 prepared transactions!
--source include/search_pattern_in_file.inc
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT * FROM t1;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t1;
#
# Cleanup
#
DROP TABLE t1;