config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/rpl/t/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //home/usr.opt/mysql57/mysql-test/suite/rpl/t/rpl_replication_observers_example_is_stopping.test

# ==== Purpose ====
#
# This test case will test if a server will not fail to know that the
# replication threads are stopping.
#
# The applier thread test:
#
# The test case generate a situation that will result into a SQL thread
# error. The error will not happen during the thread startup, so the
# "START SLAVE" command will succeed.
#
# The plug-in, once activated a certain debug point, will:
# a) unregister the thread stop hook;
# b) start the slave I/O thread
# c) start the slave SQL thread
# d) wait until SQL thread reach the error point
# e) register the thread stop hook;
# f) assert that the SQL thread is still considered as active
# g) assert that the SQL thread is considered as stopping
# h) assert that the plug-in has missed the thread stop hook
#
# The receiver thread test:
#
# The test case generate a situation that will result into a I/O thread
# error. The error will not happen during the thread startup, so the
# "START SLAVE IO_THREAD" command will succeed.
#
# The plug-in, once activated a certain debug point, will:
# a) unregister the thread stop hook;
# b) start the slave I/O thread
# c) wait until I/O thread reach the error point
# d) register the thread stop hook;
# e) assert that the I/O thread is still considered as active
# f) assert that the I/O thread is considered as stopping
# g) assert that the plug-in has missed the thread stop hook
#
# Before having the "stopping" flag, a replication thread could be
# considered as active after registering to monitor its thread stop
# hook, but never getting the thread stop signal because the thread
# was in a state that would not generate the thread stop signal
# anymore.
#
# ==== Related Bugs and Worklogs ====
#
# BUG#23618316 MONITORING THREAD MIGHT MISS THREAD STOP SIGNAL FROM RPL
#              THREADS HOOKS
#
--source include/not_group_replication_plugin.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/have_replication_observers_example_plugin.inc
# This test case is binary log format agnostic
--source include/have_binlog_format_mixed.inc
# This test cannot run with MTS
--source include/not_mts_slave_parallel_workers.inc
--source include/have_gtid.inc
--let $rpl_skip_start_slave= 1
--source include/master-slave.inc

--echo
--echo ############################################################
--echo # 1. Install the plug-in and add error suppressions on slave

--source include/rpl_connection_master.inc
SET SESSION sql_log_bin= 0;
CALL mtr.add_suppression(".*Cannot replicate.*purged required binary logs.*");
SET SESSION sql_log_bin= 1;

--source include/rpl_connection_slave.inc
SET SESSION sql_log_bin= 0;
CALL mtr.add_suppression("Table 't1' already exists");
CALL mtr.add_suppression("Got fatal error 1236 from master when reading data from binary log");
SET SESSION sql_log_bin= 1;
--source include/install_replication_observers_example.inc

--echo
--echo ####################################################################
--echo # 2. Create a table on master and generate workload to be replicated

--source include/rpl_connection_master.inc
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);

--echo
--echo ########################################
--echo # 3. Create the example_channel on slave

--source include/rpl_connection_slave.inc
--replace_result $MASTER_MYPORT MASTER_MYPORT
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_AUTO_POSITION=1 FOR CHANNEL 'example_channel'

--echo
--echo #######################
--echo # 4. SQL thread testing

--echo
--echo #################################################
--echo # 4.1 Prepare SQL thread to fail after started up

# This is to make the SQL thread to fail
SET SESSION sql_log_bin= 0;
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
SET SESSION sql_log_bin= 1;

# Set the debug point to test using the plug-in
--let $debug_point=validate_replication_observers_plugin_server_is_sql_stopping
--source include/add_debug_point.inc
# Set the debug point to test the SQL thread
--let $debug_point=pause_after_sql_thread_stop_hook
--source include/add_debug_point.inc

# Activate the test function in the plug-in
# It will take care of starting the SQL thread
--source include/rpl_connection_slave1.inc
SET SESSION sql_log_bin= 0;
--send INSERT INTO t1 VALUES (0)

