File: gr_reset_master.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 (121 lines) | stat: -rw-r--r-- 3,755 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
################################################################################
# This test intends to prove that members can survive reset master commands.
# These commands end up causing the members to purge their relay logs
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. On M1, test a reset master command before start GR. It MUST be successful.
# 2. Bootstrap start a group on M1. Start GR on M2.
# 3. Create a table and insert some data.
# 4. Validate both members must have the same GTID set.
# 5. Stop GR and reset master on both members.
# 6. Restart both members (Bootstrap start a group on M2. Start GR on M1).
# 7. Insert some data to test that the group is still running.
# 8. Run RESET MASTER while GR is running. It must fail.
# 9. Clean up.
################################################################################
--source include/have_group_replication_gtid_assignment_block_size_1.inc
--let $group_replication_group_name= c90c3c80-fde4-11e3-a3ac-0800200c9a66
--source include/have_group_replication_plugin.inc

--let $rpl_skip_group_replication_start= 1
--source include/group_replication.inc

--connection server1
--echo #Test a reset command before start.
RESET MASTER;

--source include/start_and_bootstrap_group_replication.inc

--connection server2
--source include/start_group_replication.inc

--echo #Create a table and insert some data
--connection server1
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;

--let $sync_slave_connection= server2
--source include/sync_slave_sql_with_master.inc

--connection server2
INSERT INTO t1 VALUES (1);

--connection server1
INSERT INTO t1 VALUES (2);

--let $sync_slave_connection=server2
--source include/sync_slave_sql_with_master.inc

--connection server2
INSERT INTO t1 VALUES (3);

--let $sync_slave_connection=server1
--source include/sync_slave_sql_with_master.inc

--echo #Both members must have the same GTID set
--let $server_count=2
while ($server_count)
{
  --connection server$server_count
  --let $assert_text= On member $server_count, all executed GTID should belong to the group
  --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "c90c3c80-fde4-11e3-a3ac-0800200c9a66:1-6";
  --source include/assert.inc
  --dec $server_count
}

--echo #Stop and reset both members

--connection server1
--source include/stop_group_replication.inc
RESET MASTER;

--connection server2
--source include/stop_group_replication.inc
RESET MASTER;

--echo #Restart both members

--source include/start_and_bootstrap_group_replication.inc

--connection server1

--source include/start_group_replication.inc

--echo #Both members must have an empty gtid set
--let $server_count=2
while ($server_count)
{
  --connection server$server_count
  --let $assert_text= On member $server_count, there should only 2 transactions from view changes
  --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "c90c3c80-fde4-11e3-a3ac-0800200c9a66:1-2";
  --source include/assert.inc
  --dec $server_count
}

--echo #Insert some data to test that the group is still running

INSERT INTO t1 VALUES (4);
--let $sync_slave_connection=server2
--source include/sync_slave_sql_with_master.inc

INSERT INTO t1 VALUES (5);
--let $sync_slave_connection=server1
--source include/sync_slave_sql_with_master.inc

--let $server_count=2
while ($server_count)
{
  --connection server$server_count
  --let $assert_text= On member $server_count, the table should exist and have 5 elements
  --let $assert_cond= [select count(*) from t1] = 5;
  --source include/assert.inc
  --dec $server_count
}

--echo # Run RESET MASTER while Group Replication is running must fail
--error ER_CANT_RESET_SOURCE
RESET MASTER;

--echo # Clean up
DROP TABLE t1;
--source include/group_replication_end.inc