Debian Codegraph @

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

raw
1 ################################################################################
2 # Validate that when a member joins a group, and it is missing data that was
3 # purged from group binary logs, the joiner member will proceed by cloning a
4 # a group member.
5 #
6 # Test:
7 # 0. The test requires two servers: M1 and M2.
8 # 1. Install clone plugin on server1.
9 # Commit some data and then purge all binary logs.
10 # Bootstrap a group on server1.
11 # 2. Install clone plugin on server2.
12 # Restart server with a monitoring process (mysqld_safe) if needed
13 # 3. Start GR, clone must be executed since recovery
14 # from binary logs is not possible.
15 # As a test variation, do not start on boot after cloning
16 # 4. Cleanup
17 #
18
19 --source include/have_mysqld_monitoring_process.inc
20 --source include/have_clone_plugin.inc
21 --source include/force_restart.inc
22 --source include/set_privilege_checks_user_as_system_user.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 # Commit some data and then purge all binary logs.
35 --echo # Bootstrap a group on server1.
36 --let $rpl_connection_name= server1
37 --source include/rpl_connection.inc
38
39 # Install the clone plugin
40 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
41 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
42
43 # Add some data for recovery
44 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
45 INSERT INTO t1 VALUES (1);
46 INSERT INTO t1 VALUES (2);
47
48 # Purge binary logs.
49 SET sql_log_bin = 0;
50 --source include/gtid_utils.inc
51 SET sql_log_bin = 1;
52
53 FLUSH BINARY LOGS;
54 --let $server_binlog_file_cur= query_get_value(SHOW MASTER STATUS, File, 1)
55 --replace_result $server_binlog_file_cur CURRENT_BINLOG_FILE
56 --eval PURGE BINARY LOGS TO '$server_binlog_file_cur'
57
58 --let $assert_text = GTID_PURGED must be equal to GTID_EXECUTED
59 --let $assert_cond = GTID_IS_EQUAL(@@GLOBAL.GTID_PURGED, @@GLOBAL.GTID_EXECUTED)
60 --source include/assert.inc
61
62 --source include/start_and_bootstrap_group_replication.inc
63
64 --echo
65 --echo #####################################################################
66 --echo # 2. Install clone plugin on server2.
67 --echo # Restart server with a monitoring process (mysqld_safe) if needed
68
69 # Install the clone plugin
70 --let $rpl_connection_name= server2
71 --source include/rpl_connection.inc
72
73 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
74 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
75
76 --let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
77 --let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
78 --let $_group_replication_comm_stack= `SELECT @@GLOBAL.group_replication_communication_stack`
79
80 --let $plugin_list= $GROUP_REPLICATION
81 --source include/spawn_monitoring_process.inc
82
83 # Configure GR for starting now and after restart
84 --disable_query_log
85 --eval SET PERSIST group_replication_group_name= "$group_replication_group_name"
86 --eval SET PERSIST group_replication_local_address= "$_group_replication_local_address"
87 --eval SET PERSIST group_replication_group_seeds= "$_group_replication_group_seeds"
88 --eval SET PERSIST group_replication_communication_stack= "$_group_replication_comm_stack"
89
90 --enable_query_log
91
92 --echo
93 --echo #####################################################################
94 --echo # 3. Start GR, clone must be executed since recovery
95 --echo # from binary logs is not possible.
96 --echo # As a test variation, do not start on boot after cloning
97
98 START GROUP_REPLICATION;
99 --source include/wait_until_disconnected.inc
100
101 --let $rpl_server_number= 2
102 --source include/rpl_reconnect.inc
103
104 --source include/start_group_replication.inc
105
106 --let $assert_text= Clone status must be completed
107 --let $assert_cond= [SELECT state="Completed" FROM performance_schema.clone_status] = 1;
108 --source include/assert.inc
109
110 --let $diff_tables= server1:test.t1, server2:test.t1
111 --source include/diff_tables.inc
112
113 --echo
114 --echo ############################################################
115 --echo # 4. Cleanup.
116 --let $rpl_connection_name= server2
117 --source include/rpl_connection.inc
118
119 RESET PERSIST IF EXISTS group_replication_group_name;
120 RESET PERSIST IF EXISTS group_replication_local_address;
121 RESET PERSIST IF EXISTS group_replication_group_seeds;
122 RESET PERSIST IF EXISTS group_replication_communication_stack;
123
124
125 DROP TABLE t1;
126 --source include/gtid_utils_end.inc
127 --source include/rpl_sync.inc
128
129 set session sql_log_bin=0;
130 call mtr.add_suppression("This member will start distributed recovery using clone. It is due to no ONLINE member has the missing data for recovering in its binary logs.");
131 call mtr.add_suppression("Clone removing all user data for provisioning: Started");
132 call mtr.add_suppression("Clone removing all user data for provisioning: Finished");
133 set session sql_log_bin=1;
134
135 --source include/clean_monitoring_process.inc
136
137 --source include/group_replication_end.inc