1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
|
###############################################################################
# Check that replication will fail safely if we inappropriately change
# replication tables. Besides we check if some maintenance commands
# can run without a problem.
###############################################################################
--source include/not_group_replication_plugin.inc
--source include/no_valgrind_without_big.inc
--source include/not_mts_replica_parallel_workers.inc
--source include/master-slave.inc
--connection slave
--source include/stop_slave.inc
SHOW CREATE TABLE mysql.slave_relay_log_info;
ALTER TABLE mysql.slave_relay_log_info ENGINE= Innodb;
SHOW CREATE TABLE mysql.slave_relay_log_info;
--let $saved_relay_repo= `SELECT @@global.relay_log_info_repository`
--let $saved_master_repo= `SELECT @@global.master_info_repository`
--let $saved_sync_master= `SELECT @@global.sync_source_info`
SET @@global.relay_log_info_repository="TABLE";
SET @@global.master_info_repository="TABLE";
SET @@global.sync_source_info= 1;
--source include/start_slave.inc
--connection master
CREATE TABLE t_innodb (id INTEGER) engine= Innodb;
--connection slave
call mtr.add_suppression("Error writing relay log configuration.");
call mtr.add_suppression("Column count of mysql.slave_relay_log_info is wrong.");
call mtr.add_suppression("Error running query, replica SQL thread aborted.");
call mtr.add_suppression("Info table is not ready to be used.");
call mtr.add_suppression("Error writing source configuration.");
call mtr.add_suppression("Failed to flush connection metadata.");
call mtr.add_suppression(" Error while checking replication metadata.");
call mtr.add_suppression("Failed to create or recover replication info repository.");
call mtr.add_suppression("Error in checking.* repository info type of");
call mtr.add_suppression("Error creating.*: Error checking repositories");
call mtr.add_suppression("Failed to create or recover replication info repositories.");
call mtr.add_suppression("An unexpected event sequence was detected by the IO thread");
call mtr.add_suppression("GTID_LOG_EVENT .* is not expected in an event stream");
call mtr.add_suppression("Failed to initialize the connection metadata structure for channel ''");
###############################################################################
# Checking if replication can fail safely (SQL Thread)
###############################################################################
#
# The test executes the following steps:
# 1 - Changes mysql.slave_relay_log_info and SQL Thread stops gracefully.
# 2 - Shows that it is possible to restart the server although replication
# is not properly configured and working.
# 3 - Shows that after fixing the problem the server can be properly
# restared.
# 4 - Shows that trying to fix the problem with START SLAVE, RESET SLAVE may
# not work and requires to manually back up positions to restart
# replication.
#
#
# 1 - Changes mysql.slave_relay_log_info and SQL Thread stops gracefully.
#
--connection master
INSERT INTO t_innodb VALUES (1), (2), (3);
--source include/sync_slave_sql_with_master.inc
ALTER TABLE mysql.slave_relay_log_info DROP COLUMN Number_of_workers;
--connection master
INSERT INTO t_innodb VALUES (1), (2), (3);
--connection slave
# ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2 1805
--let $slave_sql_errno= 1805
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc
--source include/stop_slave_io.inc
#
# 2 - Shows that it is possible to restart the server although replication
# is not properly configured and working.
#
--let $rpl_server_number= 2
--let $rpl_server_parameters= --sync-source-info=1 --master-info-repository=TABLE --relay-log-info-repository=TABLE
--source include/rpl_restart_server.inc
--connection slave
--error ER_REPLICA_CONFIGURATION
START SLAVE SQL_THREAD;
ALTER TABLE mysql.slave_relay_log_info ADD COLUMN Number_of_workers INTEGER UNSIGNED AFTER Sql_delay;
UPDATE mysql.slave_relay_log_info SET Number_of_workers= 0;
#
# 3 - Shows that after fixing the problem the server can be properly
# restared.
#
--let $rpl_server_number= 2
--let $rpl_server_parameters= --sync-source-info=1 --master-info-repository=TABLE --relay-log-info-repository=TABLE
--source include/rpl_restart_server.inc
--connection slave
--source include/start_slave.inc
# 4 - Shows that trying to fix the problem with START SLAVE, RESET SLAVE may
# not work and requires to manually back up positions to restart
# replication.
#
--connection master
INSERT INTO t_innodb VALUES (1), (2), (3);
--source include/sync_slave_sql_with_master.inc
ALTER TABLE mysql.slave_relay_log_info DROP COLUMN Number_of_workers;
--connection master
INSERT INTO t_innodb VALUES (1), (2), (3);
--connection slave
# ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2 1805
--let $slave_sql_errno= 1805
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc
--source include/stop_slave_io.inc
--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
START SLAVE SQL_THREAD;
--let $_slave_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1)
--let $_slave_master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1)
--let $_slave_master_port= query_get_value(SHOW SLAVE STATUS, Master_Port, 1)
--let $_slave_master_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1)
--let $_slave_master_log_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
RESET SLAVE ALL;
--replace_result $_slave_master_host MASTER_HOST $_slave_master_user MASTER_USER $_slave_master_port MASTER_PORT $_slave_master_log_file MASTER_LOG_FILE $_slave_master_log_pos MASTER_LOG_POS
--replace_column 2 ####
--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST= '$_slave_master_host', SOURCE_USER= '$_slave_master_user', SOURCE_PORT= $_slave_master_port, SOURCE_LOG_FILE= '$_slave_master_log_file', SOURCE_LOG_POS= $_slave_master_log_pos
ALTER TABLE mysql.slave_relay_log_info ADD COLUMN Number_of_workers INTEGER UNSIGNED AFTER Sql_delay;
UPDATE mysql.slave_relay_log_info SET Number_of_workers= 0;
RESET SLAVE ALL;
--replace_result $_slave_master_host MASTER_HOST $_slave_master_user MASTER_USER $_slave_master_port MASTER_PORT $_slave_master_log_file MASTER_LOG_FILE $_slave_master_log_pos MASTER_LOG_POS
--replace_column 2 ####
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST= '$_slave_master_host', SOURCE_USER= '$_slave_master_user', SOURCE_PORT= $_slave_master_port, SOURCE_LOG_FILE= '$_slave_master_log_file', SOURCE_LOG_POS= $_slave_master_log_pos
--source include/start_slave.inc
--connection master
--source include/sync_slave_sql_with_master.inc
###############################################################################
# Checking if replication can fail safely (I/O Thread)
###############################################################################
#
# The test executes the following steps:
# 1 - Changes mysql.slave_master_info and SQL Thread stops gracefully.
# 2 - Shows that it is possible to restart the server although replication
# is not properly configured and working.
# 3 - Shows that after fixing the problem the server can be properly
# restared.
# 4 - Shows that trying to fix the problem with START SLAVE, RESET SLAVE may
# not work and requires to manually back up positions to restart
# replication.
#
#
# 1 - Changes mysql.slave_master_info and SQL Thread stops gracefully.
#
--connection slave
ALTER TABLE mysql.slave_master_info DROP COLUMN Enabled_auto_position;
--connection master
INSERT INTO t_innodb VALUES (1), (2), (3);
--connection slave
# ER_REPLICA_FATAL_ERROR
--let $slave_io_errno= 13117
--let $show_slave_io_error= 1
--source include/wait_for_slave_io_error.inc
--source include/stop_slave_sql.inc
#
# 2 - Shows that it is possible to restart the server although replication
# is not properly configured and working.
#
--let $rpl_server_number= 2
--let $rpl_server_parameters= --sync-source-info=1 --master-info-repository=TABLE --relay-log-info-repository=TABLE
--source include/rpl_restart_server.inc
--connection slave
--error ER_REPLICA_CONFIGURATION
START SLAVE SQL_THREAD;
ALTER TABLE mysql.slave_master_info ADD COLUMN Enabled_auto_position BOOLEAN NOT NULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.' AFTER Ssl_crlpath;
UPDATE mysql.slave_master_info SET Enabled_auto_position= 0;
#
# 3 - Shows that after fixing the problem the server can be properly
# restared.
#
--let $rpl_server_number= 2
--let $rpl_server_parameters= --sync-source-info=1 --master-info-repository=TABLE --relay-log-info-repository=TABLE
--source include/rpl_restart_server.inc
--connection slave
--source include/start_slave.inc
# 4 - Shows that trying to fix the problem with START SLAVE, RESET SLAVE may
# not work and requires to manually back up positions to restart
# replication.
#
--connection slave
ALTER TABLE mysql.slave_master_info DROP COLUMN Enabled_auto_position;
--connection master
INSERT INTO t_innodb VALUES (1), (2), (3);
--connection slave
# ER_REPLICA_FATAL_ERROR
--let $slave_io_errno= 13117
--let $show_slave_io_error= 1
--source include/wait_for_slave_io_error.inc
--source include/stop_slave_sql.inc
--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
START SLAVE SQL_THREAD;
--let $_slave_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1)
--let $_slave_master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1)
--let $_slave_master_port= query_get_value(SHOW SLAVE STATUS, Master_Port, 1)
--let $_slave_master_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1)
--let $_slave_master_log_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
RESET SLAVE ALL;
--replace_result $_slave_master_host MASTER_HOST $_slave_master_user MASTER_USER $_slave_master_port MASTER_PORT $_slave_master_log_file MASTER_LOG_FILE $_slave_master_log_pos MASTER_LOG_POS
--replace_column 2 ####
--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST= '$_slave_master_host', SOURCE_USER= '$_slave_master_user', SOURCE_PORT= $_slave_master_port, SOURCE_LOG_FILE= '$_slave_master_log_file', SOURCE_LOG_POS= $_slave_master_log_pos
ALTER TABLE mysql.slave_master_info ADD COLUMN Enabled_auto_position BOOLEAN NOT NULL COMMENT 'Indicates whether GTIDs will be used to retrieve events from the master.' AFTER Ssl_crlpath;
UPDATE mysql.slave_master_info SET Enabled_auto_position= 0;
RESET SLAVE ALL;
--replace_result $_slave_master_host MASTER_HOST $_slave_master_user MASTER_USER $_slave_master_port MASTER_PORT $_slave_master_log_file MASTER_LOG_FILE $_slave_master_log_pos MASTER_LOG_POS
--replace_column 2 ####
--eval CHANGE REPLICATION SOURCE TO SOURCE_HOST= '$_slave_master_host', SOURCE_USER= '$_slave_master_user', SOURCE_PORT= $_slave_master_port, SOURCE_LOG_FILE= '$_slave_master_log_file', SOURCE_LOG_POS= $_slave_master_log_pos
--source include/start_slave.inc
--connection master
--source include/sync_slave_sql_with_master.inc
###############################################################################
# Checking ANALYZE TABLE, CHECK TABLE, CHECKSUM TABLE, OPTIMIZE TABLE,
# REPAIR TABLE, SHOW CREATE TABLE and MYSQLDUMP
###############################################################################
#
# Check ANALYZE TABLE, CHECK TABLE and CHECKSUM TABLE
#
ANALYZE TABLE mysql.slave_master_info, mysql.slave_relay_log_info;
CHECK TABLE mysql.slave_master_info, mysql.slave_relay_log_info EXTENDED;
#
# Check OPTIMIZE TABLE and REPAIR TABLE
#
OPTIMIZE TABLE mysql.slave_master_info, mysql.slave_relay_log_info;
REPAIR TABLE mysql.slave_master_info, mysql.slave_relay_log_info EXTENDED;
#
# Check SHOW CREATE TABLE
#
SHOW CREATE TABLE mysql.slave_master_info;
SHOW CREATE TABLE mysql.slave_relay_log_info;
#
# Check MYSQLDUMP
#
--echo # Search for occurrences of slave_master_info in the output from mysqldump
--let $MYSQLD_DATADIR= `select @@datadir`
--exec $MYSQL_DUMP mysql slave_master_info slave_relay_log_info > $MYSQLTEST_VARDIR/tmp/accessing_repository.sql
--let OUTF=$MYSQLTEST_VARDIR/tmp/accessing_repository.sql
perl;
use strict;
my $outf= $ENV{'OUTF'} or die "OUTF not set";
open(FILE, "$outf") or die("Unable to open $outf: $!\n");
my $count = () = grep(/CREATE TABLE IF NOT EXISTS `slave_master_info`/gi,<FILE>);
print "- Occurrences: $count\n";
close(FILE);
EOF
--remove_file $MYSQLTEST_VARDIR/tmp/accessing_repository.sql
###############################################################################
# Cleaning up
###############################################################################
--connection master
DROP TABLE t_innodb;
--source include/sync_slave_sql_with_master.inc
--source include/stop_slave.inc
--disable_query_log
--eval SET @@global.relay_log_info_repository="$saved_relay_repo"
--eval SET @@global.master_info_repository="$saved_master_repo"
--eval SET @@global.sync_source_info=$saved_sync_master
--enable_query_log
--query_vertical SELECT * FROM mysql.slave_master_info
--query_vertical SELECT * FROM mysql.slave_relay_log_info
--let $rpl_server_number= 2
--let $rpl_server_parameters=
--source include/rpl_restart_server.inc
--connection slave
--source include/start_slave.inc
--source include/rpl_end.inc
|