File: gr_certifier_garbage_collection2.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (148 lines) | stat: -rw-r--r-- 5,754 bytes parent folder | download
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
################################################################################
# Validate that certification info garbage collection do not purge more data
# than it should.
#
# Test:
#  0. The test requires two servers: M1 and M2.
#  1. Create a table on server1.
#  2. Set a debug sync before broadcast message to group on
#     connection server_1.
#     Commit a transaction that will be block before broadcast.
#  3. Wait until server_1 connection reaches the
#     group_replication_before_message_broadcast debug sync point.
#  4. Execute a transaction on server2, that will reach first
#     certification, since server_1 is blocked before broadcast.
#  5. Suspend pipeline on server2.
#  6. Resume the transaction on server_1
#  7. Make sure the pipeline is suspended on server2.
#  8. Wait until certification info garbage collector does
#     its work.
#  9. Resume the pipeline on server2.
# 10. Execute a new transaction in order to have a sync point
#     to make the test deterministic,
#     Validate that data and GTIDs are correct.
# 11. Clean up.
################################################################################
--source include/have_debug_sync.inc
--source include/big_test.inc
--source include/have_group_replication_plugin.inc
--source include/group_replication.inc

--echo
--echo ############################################################
--echo #  1. Create a table on server1.
CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a));
INSERT INTO t1 VALUE(1, 1);
--source include/rpl_sync.inc

--echo
--echo ############################################################
--echo #  2. Set a debug sync before broadcast message to group on
--echo #     connection server_1.
--echo #     Commit a transaction that will be block before broadcast.
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
SET @@GLOBAL.DEBUG='+d,group_replication_before_message_broadcast';
BEGIN;
UPDATE t1 SET b=10 WHERE a=1;
--send COMMIT

--echo
--echo ############################################################
--echo #  3. Wait until server_1 connection reaches the
--echo #     group_replication_before_message_broadcast debug sync point.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State = 'debug sync point: now'
--source include/wait_condition.inc

--echo
--echo ############################################################
--echo #  4. Execute a transaction on server2, that will reach first
--echo #     certification, since server_1 is blocked before broadcast.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
UPDATE t1 SET b=20 WHERE a=1;

--echo
--echo ############################################################
--echo #  5. Suspend pipeline on server2.
SET @@GLOBAL.DEBUG='+d,group_replication_before_apply_data_packet';

--echo
--echo ############################################################
--echo #  6. Resume the transaction on server_1
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET DEBUG_SYNC='now SIGNAL waiting';
SET @@GLOBAL.DEBUG='-d,group_replication_before_message_broadcast';

--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--error ER_TRANSACTION_ROLLBACK_DURING_COMMIT
--reap

--echo
--echo ############################################################
--echo #  7. Make sure the pipeline is suspended on server2.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State = 'debug sync point: now'
--source include/wait_condition.inc

--echo
--echo ############################################################
--echo #  8. Wait until certification info garbage collector does
--echo #     its work.
--let $gtid_assignment_block_size= `SELECT @@GLOBAL.group_replication_gtid_assignment_block_size;`
--let $expected_gtid_set= $group_replication_group_name:1-4:1000002
if ($gtid_assignment_block_size == 1)
{
  --let $expected_gtid_set= $group_replication_group_name:1-5
}
--let $wait_condition= SELECT transactions_committed_all_members = "$expected_gtid_set" from performance_schema.replication_group_member_stats;
--let $wait_timeout= 150
--source include/wait_condition.inc

--echo
--echo ############################################################
--echo #  9. Resume the pipeline on server2.
SET DEBUG_SYNC='now SIGNAL continue_apply';
SET @@GLOBAL.DEBUG='-d,group_replication_before_apply_data_packet';

--echo
--echo ############################################################
--echo # 10. Execute a new transaction in order to have a sync point
--echo #     to make the test deterministic,
--echo #     Validate that data and GTIDs are correct.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
INSERT INTO t1 VALUE(2, 2);
--source include/rpl_sync.inc

--let $expected_gtid_set= $group_replication_group_name:1-5:1000002
if ($gtid_assignment_block_size == 1)
{
  --let $expected_gtid_set= $group_replication_group_name:1-6
}

--let $assert_text= GTID_EXECUTED must contain 6 transactions
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$expected_gtid_set";
--source include/assert.inc

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text= GTID_EXECUTED must contain 6 transactions
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$expected_gtid_set";
--source include/assert.inc

--let $diff_tables=server1:t1, server2:t1
--source include/diff_tables.inc


--echo
--echo ############################################################
--echo # 11. Clean up.
DROP TABLE t1;

--source include/group_replication_end.inc