Debian Codegraph @

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

raw
1 ###############################################################################
2 # This test evaluates that a server can be shutdown when clone is in progress
3 # in the context of group replication.
4 #
5 # 0. This test requires 2 servers.
6 # 1. Install clone plugin on server1.
7 # 2. Bootstrap server1 and add some data
8 # 3. Make a backup of server 2 to restore it at the end
9 # 4. Install the clone plugin on server2
10 # 5. On a empty server2 start group replication
11 # Block clone progress
12 # 6. Shutdown the server while the clone is happening
13 # 7. Restart server2 using the backup folder
14 # 8. Cleanup
15 #
16
17 --source include/have_debug_sync.inc
18 --source include/not_windows.inc
19 --source include/have_clone_plugin.inc
20 --source include/have_group_replication_plugin.inc
21 --let $rpl_skip_group_replication_start= 1
22 --source include/group_replication.inc
23
24 # Validate plugins
25 --let plugins = CLONE_PLUGIN,GROUP_REPLICATION
26 --source include/check_plugin_dir.inc
27
28 --echo
29 --echo ############################################################
30 --echo # 1. Install clone plugin on server1.
31
32 --let $rpl_connection_name= server1
33 --source include/rpl_connection.inc
34 --let $server1_port= `SELECT @@GLOBAL.PORT`
35
36 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
37 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
38
39 --echo
40 --echo ############################################################
41 --echo # 2. Bootstrap server1 and add some data
42
43 --source include/start_and_bootstrap_group_replication.inc
44
45 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
46 INSERT INTO t1 VALUES (1);
47
48 --echo ############################################################
49 --echo # 3. Make a backup of server 2 to restore it at the end
50
51 --let $rpl_connection_name= server2
52 --source include/rpl_connection.inc
53
54 --let $BACKUP_DATADIR = $MYSQL_TMP_DIR/data_new
55 --let $MYSQLD_2_DATADIR= `SELECT @@datadir`
56 --force-cpdir $MYSQLD_2_DATADIR $BACKUP_DATADIR
57
58 --echo
59 --echo ############################################################
60 --echo # 4. Install the clone plugin on server2
61
62 --replace_result $CLONE_PLUGIN CLONE_PLUGIN
63 --eval INSTALL PLUGIN clone SONAME '$CLONE_PLUGIN'
64
65 --echo
66 --echo ############################################################
67 --echo # 5. On a empty server2 start group replication
68 --echo # Block clone progress
69
70 --let $_group_replication_threshold_save= `SELECT @@GLOBAL.group_replication_clone_threshold`
71 SET GLOBAL group_replication_clone_threshold= 1;
72
73 SET GLOBAL clone_autotune_concurrency = OFF;
74 SET GLOBAL clone_max_concurrency = 1;
75 SET @@GLOBAL.DEBUG='+d,gr_clone_wait';
76
77 --replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME
78 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
79
80 START GROUP_REPLICATION;
81
82 SET DEBUG_SYNC = 'now WAIT_FOR gr_clone_paused';
83
84 --echo
85 --echo ############################################################
86 --echo # 6. Shutdown the server while the clone is happening
87
88 --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
89 --exec echo "wait" > $_expect_file_name
90
91 --exec $MYSQLADMIN -uroot --password="" -S $SLAVE_MYSOCK shutdown 2>&1
92
93 --source include/wait_until_disconnected.inc
94
95 --echo
96 --echo ############################################################
97 --echo # 7. Restart server2 using the backup folder
98
99 --force-rmdir $MYSQLD_2_DATADIR
100 --force-cpdir $BACKUP_DATADIR $MYSQLD_2_DATADIR
101 --force-rmdir $BACKUP_DATADIR
102
103 --source include/start_mysqld.inc
104
105 --let $rpl_server_number= 2
106 --source include/rpl_reconnect.inc
107
108 --echo
109 --echo ############################################################
110 --echo # 8. Cleanup
111
112 --let $rpl_connection_name= server1
113 --source include/rpl_connection.inc
114
115 DROP TABLE t1;
116
117 --let $rpl_connection_name= server2
118 --source include/rpl_connection.inc
119
120 set session sql_log_bin=0;
121 call mtr.add_suppression("Clone removing all user data for provisioning: Started");
122 call mtr.add_suppression("Clone removing all user data for provisioning: Finished");
123 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.");
124 call mtr.add_suppression("Internal query: CLONE INSTANCE FROM \'root\'@\'127.0.0.1\':[0-9]+ IDENTIFIED BY \'\\*\\*\\*\\*\\*\' REQUIRE NO SSL; result in error. Error number:*");
125 call mtr.add_suppression("There was an issue when cloning from another server: Error number: 1317 Error message: Query execution was interrupted'");
126 call mtr.add_suppression("Plugin group_replication reported: 'Error, maximum number of retries exceeded when waiting for the internal server session state to be operating'");
127 call mtr.add_suppression("Failed to establish an internal server connection to execute plugin operations");
128 call mtr.add_suppression("Info table is not ready to be used. *");
129 call mtr.add_suppression("Error while starting the group replication applier thread");
130 set session sql_log_bin=1;
131
132 --let $rpl_connection_name= server1
133 --source include/rpl_connection.inc
134
135 UNINSTALL PLUGIN clone;
136
137 --source include/group_replication_end.inc