Debian Codegraph @

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

raw
1 ################################################################################
2 # This test checks that if a joiner has rule that makes it incompatible with
3 # another member in the group it wont be able to join it.
4 #
5 # To test this:
6 # 0. The test requires two servers: M1 and M2.
7 # 1. We bootstrap GROUP with M1, and add some data for recovery.
8 # 2. Try to start M2 where we added a fake rule that makes it incompatible
9 # with the group. Start GR should fail.
10 # 3. Restart M2 to have clean compatibility settings post clearing the
11 # incompatibilty rule. Start GR should succeed.
12 # 4. Check M2 has all the data.
13 # 5. Clean up.
14 ################################################################################
15
16 --source include/big_test.inc
17 --source include/have_debug.inc
18 --let $group_replication_group_name= 6db14550-03bb-11e5-b939-0800200c9a66
19 --source include/have_group_replication_plugin.inc
20 --let $rpl_skip_group_replication_start= 1
21 --source include/group_replication.inc
22
23 --echo #
24 --echo # Setup a member
25 --echo #
26
27 --connection server1
28 --echo server1
29 --source include/start_and_bootstrap_group_replication.inc
30
31 --echo # Add some data for recovery
32
33 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
34 INSERT INTO t1 VALUES (1);
35
36 --echo #
37 --echo # Try to add a new member that was defined as incompatible with member 1
38 --echo #
39
40 --connection server2
41 --echo server2
42
43 SET session sql_log_bin=0;
44 call mtr.add_suppression("Member version is incompatible with the group");
45 SET session sql_log_bin=1;
46
47 SET @debug_saved= @@GLOBAL.DEBUG;
48 SET @@GLOBAL.DEBUG= '+d,group_replication_compatibility_rule_error_lower';
49 SET @@GLOBAL.DEBUG= '+d,group_replication_compatibility_higher_patch_version';
50 SET GLOBAL group_replication_group_name= "6db14550-03bb-11e5-b939-0800200c9a66";
51
52 # The start will fail as the node is declared incompatible with the group
53 --error ER_GROUP_REPLICATION_CONFIGURATION
54 START GROUP_REPLICATION;
55
56 --echo #
57 --echo # Check all is fine when we clean the rules
58 --echo #
59
60 SET @@GLOBAL.DEBUG= @debug_save;
61
62 # restart the server so we have clean compatibility settings.
63 --let $allow_rpl_inited=1
64 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
65 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
66 --let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds
67 --replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS
68 --source include/restart_mysqld.inc
69 --let $rpl_server_number= 2
70 --source include/rpl_reconnect.inc
71
72 --source include/start_group_replication.inc
73
74 --let $assert_text= On the recovered member, the table should contain 1 elements
75 --let $assert_cond= [SELECT COUNT(*) FROM t1] = 1;
76 --source include/assert.inc
77
78 --echo #
79 --echo # Clean up
80 --echo #
81
82 DROP TABLE t1;
83
84 --source include/group_replication_end.inc