1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
RESET MASTER;
#
# Case 1: Replay DDL_CTAS without rows, crash before commit;
#
CREATE TABLE t0 (f1 INT);
CREATE TABLE t1 AS SELECT * FROM t0;
# Dump the binlog events into a file.
include/mysqlbinlog.inc
# Replay without crash.
DROP TABLE t0,t1;
RESET MASTER;
include/assert.inc [Verify two tables (t0 & t1) are present in test database]
include/assert.inc [Verify test.t1 is synced]
DROP TABLE t0,t1;
RESET MASTER;
# Replay the binlog events and cause crash before commit;
SET GLOBAL DEBUG='+d, crash_on_transactional_ddl_commit';
# Recover the server.
include/assert.inc [Verify that only table t0 is present in test database]
DROP TABLE t0;
RESET MASTER;
SET global DEBUG='-d, crash_on_transactional_ddl_commit';
RESET MASTER;
#
# Case 2: Replay DDL_CTAS with rows, crash before commit;
#
CREATE TABLE t0 (f1 INT);
INSERT INTO t0 VALUES (1);
INSERT INTO t0 VALUES (2);
INSERT INTO t0 VALUES (3);
INSERT INTO t0 VALUES (4);
CREATE TABLE t1 AS SELECT * FROM t0;
# Dump the binlog events into a file.
include/mysqlbinlog.inc
# Replay without crash.
DROP TABLE t0,t1;
RESET MASTER;
include/assert.inc [Verify two tables (t0 & t1) are present in test database]
include/assert.inc [Verify test.t1 is synced]
DROP TABLE t0,t1;
RESET MASTER;
# Replay the binlog events, cause crash before commit and restart;
SET GLOBAL DEBUG='+d, crash_on_transactional_ddl_commit';
# Recover the server.
SET global DEBUG='-d, crash_on_transactional_ddl_commit';
include/assert.inc [Verify that only table t0 is present in test database]
DROP TABLE t0;
#
# Case 3: Replay DDL_CTAS with rows and then force rollback.
#
RESET MASTER;
SET GLOBAL DEBUG='+d, force_rollback_in_replica_on_transactional_ddl_commit';
SET global DEBUG='-d, force_rollback_in_replica_on_transactional_ddl_commit';
include/assert.inc [Verify that only table t0 is present in test database]
DROP TABLE t0;
RESET MASTER;
#
# Case 4: Replay DDL_CTAS in a SP without rows, crash before commit;
#
CREATE TABLE t0 (f1 INT);
CREATE PROCEDURE proc1()
BEGIN
CREATE TABLE t1 AS SELECT * FROM t0;
END|
CALL proc1();
# Dump the binlog events into a file.
include/mysqlbinlog.inc
# Replay without crash.
DROP TABLE t0,t1;
DROP PROCEDURE proc1;
RESET MASTER;
include/assert.inc [Verify two tables (t0 & t1) are present in test database]
# Drop existing objects.
DROP TABLE t0,t1;
DROP PROCEDURE proc1;
RESET MASTER;
# Replay the binlog events and cause crash.
SET GLOBAL DEBUG='+d, crash_on_transactional_ddl_commit';
# Recover the server.
include/assert.inc [Verify that only table t0 is present in test database]
DROP TABLE t0;
DROP PROCEDURE proc1;
RESET MASTER;
SET global DEBUG='-d, crash_on_transactional_ddl_commit';
RESET MASTER;
#
# Case 5: Replay DDL_CTAS in a SP with rows, crash before commit;
#
CREATE TABLE t0 (f1 INT);
INSERT INTO t0 VALUES (1);
INSERT INTO t0 VALUES (2);
INSERT INTO t0 VALUES (3);
INSERT INTO t0 VALUES (4);
CREATE PROCEDURE proc1()
BEGIN
CREATE TABLE t1 AS SELECT * FROM t0;
END|
CALL proc1();
# Dump the binlog events into a file.
include/mysqlbinlog.inc
# Replay without crash.
DROP TABLE t0,t1;
DROP PROCEDURE proc1;
RESET MASTER;
include/assert.inc [Verify two tables (t0 & t1) are present in test database]
include/assert.inc [Verify test.t1 is synced]
# Drop existing objects.
DROP TABLE t0,t1;
DROP PROCEDURE proc1;
RESET MASTER;
# Replay the binlog events and cause crash.
SET GLOBAL DEBUG='+d, crash_on_transactional_ddl_commit';
# Recover the server.
include/assert.inc [Verify that only table t0 is present in test database]
DROP TABLE t0;
DROP PROCEDURE proc1;
RESET MASTER;
SET global DEBUG='-d, crash_on_transactional_ddl_commit';
RESET MASTER;
#
# Case 6: Replay DDL_CTAS using PS with rows, crash before commit;
#
CREATE TABLE t0 (f1 INT);
INSERT INTO t0 VALUES (1);
INSERT INTO t0 VALUES (2);
INSERT INTO t0 VALUES (3);
INSERT INTO t0 VALUES (4);
PREPARE stmt FROM "CREATE TABLE t1 AS SELECT * FROM t0";
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
# Dump the binlog events into a file.
include/mysqlbinlog.inc
# Replay without crash.
DROP TABLE t0,t1;
RESET MASTER;
include/assert.inc [Verify two tables (t0 & t1) are present in test database]
include/assert.inc [Verify test.t1 is synced]
# Drop existing objects.
DROP TABLE t0,t1;
RESET MASTER;
SET GLOBAL DEBUG='+d, crash_on_transactional_ddl_commit';
# Replay the binlog events and cause crash.
# Recover the server.
include/assert.inc [Verify that only table t0 is present in test database]
DROP TABLE t0;
RESET MASTER;
|