Debian Codegraph @

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

raw
1 ################################################################################
2 # Validate that when a member joins a group, if the recovery users are
3 # asymmetrical configured, the joiner will fail to complete recovery after
4 # cloning the donor.
5 #
6 # Test:
7 # 0. The test requires two servers: M1 and M2.
8 # 1. Install clone plugin on server1.
9 # Change the recovery user to a non-existing one, once
10 # server2 clones server1 it will try to use that user and fail.
11 # Bootstrap a group on server1.
12 # 2. Install clone plugin on server2.
13 # Restart server with a monitoring process (mysqld_safe) if needed
14 # 3. Join the group, clone will be done, but the recovery
15 # after restart will fail due to the non-existent recovery user.
16 # 4. Cleanup
17 #
18
19 --source include/have_group_replication_xcom_communication_stack.inc
20 --source include/have_mysqld_monitoring_process.inc
21 --source include/have_clone_plugin.inc
22 --source include/force_restart.inc
23 --source include/have_group_replication_plugin.inc
24 --let $rpl_skip_group_replication_start= 1
25 --source include/group_replication.inc
26
27 # Validate plugins
28 --let plugins = CLONE_PLUGIN,GROUP_REPLICATION
29 --source include/check_plugin_dir.inc
30
31 --echo
32 --echo ############################################################
33 --echo # 1. Install clone plugin on server1.
34 --echo # Change the recovery user to a non-existing one, once
35 --echo # server2 clones server1 it will try to use that user and
36 --echo # fail.
37 --echo # Bootstrap a group on server1.
38 --let $rpl_connection_name= server1
39 --source include/rpl_connection.inc
40
41 # Install the clone plugin
42 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
43 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
44
45 # Change the recovery user to a non-existing one.
46 # This information will be cloned into server 2
47 --disable_warnings
48 --eval CHANGE REPLICATION SOURCE TO SOURCE_USER='non-existent', SOURCE_PASSWORD='foo' FOR CHANNEL 'group_replication_recovery'
49 --enable_warnings
50
51 # Add some data for recovery
52 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
53 INSERT INTO t1 VALUES (1);
54 INSERT INTO t1 VALUES (2);
55
56 --source include/start_and_bootstrap_group_replication.inc
57
58 --echo
59 --echo #####################################################################
60 --echo # 2. Install clone plugin on server2.
61 --echo # Restart server with a monitoring process (mysqld_safe) if needed
62
63 # Install the clone plugin
64 --let $rpl_connection_name= server2
65 --source include/rpl_connection.inc
66
67 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
68 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
69
70 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
71 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
72
73 --let $plugin_list= $GROUP_REPLICATION
74 --source include/spawn_monitoring_process.inc
75
76 # Configure GR for starting now and after restart
77 --disable_query_log
78 --eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
79 --eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
80 --eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
81 SET PERSIST group_replication_start_on_boot= ON;
82 SET PERSIST group_replication_recovery_retry_count= 1;
83 --enable_query_log
84
85 --echo
86 --echo #####################################################################
87 --echo # 3. Join the group, clone will be done, but the recovery
88 --echo # after restart will fail due to the non-existent recovery user.
89
90 SET GLOBAL group_replication_clone_threshold= 1;
91
92 START GROUP_REPLICATION;
93
94 --source include/wait_until_disconnected.inc
95
96 --let $rpl_server_number= 2
97 --source include/rpl_reconnect.inc
98
99 --let $group_replication_member_state= ERROR
100 --source include/gr_wait_for_member_state.inc
101
102 --let $assert_text= Clone must be complete
103 --let $assert_cond= [SELECT state="Completed" FROM performance_schema.clone_status] = 1;
104 --source include/assert.inc
105
106 --echo
107 --echo ############################################################
108 --echo # 4. Cleanup.
109 --let $rpl_connection_name= server1
110 --source include/rpl_connection.inc
111 DROP TABLE t1;
112
113 --let $rpl_connection_name= server2
114 --source include/rpl_connection.inc
115 --source include/stop_group_replication.inc
116 DROP TABLE t1;
117
118 RESET PERSIST IF EXISTS group_replication_group_name;
119 RESET PERSIST IF EXISTS group_replication_local_address;
120 RESET PERSIST IF EXISTS group_replication_group_seeds;
121 RESET PERSIST IF EXISTS group_replication_start_on_boot;
122 RESET PERSIST IF EXISTS group_replication_recovery_retry_count;
123
124 SET SESSION sql_log_bin=0;
125 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.");
126 call mtr.add_suppression("There was an error when connecting to the donor server. Please check that group_replication_recovery channel credentials and all MEMBER_HOST column values of performance_schema.replication_group_members table are correct and DNS resolvable.");
127 call mtr.add_suppression("For details please check performance_schema.replication_connection_status table and error log messages of Replica I/O for channel group_replication_recovery.");
128 call mtr.add_suppression("Maximum number of retries when trying to connect to a donor reached. Aborting group replication incremental recovery.");
129 call mtr.add_suppression("Fatal error during the incremental recovery process of Group Replication. The server will leave the group.");
130 call mtr.add_suppression("The server was automatically set into read only mode after an error was detected.");
131 call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going.");
132 call mtr.add_suppression("Clone removing all user data for provisioning: Started");
133 call mtr.add_suppression("Clone removing all user data for provisioning: Finished");
134 SET SESSION sql_log_bin=1;
135
136 --source include/clean_monitoring_process.inc
137
138 --source include/group_replication_end.inc