Debian Codegraph @

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

raw
1 ################################################################################
2 # This test is to test if group replication can be started with needed variables
3 # persisted into mysqld-auto.cnf file.
4 # Test:
5 # 1. Persist configuration on server1.
6 # 2. Restart server1, it must bootstrap the group.
7 # 3. Persist configuration on server2.
8 # 4. Restart server2, it must join the group.
9 # 5. Clean up.
10 ################################################################################
11 --source include/big_test.inc
12 --source include/have_group_replication_plugin.inc
13 --let $rpl_skip_group_replication_start= 1
14 --source include/group_replication.inc
15
16
17 --echo
18 --echo ############################################################
19 --echo # 1. Persist configuration on server1.
20 --let $rpl_connection_name= server1
21 --source include/rpl_connection.inc
22 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
23 --eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
24 --eval SET PERSIST group_replication_group_seeds= @@GLOBAL.group_replication_group_seeds
25 --eval SET PERSIST group_replication_local_address= @@GLOBAL.group_replication_local_address
26 SET PERSIST group_replication_start_on_boot= ON;
27 SET PERSIST group_replication_bootstrap_group= ON;
28 SET PERSIST group_replication_recovery_get_public_key= ON;
29
30
31 --echo
32 --echo ############################################################
33 --echo # 2. Restart server1, it must bootstrap the group.
34 --let $allow_rpl_inited= 1
35 --source include/restart_mysqld.inc
36 --let $rpl_server_number= 1
37 --source include/rpl_reconnect.inc
38
39 --let $group_replication_member_state= ONLINE
40 --source include/gr_wait_for_member_state.inc
41
42 SELECT variable_name, variable_source FROM performance_schema.variables_info WHERE variable_source IN ('PERSISTED');
43
44
45 --echo
46 --echo ############################################################
47 --echo # 3. Persist configuration on server2.
48 --let $rpl_connection_name= server2
49 --source include/rpl_connection.inc
50 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
51 --eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
52 --eval SET PERSIST group_replication_group_seeds= @@GLOBAL.group_replication_group_seeds
53 --eval SET PERSIST group_replication_local_address= @@GLOBAL.group_replication_local_address
54 SET PERSIST group_replication_start_on_boot= ON;
55 SET PERSIST group_replication_recovery_get_public_key= ON;
56
57
58 --echo
59 --echo ############################################################
60 --echo # 4. Restart server2, it must join the group.
61 --let $allow_rpl_inited= 1
62 --source include/restart_mysqld.inc
63 --let $rpl_server_number= 2
64 --source include/rpl_reconnect.inc
65
66 --let $group_replication_member_state= ONLINE
67 --source include/gr_wait_for_member_state.inc
68
69 --let $group_replication_number_of_members= 2
70 --source include/gr_wait_for_number_of_members.inc
71
72 SELECT variable_name, variable_source FROM performance_schema.variables_info WHERE variable_source IN ('PERSISTED');
73
74
75 --echo
76 --echo ############################################################
77 --echo # 5. Clean up.
78 --let $rpl_connection_name= server1
79 --source include/rpl_connection.inc
80 RESET PERSIST;
81 SET GLOBAL group_replication_start_on_boot= OFF;
82
83 --let $rpl_connection_name= server2
84 --source include/rpl_connection.inc
85 RESET PERSIST;
86 SET GLOBAL group_replication_start_on_boot= OFF;
87
88 --source include/group_replication_end.inc