Debian Codegraph @

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

raw
1 ################################################################################
2 # This test checks that if a joiner has a lower version than the members in a
3 # group and option group_replication_allow_local_lower_version_join is true it
4 # will be able to join the group.
5 #
6 # Test:
7 # 0. The test requires two servers: M1 and M2.
8 # 1. Setup M1 in a way that its version is higher than M2 using DEBUG point.
9 # 2. Add some data for recovery.
10 # 3. Try to add a new member M2 that has a lower version than M1. The start
11 # will fail as the member is declared incompatible with the group.
12 # 4. Test basic check that group_replication_allow_local_lower_version_join
13 # variable doesn't accept invalid inputs.
14 # 5. After allowing that this server can join with a lower plugin version, M2
15 # will be able to join.
16 # 6. Check all is fine on M1 and M2.
17 # 7. Clean up.
18 ################################################################################
19
20 --source include/big_test.inc
21 --source include/have_debug.inc
22 --let $group_replication_group_name= 6f6932e0-03d9-11e5-b939-0800200c9a12
23 --source include/have_group_replication_plugin.inc
24 --let $rpl_skip_group_replication_start= 1
25 --source include/group_replication.inc
26
27 --echo #
28 --echo # Setup a member in a way that his version is higher than member 2
29 --echo #
30
31 --connection server1
32 --echo server1
33
34 SET @debug_saved= @@GLOBAL.DEBUG;
35 SET @@GLOBAL.DEBUG= '+d,group_replication_compatibility_higher_major_version';
36
37 --source include/start_and_bootstrap_group_replication.inc
38
39 # Add some data for recovery
40
41 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
42 INSERT INTO t1 VALUES (1);
43
44 --echo #
45 --echo # Try to add a new member that has a lower version than member 1
46 --echo #
47
48 --connection server2
49 --echo server2
50
51 SET session sql_log_bin=0;
52 call mtr.add_suppression("Member version is incompatible with the group");
53 SET session sql_log_bin=1;
54
55 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
56
57 # The start will fail as the member is declared incompatible with the group
58 --error ER_GROUP_REPLICATION_CONFIGURATION
59 START GROUP_REPLICATION;
60
61 # Basic check: Test that variable doesn't accept invalid inputs.
62 --error ER_WRONG_VALUE_FOR_VAR
63 SET GLOBAL group_replication_allow_local_lower_version_join= NULL;
64
65 --error ER_WRONG_VALUE_FOR_VAR
66 SET GLOBAL group_replication_allow_local_lower_version_join= "a";
67
68 --error ER_WRONG_TYPE_FOR_VAR
69 SET GLOBAL group_replication_allow_local_lower_version_join= 1.2;
70
71 # After allowing that this server can join with a lower plugin version,
72 # server will be able to join.
73 SET GLOBAL group_replication_allow_local_lower_version_join= ON;
74 --source include/start_group_replication.inc
75
76 INSERT INTO t1 VALUES (2);
77 --source include/rpl_sync.inc
78
79 --echo #
80 --echo # Check all is fine
81 --echo #
82 --echo server1
83 --connection server1
84 --let $assert_text= GTID_EXECUTED must contain all committed GTIDs
85 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-6"
86 --source include/assert.inc
87
88 --let $assert_text= 'There is a value 1 in table t1'
89 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1
90 --source include/assert.inc
91 --let $assert_text= 'There is a value 2 in table t1'
92 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 2, count, 1] = 1
93 --source include/assert.inc
94
95 --echo server2
96 --connection server2
97 --let $assert_text= GTID_EXECUTED must contain all committed GTIDs
98 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-6"
99 --source include/assert.inc
100
101 --let $assert_text= 'There is a value 1 in table t1'
102 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 1, count, 1] = 1
103 --source include/assert.inc
104 --let $assert_text= 'There is a value 2 in table t1'
105 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 2, count, 1] = 1
106 --source include/assert.inc
107
108 --echo #
109 --echo # Clean up
110 --echo #
111 --connection server1
112
113 DROP TABLE t1;
114
115 SET @@GLOBAL.DEBUG= @debug_save;
116 --source include/stop_group_replication.inc
117 --source include/start_group_replication.inc
118
119 --connection server2
120 SET GLOBAL group_replication_allow_local_lower_version_join= OFF;
121
122 --source include/group_replication_end.inc