Debian Codegraph @

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

raw
1 ################################################################################
2 # Test to verify group_replication gets successfully loaded even when
3 # it fails to start when `INSTALL PLUGIN ..` command is executed with
4 # group_replication_start_on_boot ON.
5 #
6 # Test:
7 # 0. The test requires two servers: M1 and M2.
8 # 1. We need to restart M2 to simulate start_on_boot option since on MTR
9 # it is impossible to compute ports on configuration files. Bootstrap start
10 # M2, but, without group_name set.
11 # 2. Uninstall and install group_replication plugin on M2. validate group_name,
12 # local_address, group_seeds.
13 # 3. Verify group_replication failed to start but gets successfully loaded.
14 # 4. Now define group name. Bootstrap start GR should be successful on M2.
15 # Start GR on M1. Add some data on M2.
16 # 5. Verify data is correctly replicated on M1.
17 # 6. Clean up.
18 ################################################################################
19
20 --let $group_replication_group_name= 6a63a135-5c92-11e5-914e-e8b1fc3848de
21 --source include/have_group_replication_plugin.inc
22 --source include/force_restart.inc
23 --let $rpl_skip_group_replication_start= 1
24 --source include/group_replication.inc
25
26 --let $rpl_connection_name= server2
27 --source include/rpl_connection.inc
28
29 # We need to restart server 2 to simulate start_on_boot option since
30 # on MTR it is impossible to compute ports on configuration files.
31 --let $allow_rpl_inited= 1
32 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
33 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
34 --let $restart_parameters=restart:--group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_bootstrap_group=1 --group_replication_start_on_boot=1
35 --replace_result $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS
36 --source include/restart_mysqld.inc
37
38 # Needed as we are not using rpl_restart_server.inc
39 --let $rpl_server_number= 2
40 --source include/rpl_reconnect.inc
41
42 SET SESSION SQL_LOG_BIN=0;
43 call mtr.add_suppression("The group_replication_group_name option is mandatory");
44 call mtr.add_suppression("Unable to start Group Replication on boot");
45 SET SESSION SQL_LOG_BIN=1;
46
47 # uninstall and install group_replication plugin
48 --source include/uninstall_group_replication_plugin.inc
49 --source include/install_group_replication_plugin.inc
50
51 --let $assert_text= The value of group name should be empty
52 --let $assert_cond= "[SELECT @@group_replication_group_name]" = ""
53 --source include/assert.inc
54
55 --let $assert_text= The value of local address should be the configured one
56 --let $assert_cond= "[SELECT @@group_replication_local_address]" = "$_group_replication_local_address"
57 --source include/assert.inc
58
59 --let $assert_text= The value of peer addresses should be the configured one
60 --let $assert_cond= "[SELECT @@group_replication_group_seeds]" = "$_group_replication_group_seeds"
61 --source include/assert.inc
62
63 # Verify group_replication failed to start but gets successfully loaded
64 --let $assert_text= group_replication plugin is loaded
65 --let $assert_cond= [SELECT COUNT(*) AS count FROM information_schema.plugins WHERE PLUGIN_NAME="group_replication" AND PLUGIN_STATUS="ACTIVE", count, 1] = 1
66 --source include/assert.inc
67
68 --let $_member_id= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
69 --let $assert_text= The group_replication failed to start
70 --let $assert_cond= [SELECT COUNT(*) FROM performance_schema.replication_group_members WHERE member_id="$_member_id"] = 0
71 --source include/assert.inc
72
73 # Now that group name is defined, start group_replication should be successful
74 --source include/start_and_bootstrap_group_replication.inc
75
76 --let $rpl_connection_name= server1
77 --source include/rpl_connection.inc
78
79 --source include/start_group_replication.inc
80
81 --let $rpl_connection_name= server2
82 --source include/rpl_connection.inc
83
84 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
85 INSERT INTO t1 VALUES (1);
86 --source include/rpl_sync.inc
87
88 # Verify data is correctly replicated
89 --let $rpl_connection_name= server1
90 --source include/rpl_connection.inc
91
92 --let $assert_text= Table t1 contains row in server1 after the above execution
93 --let $assert_cond= [SELECT COUNT(*) FROM t1] = 1
94 --source include/assert.inc
95
96 # Clean the status
97
98 DROP TABLE t1;
99
100 --source include/group_replication_end.inc