--echo
--echo #########################################################
--echo # 4.2 Wait until SQL thread failed trying to apply events

--source include/rpl_connection_slave.inc
# Wait until the plug-in has stated the SQL thread
SET DEBUG_SYNC='now WAIT_FOR reached_sql_thread_started';

# Wait until the SQL thread has failed
--let $slave_sql_errno= convert_error(ER_TABLE_EXISTS_ERROR)
--let $rpl_channel_name= example_channel
--source include/wait_for_slave_sql_error.inc

# Remove debug instrumentation
--let $debug_point=pause_after_sql_thread_stop_hook
--source include/remove_debug_point.inc
--let $debug_point=validate_replication_observers_plugin_server_is_sql_stopping
--source include/remove_debug_point.inc

# Cleanup of step 4
--source include/rpl_connection_slave1.inc
--reap
SET SESSION sql_log_bin= 1;
--source include/stop_slave.inc
RESET SLAVE FOR CHANNEL 'example_channel';

--echo
--echo #######################
--echo # 5. I/O thread testing

--echo
--echo ##########################################################################
--echo # 5.1 Rotate and purge the binary log on master to make I/O thread to fail

--source include/rpl_connection_master.inc
FLUSH BINARY LOGS;
--let $server_binlog_file_cur= query_get_value(SHOW MASTER STATUS, File, 1)

# Need to kill the dump thread explicitly: stop slave does not do
# that, and if the dump thread is slow, it will still be reading from
# the old binlog at the time we do PURGE BINARY LOGS below. That would
# prevent PURGE BINARY LOGS from purging the log.
--source include/stop_dump_threads.inc

--disable_query_log
--eval PURGE BINARY LOGS TO '$server_binlog_file_cur'
--enable_query_log

--echo
--echo #################################################
--echo # 5.2 Prepare I/O thread to fail after started up

--source include/rpl_connection_slave.inc
# Set the debug point to test using the plug-in
--let $debug_point=validate_replication_observers_plugin_server_is_io_stopping
--source include/add_debug_point.inc
# Set the debug point to test the I/O thread
--let $debug_point=pause_after_io_thread_stop_hook
--source include/add_debug_point.inc

# Activate the test function in the plug-in
# It will take care of starting the I/O thread
--source include/rpl_connection_slave1.inc
SET SESSION sql_log_bin= 0;
--send INSERT INTO t1 VALUES (1)

--echo
--echo ###########################################################
--echo # 5.3 Wait until I/O thread failed to replicate from master

--source include/rpl_connection_slave.inc
# Wait until the plug-in has stated the I/O thread
SET DEBUG_SYNC='now WAIT_FOR reached_io_thread_started';

--let $slave_io_errno= convert_error(ER_MASTER_FATAL_ERROR_READING_BINLOG)
--let $rpl_channel_name= example_channel
--source include/wait_for_slave_io_error.inc

# Remove debug instrumentation
--let $debug_point=pause_after_io_thread_stop_hook
--source include/remove_debug_point.inc
--let $debug_point=validate_replication_observers_plugin_server_is_io_stopping
--source include/remove_debug_point.inc

# Cleanup of step 5
--source include/rpl_connection_slave1.inc
--reap
DROP TABLE t1;
SET SESSION sql_log_bin= 1;

--echo
--echo ############
--echo # 6. Cleanup

--source include/rpl_connection_slave.inc
# Remove the example_channel on the slave
RESET SLAVE ALL FOR CHANNEL 'example_channel';
# Remove the plug-in on the slave
--source include/uninstall_replication_observers_example.inc

# Cleanup the master to be able to replicate from it again
--source include/rpl_connection_master.inc
DROP TABLE t1;
RESET MASTER;

--source include/rpl_connection_slave.inc
# Start the default channel slave threads
--let $rpl_channel_name=
--source include/start_slave.inc

--source include/rpl_end.inc

Man Man