Debian Codegraph @

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

raw
1 ################################################################################
2 # This test validates that group replication start and stop operation can be
3 # executed when the super read mode is set.
4 #
5 # Test:
6 # 0. The test requires two servers.
7 # 1. Start member 1. Add some data for recovery.
8 # 2. Set super_read_only = 1 on server 2 and check it works as expected.
9 # 3. Start and stop group replication on server 2 and check all is fine.
10 # 4. Clean up.
11 ################################################################################
12
13 --source include/big_test.inc
14 --source include/have_group_replication_plugin.inc
15 --let $rpl_skip_group_replication_start= 1
16 --source include/group_replication.inc
17
18 --echo #
19 --echo # Setup a new group
20 --echo #
21
22 --let $rpl_connection_name= server1
23 --source include/rpl_connection.inc
24
25 --source include/start_and_bootstrap_group_replication.inc
26
27 # Add some data for recovery
28
29 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
30 INSERT INTO t1 VALUES (1);
31
32 --echo #
33 --echo # Set the super_read_only mode to 1 and check it works as expected
34 --echo #
35
36 --let $rpl_connection_name= server2
37 --source include/rpl_connection.inc
38
39 SET @saved_value_super= @@GLOBAL.super_read_only;
40 SET @saved_value= @@GLOBAL.read_only;
41 SET GLOBAL super_read_only= 1;
42
43 --error ER_OPTION_PREVENTS_STATEMENT
44 INSERT INTO t1 VALUES (2);
45
46 --echo #
47 --echo # Start group replication. Check all is fine
48 --echo #
49
50 --source include/start_group_replication.inc
51
52 --let $assert_text= On the recovered member, the table should contain 1 element
53 --let $assert_cond= [SELECT COUNT(*) FROM t1] = 1;
54 --source include/assert.inc
55
56 --echo #
57 --echo # Stop group replication. Check all is fine
58 --echo #
59
60 --let $skip_reset_read_mode= 1
61 --source include/stop_group_replication.inc
62
63 --let $assert_text= The read mode should still be on
64 --let $assert_cond= [SELECT @@GLOBAL.super_read_only] = 1;
65 --source include/assert.inc
66
67 --let $rpl_connection_name= server1
68 --source include/rpl_connection.inc
69
70 --let $group_replication_number_of_members= 1
71 --source include/gr_wait_for_number_of_members.inc
72
73 --echo #
74 --echo # Cleaning up
75 --echo #
76
77 --let $rpl_connection_name= server2
78 --source include/rpl_connection.inc
79
80 SET GLOBAL super_read_only= @saved_value_super;
81 SET GLOBAL read_only= @saved_value;
82
83 --source include/start_group_replication.inc
84
85 --let $rpl_connection_name= server1
86 --source include/rpl_connection.inc
87
88 DROP TABLE t1;
89
90 --source include/group_replication_end.inc