Debian Codegraph @

mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr.inc

raw
1 #
2 # set $inconsistent_fragment to determine at which fragment inconsistency
3 # happens
4 #
5
6 --connection node_1
7 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 BLOB) ENGINE=InnoDB;
8
9 # Introduce inconsistency
10 --connection node_2
11 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
12 --source include/wait_condition.inc
13 SET SESSION wsrep_on=OFF;
14 --eval INSERT INTO t1 VALUES ($inconsistent_fragment, 'X')
15 SET SESSION wsrep_on=ON;
16 DELETE FROM t1 WHERE f1 = 2;
17
18 # Perform an SR transaction that will hit the inconsistency
19 --connection node_1
20 --let $fragment_size = 16384
21 SET AUTOCOMMIT=OFF;
22 --eval SET SESSION wsrep_trx_fragment_size = $fragment_size
23 START TRANSACTION;
24 --eval INSERT INTO t1 VALUES (1, REPEAT('A', $fragment_size))
25 --eval INSERT INTO t1 VALUES (2, REPEAT('A', $fragment_size))
26 --eval INSERT INTO t1 VALUES (3, REPEAT('A', $fragment_size))
27 --eval INSERT INTO t1 VALUES (4, REPEAT('A', $fragment_size))
28 --eval INSERT INTO t1 VALUES (5, REPEAT('A', $fragment_size))
29 COMMIT;
30 SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
31
32 # Perform another SR transaction in order to have stuff in the
33 # wsrep_streaming_log table
34 START TRANSACTION;
35 --eval INSERT INTO t1 VALUES (11, REPEAT('A', $fragment_size))
36 --eval INSERT INTO t1 VALUES (12, REPEAT('A', $fragment_size))
37 --eval INSERT INTO t1 VALUES (13, REPEAT('A', $fragment_size))
38 --eval INSERT INTO t1 VALUES (14, REPEAT('A', $fragment_size))
39 --eval INSERT INTO t1 VALUES (15, REPEAT('A', $fragment_size))
40
41 # Node #2 has dropped from the cluster due to voting
42 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
43 --source include/wait_condition.inc
44
45 # Bring node #2 back via SST
46 --connection node_2
47 SET SESSION wsrep_on=OFF;
48 --source include/shutdown_mysqld.inc
49 --source include/wait_until_disconnected.inc
50 --echo Starting mysqld
51 --source include/start_mysqld.inc
52
53 --connection node_1
54 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
55 --source include/wait_condition.inc
56
57 --connection node_2
58 --let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
59 --source include/wait_condition.inc
60
61 # Node #2 should have some entries in its SR table post-restart
62 SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
63
64 # Commit second SR transaction
65 --connection node_1
66 COMMIT;
67
68 # Confirm that all nodes are identical
69 --connection node_1
70 SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
71 SELECT COUNT(*) AS expect_10 FROM t1;
72
73 --connection node_2
74 SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
75 SELECT COUNT(*) AS expect_10 FROM t1;
76
77 --connection node_3
78 SELECT COUNT(*) AS expect_0 FROM mysql.wsrep_streaming_log;
79 SELECT COUNT(*) AS expect_10 FROM t1;
80
81 --connection node_1
82 DROP TABLE t1;