Debian Codegraph @

mysql-test/suite/galera/include/galera_st_kill_slave_ddl.inc

raw
1 source include/maybe_debug.inc;
2 if ($have_debug) {
3 --echo Performing State Transfer on a server that has been killed and restarted
4 --echo while a DDL was in progress on it
5
6 --connection node_1
7 CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
8 SET AUTOCOMMIT=OFF;
9 START TRANSACTION;
10 INSERT INTO t1 VALUES (1,'node1_committed_before');
11 INSERT INTO t1 VALUES (2,'node1_committed_before');
12 INSERT INTO t1 VALUES (3,'node1_committed_before');
13 INSERT INTO t1 VALUES (4,'node1_committed_before');
14 INSERT INTO t1 VALUES (5,'node1_committed_before');
15
16 --connection node_2
17 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
18 --source include/wait_condition.inc
19 START TRANSACTION;
20 INSERT INTO t1 VALUES (6,'node2_committed_before');
21 INSERT INTO t1 VALUES (7,'node2_committed_before');
22 INSERT INTO t1 VALUES (8,'node2_committed_before');
23 INSERT INTO t1 VALUES (9,'node2_committed_before');
24 INSERT INTO t1 VALUES (10,'node2_committed_before');
25 COMMIT;
26
27 # Suspend the applier as it applies the ALTER TABLE
28 --let $debug_orig = `SELECT @@debug_dbug`
29 SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
30
31 --connection node_1
32 ALTER TABLE t1 ADD COLUMN f2 INTEGER;
33
34 --connection node_2
35 SET wsrep_sync_wait = 0;
36 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: now'
37 --source include/wait_condition.inc
38
39 --source include/kill_galera.inc
40
41 --connection node_1
42 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
43 --source include/wait_condition.inc
44
45 SET AUTOCOMMIT=OFF;
46 START TRANSACTION;
47 INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during');
48 INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during');
49 INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during');
50 INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during');
51 INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during');
52 COMMIT;
53
54 START TRANSACTION;
55 INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after');
56 INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after');
57 INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after');
58 INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after');
59 INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after');
60
61 --connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1
62 SET AUTOCOMMIT=OFF;
63 START TRANSACTION;
64 INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after');
65 INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after');
66 INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after');
67 INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after');
68 INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after');
69
70 --connection node_2
71 --let $galera_wsrep_recover_server_id=2
72 --source suite/galera/include/galera_wsrep_recover.inc
73
74 --connection node_2
75 --echo Starting server ...
76 --source include/start_mysqld.inc
77
78 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
79 --source include/wait_condition.inc
80
81 --let $wait_condition = SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
82 --source include/wait_condition.inc
83
84 SET AUTOCOMMIT=OFF;
85 START TRANSACTION;
86 INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after');
87 INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after');
88 INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after');
89 INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after');
90 INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after');
91 COMMIT;
92
93 --connection node_1
94 INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after');
95 INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after');
96 INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after');
97 INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after');
98 INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after');
99 COMMIT;
100
101 SET AUTOCOMMIT=OFF;
102 START TRANSACTION;
103 INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after');
104 INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after');
105 INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after');
106 INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after');
107 INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after');
108 COMMIT;
109
110 --connection node_1a_galera_st_kill_slave_ddl
111 INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after');
112 INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after');
113 INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after');
114 INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after');
115 INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after');
116 ROLLBACK;
117
118 --let $wait_condition = SELECT COUNT(*)=35 FROM t1
119 --source include/wait_condition.inc
120
121 SET AUTOCOMMIT=ON;
122 SET SESSION wsrep_sync_wait=15;
123 SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
124 SELECT COUNT(*) AS EXPECT_35 FROM t1;
125 SELECT * FROM t1;
126 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
127 COMMIT;
128
129 --connection node_1
130 --let $wait_condition = SELECT COUNT(*)=35 FROM t1
131 --source include/wait_condition.inc
132
133 SET AUTOCOMMIT=ON;
134 SET SESSION wsrep_sync_wait=15;
135 SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
136 SELECT COUNT(*) AS EXPECT_35 FROM t1;
137 SELECT * FROM t1;
138 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
139 DROP TABLE t1;
140 COMMIT;
141
142 SET GLOBAL debug_dbug = $debug_orig;
143 }