Debian Codegraph @

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

raw
1 ################################################################################
2 # This test verifies that after a unsuccessful START GROUP_REPLICATION, due to
3 # timeout on enable super_read_only, once the blocker of enable super_read_only
4 # is over, START GROUP_REPLICATION does succeed.
5 #
6 # Test:
7 # 0. The test requires two servers: server1 and server2.
8 # 1. Deploy a single-primary group, where server1 is the primary.
9 # 2. Stop GR on server2.
10 # Lock table t1 for writes on server2, that will make
11 # START GROUP_REPLICATION to timeout to enable super_read_only.
12 # 3. Unlock table t1 for writes on server2, START GROUP_REPLICATION
13 # will succeed, since server2 is a secondary we can assert that
14 # super_read_only is enabled after join the group.
15 # 4. Clean up.
16 ################################################################################
17 --source include/big_test.inc
18 --source include/have_group_replication_plugin.inc
19 --let $rpl_group_replication_single_primary_mode =1
20 --let $rpl_skip_group_replication_start = 1
21 --source include/group_replication.inc
22
23
24 --echo
25 --echo ############################################################
26 --echo # 1. Deploy a single-primary group, where server1 is the primary.
27 --let $rpl_connection_name= server1
28 --source include/rpl_connection.inc
29 --source include/start_and_bootstrap_group_replication.inc
30 CREATE TABLE t1 (c1 INT PRIMARY KEY);
31
32 --let $rpl_connection_name= server2
33 --source include/rpl_connection.inc
34 --source include/start_group_replication.inc
35
36
37 --echo
38 --echo ############################################################
39 --echo # 2. Stop GR on server2.
40 --echo # Lock table t1 for writes on server2, that will make
41 --echo # START GROUP_REPLICATION to timeout to enable super_read_only.
42 --let $rpl_connection_name= server2
43 --source include/rpl_connection.inc
44 --source include/stop_group_replication.inc
45
46 --let $rpl_connection_name= server_2
47 --source include/rpl_connection.inc
48 LOCK TABLE t1 WRITE;
49
50 --let $rpl_connection_name= server2
51 --source include/rpl_connection.inc
52 --error ER_GROUP_REPLICATION_CONFIGURATION
53 START GROUP_REPLICATION;
54
55 --let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err
56 --let $assert_select= Could not enable the server read only mode and guarantee a safe recovery execution
57 --let $assert_text= The error to enable super_read_only was logged
58 --let $assert_count= 1
59 --source include/assert_grep.inc
60
61 SET SESSION sql_log_bin = 0;
62 call mtr.add_suppression("Could not enable the server read only mode and guarantee a safe recovery execution");
63 SET SESSION sql_log_bin = 1;
64
65
66 --echo
67 --echo ############################################################
68 --echo # 3. Unlock table t1 for writes on server2, START GROUP_REPLICATION
69 --echo # will succeed, since server2 is a secondary we can assert that
70 --echo # super_read_only is enabled after join the group.
71 --let $rpl_connection_name= server_2
72 --source include/rpl_connection.inc
73 UNLOCK TABLES;
74
75 --let $rpl_connection_name= server2
76 --source include/rpl_connection.inc
77 --source include/start_group_replication.inc
78
79 --let $assert_text= The super_read_only mode must be enabled
80 --let $assert_cond= "[SELECT @@GLOBAL.super_read_only]" = 1;
81 --source include/assert.inc
82
83 --let $assert_text= The read_only mode must be enabled
84 --let $assert_cond= "[SELECT @@GLOBAL.read_only]" = 1;
85 --source include/assert.inc
86
87
88 --echo
89 --echo ############################################################
90 --echo # 4. Clean up.
91 --let $rpl_connection_name= server1
92 --source include/rpl_connection.inc
93 DROP TABLE t1;
94
95 --source include/group_replication_end.inc