Debian Codegraph @

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

raw
1 --echo Performing State Transfer on a server that has been shut down cleanly and restarted
2
3 --connection node_1
4 CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB;
5 SET AUTOCOMMIT=OFF;
6 START TRANSACTION;
7 INSERT INTO t1 VALUES (1,'node1_committed_before');
8 INSERT INTO t1 VALUES (2,'node1_committed_before');
9 INSERT INTO t1 VALUES (3,'node1_committed_before');
10 INSERT INTO t1 VALUES (4,'node1_committed_before');
11 INSERT INTO t1 VALUES (5,'node1_committed_before');
12 COMMIT;
13
14 --connection node_2
15 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
16 --source include/wait_condition.inc
17
18 SET AUTOCOMMIT=OFF;
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 --echo Shutting down server ...
28 --source include/shutdown_mysqld.inc
29
30 --connection node_1
31 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
32 --source include/wait_condition.inc
33
34 SET AUTOCOMMIT=OFF;
35 START TRANSACTION;
36 INSERT INTO t1 VALUES (11,'node1_committed_during');
37 INSERT INTO t1 VALUES (12,'node1_committed_during');
38 INSERT INTO t1 VALUES (13,'node1_committed_during');
39 INSERT INTO t1 VALUES (14,'node1_committed_during');
40 INSERT INTO t1 VALUES (15,'node1_committed_during');
41 COMMIT;
42
43 START TRANSACTION;
44 INSERT INTO t1 VALUES (16,'node1_to_be_committed_after');
45 INSERT INTO t1 VALUES (17,'node1_to_be_committed_after');
46 INSERT INTO t1 VALUES (18,'node1_to_be_committed_after');
47 INSERT INTO t1 VALUES (19,'node1_to_be_committed_after');
48 INSERT INTO t1 VALUES (20,'node1_to_be_committed_after');
49
50 --connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1
51 SET AUTOCOMMIT=OFF;
52 START TRANSACTION;
53 INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after');
54 INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after');
55 INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after');
56 INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after');
57 INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after');
58
59 --connection node_2
60 --echo Starting server ...
61 --source include/start_mysqld.inc
62
63 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
64 --source include/wait_condition.inc
65
66 SET AUTOCOMMIT=OFF;
67 START TRANSACTION;
68 INSERT INTO t1 VALUES (26,'node2_committed_after');
69 INSERT INTO t1 VALUES (27,'node2_committed_after');
70 INSERT INTO t1 VALUES (28,'node2_committed_after');
71 INSERT INTO t1 VALUES (29,'node2_committed_after');
72 INSERT INTO t1 VALUES (30,'node2_committed_after');
73 COMMIT;
74
75 --connection node_1
76 INSERT INTO t1 VALUES (31,'node1_to_be_committed_after');
77 INSERT INTO t1 VALUES (32,'node1_to_be_committed_after');
78 INSERT INTO t1 VALUES (33,'node1_to_be_committed_after');
79 INSERT INTO t1 VALUES (34,'node1_to_be_committed_after');
80 INSERT INTO t1 VALUES (35,'node1_to_be_committed_after');
81 COMMIT;
82
83 SET AUTOCOMMIT=OFF;
84 START TRANSACTION;
85 INSERT INTO t1 VALUES (36,'node1_committed_after');
86 INSERT INTO t1 VALUES (37,'node1_committed_after');
87 INSERT INTO t1 VALUES (38,'node1_committed_after');
88 INSERT INTO t1 VALUES (39,'node1_committed_after');
89 INSERT INTO t1 VALUES (40,'node1_committed_after');
90 COMMIT;
91
92 --connection node_1a_galera_st_shutdown_slave
93 INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after');
94 INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after');
95 INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after');
96 INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after');
97 INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after');
98 ROLLBACK;
99
100 --let $wait_condition = SELECT COUNT(*)=35 FROM t1
101 --source include/wait_condition.inc
102
103 SET AUTOCOMMIT=ON;
104 SET SESSION wsrep_sync_wait=15;
105 SELECT COUNT(*) AS EXPECT_15 FROM t1;
106 SELECT * from t1;
107 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
108 COMMIT;
109
110 --connection node_1
111 --let $wait_condition = SELECT COUNT(*)=35 FROM t1
112 --source include/wait_condition.inc
113
114 SET AUTOCOMMIT=ON;
115 SET SESSION wsrep_sync_wait=15;
116 SELECT COUNT(*) AS EXPECT_15 FROM t1;
117 SELECT * from t1;
118 SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
119 DROP TABLE t1;
120 COMMIT;