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