| 1 |
# |
| 2 |
# Kill entire cluster while various transactions are in progress |
| 3 |
# restore the cluster and expect that node #2 will rejoin using IST |
| 4 |
# |
| 5 |
|
| 6 |
--source include/galera_cluster.inc |
| 7 |
--source include/big_test.inc |
| 8 |
--source include/have_innodb.inc |
| 9 |
--source include/have_log_bin.inc |
| 10 |
|
| 11 |
SET SESSION wsrep_sync_wait = 0; |
| 12 |
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB; |
| 13 |
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; |
| 14 |
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); |
| 15 |
|
| 16 |
DELIMITER |; |
| 17 |
CREATE PROCEDURE insert_simple () |
| 18 |
BEGIN |
| 19 |
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; |
| 20 |
SET SESSION wsrep_sync_wait = 0; |
| 21 |
WHILE 1 DO |
| 22 |
INSERT INTO t1 (f1, f2) VALUES (DEFAULT,'abcdef'); |
| 23 |
END WHILE; |
| 24 |
END| |
| 25 |
|
| 26 |
CREATE PROCEDURE insert_multi () |
| 27 |
BEGIN |
| 28 |
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; |
| 29 |
SET SESSION wsrep_sync_wait = 0; |
| 30 |
WHILE 1 DO |
| 31 |
INSERT INTO t1 (f1) VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT); |
| 32 |
END WHILE; |
| 33 |
END| |
| 34 |
|
| 35 |
CREATE PROCEDURE insert_transaction () |
| 36 |
BEGIN |
| 37 |
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; |
| 38 |
SET SESSION wsrep_sync_wait = 0; |
| 39 |
SET AUTOCOMMIT = OFF; |
| 40 |
WHILE 1 DO |
| 41 |
START TRANSACTION; |
| 42 |
INSERT INTO t1 (f1) VALUES (DEFAULT); |
| 43 |
INSERT INTO t1 (f1) VALUES (DEFAULT); |
| 44 |
INSERT INTO t1 (f1) VALUES (DEFAULT); |
| 45 |
INSERT INTO t1 (f1) VALUES (DEFAULT); |
| 46 |
INSERT INTO t1 (f1) VALUES (DEFAULT); |
| 47 |
|
| 48 |
INSERT INTO t1 (f1) VALUES (DEFAULT); |
| 49 |
INSERT INTO t1 (f1) VALUES (DEFAULT); |
| 50 |
INSERT INTO t1 (f1) VALUES (DEFAULT); |
| 51 |
INSERT INTO t1 (f1) VALUES (DEFAULT); |
| 52 |
INSERT INTO t1 (f1) VALUES (DEFAULT); |
| 53 |
COMMIT; |
| 54 |
END WHILE; |
| 55 |
END| |
| 56 |
|
| 57 |
DELIMITER ;| |
| 58 |
DELIMITER |; |
| 59 |
|
| 60 |
CREATE PROCEDURE update_simple () |
| 61 |
BEGIN |
| 62 |
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; |
| 63 |
SET SESSION wsrep_sync_wait = 0; |
| 64 |
WHILE 1 DO |
| 65 |
UPDATE t1 SET f2 = CONCAT(f2,f2); |
| 66 |
END WHILE; |
| 67 |
END| |
| 68 |
|
| 69 |
CREATE PROCEDURE insert_1k () |
| 70 |
BEGIN |
| 71 |
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; |
| 72 |
SET SESSION wsrep_sync_wait = 0; |
| 73 |
WHILE 1 DO |
| 74 |
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024)); |
| 75 |
END WHILE; |
| 76 |
END| |
| 77 |
|
| 78 |
CREATE PROCEDURE insert_1m () |
| 79 |
BEGIN |
| 80 |
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; |
| 81 |
SET SESSION wsrep_sync_wait = 0; |
| 82 |
WHILE 1 DO |
| 83 |
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024)); |
| 84 |
END WHILE; |
| 85 |
END| |
| 86 |
|
| 87 |
CREATE PROCEDURE insert_10m () |
| 88 |
BEGIN |
| 89 |
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; |
| 90 |
SET SESSION wsrep_sync_wait = 0; |
| 91 |
WHILE 1 DO |
| 92 |
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10)); |
| 93 |
END WHILE; |
| 94 |
END| |
| 95 |
|
| 96 |
DELIMITER ;| |
| 97 |
|
| 98 |
--let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` |
| 99 |
|
| 100 |
--connect node_1_insert_simple, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 101 |
--connect node_1_insert_multi, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 102 |
--connect node_1_insert_transaction, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 103 |
--connect node_1_update_simple, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 104 |
--connect node_1_insert_1k, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 105 |
--connect node_1_insert_1m, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 106 |
--connect node_1_insert_10m, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 107 |
|
| 108 |
--connection node_1_insert_simple |
| 109 |
--send CALL insert_simple(); |
| 110 |
|
| 111 |
--connection node_1_insert_multi |
| 112 |
--send CALL insert_multi(); |
| 113 |
|
| 114 |
--connection node_1_insert_transaction |
| 115 |
--send CALL insert_transaction (); |
| 116 |
|
| 117 |
--connection node_1_update_simple |
| 118 |
--send CALL update_simple (); |
| 119 |
|
| 120 |
--connection node_1_insert_1k |
| 121 |
--send CALL insert_1k (); |
| 122 |
|
| 123 |
--connection node_1_insert_1m |
| 124 |
--send CALL insert_1m (); |
| 125 |
|
| 126 |
--connection node_1_insert_10m |
| 127 |
--send CALL insert_10m (); |
| 128 |
|
| 129 |
--connection node_2 |
| 130 |
SET SESSION wsrep_sync_wait = 0; |
| 131 |
|
| 132 |
# Make sure that node_2 is not killed while TOIs are applied. |
| 133 |
# Otherwhise we risk that grastate file is marked unsafe, and |
| 134 |
# as a consequence the node cannot rejoin with IST. |
| 135 |
--let $wait_condition = SELECT VARIABLE_VALUE > $wsrep_last_committed_before FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' |
| 136 |
--source include/wait_condition.inc |
| 137 |
|
| 138 |
--source include/kill_galera.inc |
| 139 |
|
| 140 |
--sleep 10 |
| 141 |
--connection node_1 |
| 142 |
--source include/kill_galera.inc |
| 143 |
|
| 144 |
--connection node_1_insert_simple |
| 145 |
--error 2013, 2026 |
| 146 |
--reap |
| 147 |
|
| 148 |
--connection node_1_insert_multi |
| 149 |
--error 2013, 2026 |
| 150 |
--reap |
| 151 |
|
| 152 |
--connection node_1_insert_transaction |
| 153 |
--error 2013, 2026 |
| 154 |
--reap |
| 155 |
|
| 156 |
--connection node_1_update_simple |
| 157 |
--error 2013, 2026 |
| 158 |
--reap |
| 159 |
|
| 160 |
--connection node_1_insert_1k |
| 161 |
--error 2013, 2026 |
| 162 |
--reap |
| 163 |
|
| 164 |
--connection node_1_insert_1m |
| 165 |
--error 2013, 2026 |
| 166 |
--reap |
| 167 |
|
| 168 |
--connection node_1_insert_10m |
| 169 |
--error 2013, 2026 |
| 170 |
--reap |
| 171 |
|
| 172 |
--connection node_1 |
| 173 |
--let $galera_wsrep_recover_server_id=1 |
| 174 |
--source suite/galera/include/galera_wsrep_recover.inc |
| 175 |
|
| 176 |
--let $_expect_file_name = $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 177 |
--source include/start_mysqld.inc |
| 178 |
--connection node_2 |
| 179 |
--let $galera_wsrep_recover_server_id=2 |
| 180 |
--source suite/galera/include/galera_wsrep_recover.inc |
| 181 |
|
| 182 |
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect |
| 183 |
--source include/start_mysqld.inc |
| 184 |
|
| 185 |
--connection node_1 |
| 186 |
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 187 |
--source include/wait_condition.inc |
| 188 |
|
| 189 |
--let $diff_servers = 1 2 |
| 190 |
--source include/diff_servers.inc |
| 191 |
|
| 192 |
--connection node_1 |
| 193 |
DROP TABLE t1; |
| 194 |
DROP TABLE ten; |
| 195 |
DROP PROCEDURE insert_simple; |
| 196 |
DROP PROCEDURE insert_multi; |
| 197 |
DROP PROCEDURE insert_transaction; |
| 198 |
DROP PROCEDURE update_simple; |
| 199 |
DROP PROCEDURE insert_1k; |
| 200 |
DROP PROCEDURE insert_1m; |
| 201 |
|
| 202 |
--connection node_1 |
| 203 |
call mtr.add_suppression("Error in Log_event::read_log_event\\(\\)"); |
| 204 |
CALL mtr.add_suppression("conflict state 7 after post commit"); |
| 205 |
|
| 206 |
# Warning happens when the cluster is started for the first time |
| 207 |
CALL mtr.add_suppression("Skipped GCache ring buffer recovery"); |
| 208 |
|
| 209 |
--connection node_2 |
| 210 |
call mtr.add_suppression("Error in Log_event::read_log_event\\(\\)"); |
| 211 |
CALL mtr.add_suppression("Skipped GCache ring buffer recovery"); |