MINI MINI MANI MO

Path : /opt/mysql/mysql-test/suite/rpl/t/
File Upload :
Current File : //opt/mysql/mysql-test/suite/rpl/t/rpl_multi_source_mts_reset_worker_info.test

--source include/master-slave.inc
--source include/have_binlog_format_statement.inc

--source include/rpl_connection_slave.inc
#
# Bug #19930381 WL1697: 'START SLAVE' CRASHES POST RESTART
#
# Testing how well MSR manipulates the MTS Worker info table.
#

call mtr.add_suppression("Recovery from master pos .*");
call mtr.add_suppression("Corrupted table mysql.slave_worker_info");
call mtr.add_suppression("Could not delete from Slave Workers info repository");

--source include/stop_slave.inc
RESET SLAVE ALL;
SET @@global.master_info_repository="TABLE";
SET @@global.relay_log_info_repository="TABLE";
SET @save.slave_parallel_workers=@@global.slave_parallel_workers;
SET @@global.slave_parallel_workers=2;
--replace_result $MASTER_MYPORT MASTER_PORT
eval CHANGE MASTER TO MASTER_HOST='localhost', MASTER_USER='root', MASTER_PORT=$MASTER_MYPORT FOR CHANNEL 'ch_a';
CHANGE MASTER TO MASTER_HOST='dummy_host', MASTER_USER='root', MASTER_PORT=13010 FOR CHANNEL 'ch_b';
START SLAVE;

--let $count=4
--let $table=mysql.slave_worker_info
--source include/wait_until_rows_count.inc

# Per channel removal from worker info table proof:
STOP SLAVE FOR CHANNEL 'ch_b';
RESET SLAVE FOR CHANNEL 'ch_b';
--let $count=2
--let $table=mysql.slave_worker_info
--source include/wait_until_rows_count.inc

#
# Testing error branches.
#

STOP SLAVE FOR CHANNEL 'ch_a';
# Faking the worker table info corruption
ALTER TABLE mysql.slave_worker_info DROP PRIMARY KEY;

--error ER_UNKNOWN_ERROR
RESET SLAVE ALL FOR CHANNEL 'ch_a';
ALTER TABLE mysql.slave_worker_info ADD PRIMARY KEY (`channel_name`,`id`);
# now to compensate the above fake with removing the aimed records
DELETE FROM mysql.slave_worker_info WHERE channel_name like 'ch_a';
STOP SLAVE IO_THREAD;

--replace_result $MASTER_MYPORT MASTER_PORT
eval CHANGE MASTER TO MASTER_HOST='localhost', MASTER_USER='root', MASTER_PORT=$MASTER_MYPORT FOR CHANNEL 'ch_b';
--let $assert_text=Two workers are expected to survive the last RESET SLAVE
--let $assert_cond= `SELECT COUNT(*) = 0 FROM mysql.slave_worker_info`
--source include/assert.inc

--let $rpl_channel_name= ch_b
--source include/start_slave.inc

#
# Testing Worker info table after server restarts.
#
--echo
--echo === RESTART SERVER ===
--let $rpl_server_number= 1
--let $rpl_server_parameters= --gtid-mode=off --master-info-repository=TABLE --relay-log-info-repository=TABLE
--source include/rpl_restart_server.inc

--let $rpl_server_number= 2
--let $rpl_server_parameters= --relay-log-recovery --skip-slave-start --gtid-mode=off --master-info-repository=TABLE --relay-log-info-repository=TABLE
--source include/rpl_restart_server.inc

--source include/rpl_connection_slave.inc
START SLAVE;
--source include/stop_slave.inc

RESET SLAVE ALL;


OHA YOOOO