summaryrefslogtreecommitdiff
path: root/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test
blob: 0032f8d6ee1af3b0d1faa0ffb93df9af219fb3f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#
# Test that if the gcache rolls over while IST is in progress, IST will still complete.
# This is achieved by using the ist_sender_send_after_get_buffers Galera dbug sync point to block the donor after 
# the first gcache buffer has been locked for IST.
#
# After IST blocks, we roll over the gcache and resume IST to confirm that it completes successfully.
#
# Two nodes perform IST at the same time in order to make the test more stressfull
#

--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--source suite/galera/include/galera_have_debug_sync.inc

--let $galera_connection_name = node_3
--let $galera_server_number = 3
--source include/galera_connect.inc

# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--let $node_3=node_3
--source ../galera/include/auto_increment_offset_save.inc

--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
INSERT INTO t1 VALUES (01), (02), (03), (04), (05);

# Disconnect nodes #2 and #3
--connection node_2
--source suite/galera/include/galera_stop_replication.inc

--connection node_3
--source suite/galera/include/galera_stop_replication.inc

--connection node_1
--source include/wait_until_connected_again.inc
INSERT INTO t1 VALUES (11), (12), (13), (14), (15);

# Wait until nodes #2 and #3 have left
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc

INSERT INTO t1 VALUES (21), (22), (23), (24), (25);

# Make sure IST will block ...
--let $galera_sync_point = ist_sender_send_after_get_buffers
--source include/galera_set_sync_point.inc

# ... and restart providers to force IST
--connection node_2
--disable_query_log
--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig';
--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
--enable_query_log

--connection node_1
INSERT INTO t1 VALUES (31), (32), (33), (34), (35);

--connection node_3
--disable_query_log
--eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig';
--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
--enable_query_log

--connection node_1
--sleep 2
SHOW STATUS LIKE 'wsrep_debug_sync_waiters';

INSERT INTO t1 VALUES (41), (42), (43), (44), (45);

# Roll over gcache by writing a lot of information to it

CREATE TABLE t2 (f1 LONGTEXT);
INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024));
INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024));
INSERT INTO t2 VALUES (REPEAT('x', 512 * 1024));

# Unlock IST and wait for it to complete
--source include/galera_clear_sync_point.inc
--source include/galera_signal_sync_point.inc

INSERT INTO t1 VALUES (51), (52), (53), (54), (55);

--connection node_2
--source include/wait_until_connected_again.inc

--connection node_3
--source include/wait_until_connected_again.inc

sleep 5;

# Final checks 
--connection node_2
SELECT COUNT(*) = 30 FROM t1;
SELECT COUNT(*) = 3 FROM t2;
SELECT LENGTH(f1) = 512 * 1024 FROM t2;
CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled");

# Final checks
--connection node_3
SELECT COUNT(*) = 30 FROM t1;
SELECT COUNT(*) = 3 FROM t2;
SELECT LENGTH(f1) = 512 * 1024 FROM t2;
CALL mtr.add_suppression("WSREP: Unsupported protocol downgrade: incremental data collection disabled");

DROP TABLE t1, t2;

# Restore original auto_increment_offset values.
--source ../galera/include/auto_increment_offset_restore.inc

--let $galera_cluster_size=3
--source include/galera_end.inc