File: galera_ist_gcache_rollover.test

package info (click to toggle)
mariadb 1%3A11.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 765,428 kB
  • sloc: ansic: 2,382,827; cpp: 1,803,532; asm: 378,315; perl: 63,176; sh: 46,496; pascal: 40,776; java: 39,363; yacc: 20,428; python: 19,506; sql: 17,864; xml: 12,463; ruby: 8,544; makefile: 6,059; cs: 5,855; ada: 1,700; lex: 1,193; javascript: 1,039; objc: 80; tcl: 73; awk: 46; php: 22
file content (133 lines) | stat: -rw-r--r-- 4,753 bytes parent folder | download | duplicates (4)
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#
# 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 include/galera_have_debug_sync.inc
--source include/force_restart.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
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'wsrep%'; show processlist
--source include/wait_condition_with_debug.inc
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
INSERT INTO t1 VALUES (01), (02), (03), (04), (05);

# Disconnect nodes #2 and #3
--connection node_2
--let $wsrep_cluster_address_orig2 = `select @@wsrep_cluster_address`
--source suite/galera/include/galera_stop_replication.inc

--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc

--connection node_3
--let $wsrep_cluster_address_orig3 = `select @@wsrep_cluster_address`
--source suite/galera/include/galera_stop_replication.inc

--connection node_1
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
SET GLOBAL wsrep_cluster_address='';
--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig2';
--enable_query_log

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

--connection node_3
--disable_query_log
SET GLOBAL wsrep_cluster_address='';
--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig3';
--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_1
--let $wait_condition = SELECT VARIABLE_VALUE = 2 OR VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc

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

--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc

# Final checks 
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 30 FROM t1
--source include/wait_condition.inc

SELECT COUNT(*) AS EXPECT_30 FROM t1;
SELECT COUNT(*) AS EXPECT_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
--let $wait_condition = SELECT COUNT(*) = 30 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_30 FROM t1;
SELECT COUNT(*) AS EXPECT_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.
--let $galera_cluster_size=3
--source ../galera/include/auto_increment_offset_restore.inc
--source include/galera_end.inc