|
| 1 | +# |
| 2 | +# Bug#19424075 WRITE/SYNC REDO LOG BEFORE FLUSH THREAD CACHE TO BINLOG |
| 3 | +# |
| 4 | +# Verify that a transaction can not be recovered during server |
| 5 | +# recovery from a crash, which happened after flushing it to |
| 6 | +# InnoDB redo log and before flushing it to binary log. And |
| 7 | +# a transaction can be recovered during server recovery from |
| 8 | +# a crash, which happened after flushing it to binary log. |
| 9 | +# |
| 10 | +--source include/not_embedded.inc |
| 11 | +--source include/not_valgrind.inc |
| 12 | +--source include/have_log_bin.inc |
| 13 | +-- source include/have_debug.inc |
| 14 | +-- source include/have_innodb.inc |
| 15 | + |
| 16 | +CREATE TABLE t1(c1 INT) ENGINE= InnoDB; |
| 17 | + |
| 18 | +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 19 | +--echo # Crash right after flushing InnoDB redo log |
| 20 | +SET SESSION DEBUG="+d,crash_after_flush_engine_log"; |
| 21 | +BEGIN; |
| 22 | +INSERT INTO t1 VALUES(1); |
| 23 | +# 2013 - CR_SERVER_LOST |
| 24 | +--error 2013 |
| 25 | +COMMIT; |
| 26 | +--source include/wait_until_disconnected.inc |
| 27 | + |
| 28 | +--enable_reconnect |
| 29 | +--echo # Restart the master server |
| 30 | +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 31 | +--source include/wait_until_connected_again.inc |
| 32 | +--disable_reconnect |
| 33 | + |
| 34 | +--echo # |
| 35 | +--echo # Verify that a transaction can not be recovered during server |
| 36 | +--echo # recovery from a crash, which happened after flushing it to |
| 37 | +--echo # InnoDB redo log and before flushing it to binary log. |
| 38 | +--echo # |
| 39 | +--let $assert_text= Table t1 must not contain 1 |
| 40 | +--let $assert_cond= [SELECT count(*) FROM t1 WHERE c1=1] = 0 |
| 41 | +--source include/assert.inc |
| 42 | + |
| 43 | +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 44 | +--echo # Crash right after flushing binary log |
| 45 | +SET SESSION DEBUG="+d,crash_after_flush_binlog"; |
| 46 | +BEGIN; |
| 47 | +INSERT INTO t1 VALUES(2); |
| 48 | +# 2013 - CR_SERVER_LOST |
| 49 | +--error 2013 |
| 50 | +COMMIT; |
| 51 | +--source include/wait_until_disconnected.inc |
| 52 | + |
| 53 | +--enable_reconnect |
| 54 | +--echo # Restart the master server |
| 55 | +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 56 | +--source include/wait_until_connected_again.inc |
| 57 | +--disable_reconnect |
| 58 | + |
| 59 | +--echo # |
| 60 | +--echo # Verify that a transaction can be recovered during server |
| 61 | +--echo # recovery from a crash, which happened after flushing it |
| 62 | +--echo # to binary log. |
| 63 | +--echo # |
| 64 | +--let $assert_text= Table t1 must contain 2 |
| 65 | +--let $assert_cond= [SELECT count(*) FROM t1 WHERE c1=2] = 1 |
| 66 | +--source include/assert.inc |
| 67 | + |
| 68 | +# Cleanup |
| 69 | +DROP TABLE t1; |
0 commit comments