Debian Codegraph @

mysql-test/suite/group_replication/t/gr_without_perfschema.test

raw
1 ################################################################################
2 # ==== Purpose ====
3 #
4 # This test will setup a group with only two members to ensure that the GR
5 # works regardless of performance-schema being enabled or not.
6 #
7 # It will first generate some workload in a single member. It will then
8 # make the other member to join the group and recover. Once having the two
9 # members in the group, the test case will generate workload to be certified.
10 #
11 # ==== Related Bugs and Worklogs ====
12 #
13 # BUG#23291352 GROUP REPLICATION SEGFAULTS WHEN PERFORMANCE_SCHEMA=OFF
14 #
15 # Test:
16 # 0. The test requires two servers: M1 and M2.
17 # 1. On M1, create a table and data to be recovered.
18 # 2. Bootstrap start a group on M1.
19 # 3. Start GR on M2 and wait until recovered.
20 # 4. Check if GR works fine: generate workload to be certified/replicated.
21 # 5. Clean up: stop group replication on both members.
22 ################################################################################
23
24 --source include/not_windows.inc
25 --source include/have_group_replication_plugin.inc
26 --let $rpl_skip_group_replication_start= 1
27 --source include/group_replication.inc
28
29 --echo
30 --echo ####################################################################
31 --echo # 1. Create a table on server1 and generate workload to be recovered
32 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
33 INSERT INTO t1 VALUES (1);
34
35 --echo
36 --echo #################################################################
37 --echo # 2. Start group replication on server1, bootstrapping the group
38 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
39 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
40 --source include/gr_set_bootstrap_group.inc
41 START GROUP_REPLICATION;
42 --source include/gr_clear_bootstrap_group.inc
43
44 --echo
45 --echo #################################################################
46 --echo # 3. Start group replication on server2 and wait until recovered
47 --let $rpl_connection_name= server2
48 --source include/rpl_connection.inc
49
50 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
51 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
52 START GROUP_REPLICATION;
53
54 --echo Wait until server2 recovered table t1
55 --let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.tables WHERE TABLE_SCHEMA="test" AND TABLE_NAME="t1";
56 --source include/wait_condition.inc
57
58 --echo Wait until server2 recovered the single row of table t1
59 --let $wait_condition= SELECT COUNT(*)=1 FROM t1
60 --source include/wait_condition.inc
61
62 --echo Wait until server2 recovery has finished
63 --let $wait_condition= SELECT @@GLOBAL.super_read_only = '0'
64 --source include/wait_condition.inc
65
66 --echo
67 --echo #########################################################################
68 --echo # 4. Check if GR works fine: generate workload to be certified/replicated
69 INSERT INTO t1 VALUES (2);
70
71 --let $rpl_connection_name= server1
72 --source include/rpl_connection.inc
73 --echo Wait until server1 has the table with 2 rows
74 --let $wait_condition= SELECT COUNT(*)=2 FROM t1
75 --source include/wait_condition.inc
76
77 DROP TABLE t1;
78 --let $rpl_connection_name= server2
79 --source include/rpl_connection.inc
80
81 --echo Wait until server2 has dropped table t1
82 --let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.tables WHERE TABLE_SCHEMA="test" AND TABLE_NAME="t1";
83 --source include/wait_condition.inc
84
85 --echo
86 --echo #####################################################
87 --echo # 5. Clean up: stop group replication on both members
88 STOP GROUP_REPLICATION;
89 --let $rpl_connection_name= server1
90 --source include/rpl_connection.inc
91 STOP GROUP_REPLICATION;
92 --source include/group_replication_end.inc