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
|
#
# The purpose of this test is to demonstrate the capabilities of the
# Replication Observers example plugin and to assess its correct functionality
#
# The plugin is only loaded on slave server to capture relay log notifications.
#
# Since one wants to test only the hook execution in place, a test
# plugin was created to serve those needs. The plugin will print once
# if the hook method is executed and the test will verify if the hook
# was called.
#
# This test will use the hooks related with Event control and SQL/IO
# thread handling.
# - after_reset_slave: Called after a RESET SLAVE is invoked
# - thread_start: Called when the IO Thread starts
# - before_request_transmit: Called before the slave requests the events
# from a master.
# - after_read_event: Called after an event is received.
# - after_queue_event: Called after an event is queued.
# - applier_stop: Called after the SQL Thread is stopped
# - thread_stop: Called after the IO Thread is stopped.
#
--source include/have_replication_observers_example_plugin.inc
--source include/not_group_replication_plugin.inc
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
--connection slave
--echo #
--echo # Stop slave and install plugin.
--echo #
--source include/stop_slave.inc
--source include/install_replication_observers_example.inc
--echo #
--echo # Cause a reset slave notification.
--echo #
RESET SLAVE;
--echo #
--echo # Cause a connect notification.
--echo #
--source include/start_slave.inc
--echo #
--echo # Execute some transactions on master to cause the other notifications.
--echo #
--connection master
CREATE TABLE t1 (c1 INT) Engine=InnoDB;
INSERT t1 VALUES(1);
DROP TABLE t1;
--source include/sync_slave_sql_with_master.inc
--echo #
--echo # Stop slave and uninstall plugin.
--echo #
--source include/stop_slave.inc
--source include/uninstall_replication_observers_example.inc
--echo #
--echo # Verify that all relay hooks were called.
--echo #
--let $grep_file=$MYSQLTEST_VARDIR/tmp/rpl_replication_observers_example_plugin_io.err
--let $grep_pattern=replication_observers_example_plugin:binlog_relay_after_reset_slave
--replace_regex /.* reported: \' //
--source include/grep_pattern.inc
--let $grep_file=$MYSQLTEST_VARDIR/tmp/rpl_replication_observers_example_plugin_io.err
--let $grep_pattern=replication_observers_example_plugin:binlog_relay_thread_start
--replace_regex /.* reported: \' //
--source include/grep_pattern.inc
--let $grep_file=$MYSQLTEST_VARDIR/tmp/rpl_replication_observers_example_plugin_io.err
--let $grep_pattern=replication_observers_example_plugin:binlog_relay_before_request_transmit
--replace_regex /.* reported: \' //
--source include/grep_pattern.inc
--let $grep_file=$MYSQLTEST_VARDIR/tmp/rpl_replication_observers_example_plugin_io.err
--let $grep_pattern=replication_observers_example_plugin:binlog_relay_after_read_event
--replace_regex /.* reported: \' //
--source include/grep_pattern.inc
--let $grep_file=$MYSQLTEST_VARDIR/tmp/rpl_replication_observers_example_plugin_io.err
--let $grep_pattern=replication_observers_example_plugin:binlog_relay_after_queue_event
--replace_regex /.* reported: \' //
--source include/grep_pattern.inc
--let $grep_file=$MYSQLTEST_VARDIR/tmp/rpl_replication_observers_example_plugin_io.err
--let $grep_pattern=replication_observers_example_plugin:binlog_relay_applier_start
--replace_regex /.* reported: \' //
--source include/grep_pattern.inc
--let $grep_file=$MYSQLTEST_VARDIR/tmp/rpl_replication_observers_example_plugin_io.err
--let $grep_pattern=replication_observers_example_plugin:binlog_relay_applier_stop
--replace_regex /.* reported: \' //
--source include/grep_pattern.inc
--let $grep_file=$MYSQLTEST_VARDIR/tmp/rpl_replication_observers_example_plugin_io.err
--let $grep_pattern=replication_observers_example_plugin:binlog_relay_thread_stop
--replace_regex /.* reported: \' //
--source include/grep_pattern.inc
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc
|