| 1 |
# ==== References ==== |
| 2 |
# |
| 3 |
# WL#7374 Performance schema tables to monitor replication lags and queue |
| 4 |
# |
| 5 |
# ==== Purpose ==== |
| 6 |
# This test verifies the behavior of QUEUEING_TIMESTAMPS in case of |
| 7 |
# partial transactions in the relay log. |
| 8 |
|
| 9 |
# This test case uses a debug point based on RBR |
| 10 |
--source include/have_binlog_format_row.inc |
| 11 |
--source include/have_debug.inc |
| 12 |
--let $rpl_skip_start_slave= 1 |
| 13 |
--source include/master-slave.inc |
| 14 |
|
| 15 |
--source include/rpl_connection_slave.inc |
| 16 |
--source include/start_slave_io.inc |
| 17 |
|
| 18 |
# this test case makes the receiver thread to parse and |
| 19 |
# events (WRITE_ROWS). These events are enclosed in |
| 20 |
# a Transaction_payload event when compression is on. |
| 21 |
--source include/not_binlog_transaction_compression_on.inc |
| 22 |
|
| 23 |
# Prepare the slave IO thread to stop after queuing a WRITE_ROWS event |
| 24 |
SET @save_debug=@@global.debug; |
| 25 |
SET GLOBAL DEBUG= "+d,stop_io_after_reading_write_rows_log_event"; |
| 26 |
|
| 27 |
# Do some transactions on master |
| 28 |
--source include/rpl_connection_master.inc |
| 29 |
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB; |
| 30 |
|
| 31 |
BEGIN; |
| 32 |
INSERT INTO t1 (c1) VALUES (1); |
| 33 |
COMMIT; |
| 34 |
|
| 35 |
# Wait for the slave IO thread to reach the debug point |
| 36 |
--source include/rpl_connection_slave.inc |
| 37 |
--source include/wait_for_slave_io_to_stop.inc |
| 38 |
|
| 39 |
--let $initial_queue_timestamp= query_get_value(select QUEUEING_TRANSACTION_START_QUEUE_TIMESTAMP from performance_schema.replication_connection_status,QUEUEING_TRANSACTION_START_QUEUE_TIMESTAMP,1) |
| 40 |
|
| 41 |
--source include/kill_and_restart_mysqld.inc |
| 42 |
--let $rpl_server_number= 2 |
| 43 |
--source include/rpl_reconnect.inc |
| 44 |
|
| 45 |
--let $restart_queue_timestamp= query_get_value(select QUEUEING_TRANSACTION_START_QUEUE_TIMESTAMP from performance_schema.replication_connection_status,QUEUEING_TRANSACTION_START_QUEUE_TIMESTAMP,1) |
| 46 |
|
| 47 |
# Debug point disappears on restart |
| 48 |
|
| 49 |
# Start slave |
| 50 |
--source include/start_slave.inc |
| 51 |
--source include/rpl_connection_master.inc |
| 52 |
--source include/sync_slave_io_with_master.inc |
| 53 |
|
| 54 |
--let $final_queue_timestamp= query_get_value(select LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP from performance_schema.replication_connection_status,LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP,1) |
| 55 |
|
| 56 |
# Check that the timestamps values are valid |
| 57 |
--let $unix_ts_initial= `SELECT UNIX_TIMESTAMP('$initial_queue_timestamp')` |
| 58 |
--let $unix_ts_restart= `SELECT UNIX_TIMESTAMP('$restart_queue_timestamp')` |
| 59 |
--let $assert_text= Assert that the timestamp after the restart is more recent than the initial timestamp |
| 60 |
--let $assert_cond= $unix_ts_restart - $unix_ts_initial > 0 |
| 61 |
--source include/assert.inc |
| 62 |
|
| 63 |
# Check that the timestamps values are valid |
| 64 |
--let $unix_ts_final= `SELECT UNIX_TIMESTAMP('$final_queue_timestamp')` |
| 65 |
--let $assert_text= Assert that the final queue timestamp is more recent than the timestamp after the restart |
| 66 |
--let $assert_cond= $unix_ts_final - $unix_ts_restart > 0 |
| 67 |
--source include/assert.inc |
| 68 |
|
| 69 |
# Cleanup |
| 70 |
--source include/rpl_connection_master.inc |
| 71 |
DROP TABLE t1; |
| 72 |
--source include/rpl_end.inc |