Debian Codegraph @

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

raw
1 ###############################################################################
2 # This test verifies that clone uses credentials passed in START GR command.
3 #
4 # 0. The test requires two servers: M1 and M2.
5 # 1. Install clone plugin on server1.
6 # 2. Bootstrap server1 and add some data
7 # 3. Restart server 2 with a monitoring process (mysqld_safe) if needed
8 # 4. Set server 2 parameters to restart post cloning.
9 # Set group_replication_start_on_boot to off.
10 # Since CHANGE MASTER is not executed.
11 # 5. Start GR by passing credentials in command.
12 # 6. Confirm clone is completed and data is present.
13 # Execute START GROUP_REPLICATION to join group.
14 # Confirm server 2 is ONLINE.
15 # 7. Cleanup
16 ###############################################################################
17
18 --source include/have_group_replication_xcom_communication_stack.inc
19 --source include/have_mysqld_monitoring_process.inc
20 --source include/have_clone_plugin.inc
21 --source include/force_restart.inc
22 --source include/have_group_replication_plugin.inc
23 --let $rpl_skip_group_replication_start= 1
24 --source include/group_replication.inc
25
26 # Validate plugins
27 --let plugins = CLONE_PLUGIN,GROUP_REPLICATION
28 --source include/check_plugin_dir.inc
29
30 --echo
31 --echo # 1. Install clone plugin on server1.
32
33 --let $rpl_connection_name= server1
34 --source include/rpl_connection.inc
35
36 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
37 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
38
39 --echo
40 --echo # 2. Bootstrap server1 and add some data
41
42 --source include/start_and_bootstrap_group_replication.inc
43
44 --let $recovery_user= recovery_user
45 --let $recovery_password= recovery_password
46 --eval CREATE USER "$recovery_user" IDENTIFIED BY "$recovery_password"
47 --eval GRANT REPLICATION SLAVE ON *.* TO "$recovery_user"
48 --eval GRANT BACKUP_ADMIN ON *.* TO "$recovery_user"
49
50 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
51 INSERT INTO t1 VALUES (1);
52 INSERT INTO t1 VALUES (2);
53
54 --echo
55 --echo # 3. Restart server 2 with a monitoring process (mysqld_safe) if needed
56
57 --let $rpl_connection_name= server2
58 --source include/rpl_connection.inc
59
60 RESET SLAVE ALL FOR CHANNEL 'group_replication_recovery';
61
62 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
63 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
64 --let $_group_replication_comm_stack= `SELECT @@GLOBAL.group_replication_communication_stack`
65
66 --let $plugin_list= $GROUP_REPLICATION
67 --source include/spawn_monitoring_process.inc
68
69 --echo
70 --echo # 4. Set server 2 parameters to restart post cloning.
71 --echo # Set group_replication_start_on_boot to off.
72 --echo # Since CHANGE MASTER is not executed.
73
74 --disable_query_log
75 --eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
76 --eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
77 --eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
78 --eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
79
80 SET PERSIST group_replication_start_on_boot= OFF;
81 --enable_query_log
82
83 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
84 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
85 --let $_group_replication_threshold_save= `SELECT @@GLOBAL.group_replication_clone_threshold`
86 SET GLOBAL group_replication_clone_threshold= 1;
87
88 --echo
89 --echo # 5. Start GR by passing credentials in command.
90
91 --eval START GROUP_REPLICATION USER='$recovery_user' , PASSWORD='$recovery_password';
92
93 --source include/wait_until_disconnected.inc
94
95 --let $rpl_server_number= 2
96 --source include/rpl_reconnect.inc
97
98 --echo
99 --echo # 6. Confirm clone is completed and data is present.
100 --echo # Execute START GROUP_REPLICATION to join group.
101 --echo # Confirm server 2 is ONLINE.
102
103 --let $assert_text= Clone must be completed
104 --let $assert_cond= [SELECT state="Completed" FROM performance_schema.clone_status] = 1;
105 --source include/assert.inc
106
107 # See if the data has been properly cloned in server2
108 --let $diff_tables=server1:test.t1 ,server2:test.t1
109 --source include/diff_tables.inc
110
111 --eval START GROUP_REPLICATION USER='$recovery_user' , PASSWORD='$recovery_password';
112
113 --let $group_replication_member_state = ONLINE
114 --source include/gr_wait_for_member_state.inc
115
116 --echo
117 --echo # 7. Cleanup
118
119 --eval SET GLOBAL group_replication_clone_threshold= $_group_replication_threshold_save
120
121 RESET PERSIST group_replication_group_name;
122 RESET PERSIST group_replication_local_address;
123 RESET PERSIST group_replication_group_seeds;
124 RESET PERSIST group_replication_start_on_boot;
125 RESET PERSIST group_replication_communication_stack;
126 CHANGE REPLICATION SOURCE TO SOURCE_USER='root' FOR CHANNEL 'group_replication_recovery';
127
128 DROP TABLE t1;
129 --eval DROP USER "$recovery_user"
130
131 --source include/rpl_sync.inc
132
133 --source include/clean_monitoring_process.inc
134 SET SESSION sql_log_bin = 0;
135 call mtr.add_suppression("This member will start distributed recovery using clone. It is due to the number of missing transactions being higher than the configured threshold of 1.");
136 call mtr.add_suppression("Clone removing all user data for provisioning: *");
137 SET SESSION sql_log_bin = 1;
138
139 --source include/group_replication_end.inc