| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Test verifies that when "Master_Delay" is specified on slave with GTIDS there |
| 4 |
# will not be any extra delay initially. |
| 5 |
# |
| 6 |
# ==== Implementation ==== |
| 7 |
# |
| 8 |
# Steps: |
| 9 |
# 0 - Stop the slave and execute CHANGE MASTER command with |
| 10 |
# master_delay= 10 |
| 11 |
# 1 - Restart the slave and, after a brief moment, assert no ongoing delay. |
| 12 |
# 2 - On the slave, introduce a sleep of 15 seconds and check that the |
| 13 |
# Seconds_Behind_Master is within specified master_delay limit. It should |
| 14 |
# not be more that "10" seconds. |
| 15 |
# |
| 16 |
# ==== References ==== |
| 17 |
# |
| 18 |
# MDEV-13895: GTID and Master_Delay causes excessive initial delay |
| 19 |
# MDEV-38825: Slave delays when there is "nothing" to replicate |
| 20 |
|
| 21 |
--source include/have_binlog_format_mixed.inc |
| 22 |
--source include/master-slave.inc |
| 23 |
|
| 24 |
CREATE TABLE t1 (i INT); |
| 25 |
--sync_slave_with_master |
| 26 |
|
| 27 |
--source include/stop_slave.inc |
| 28 |
CHANGE MASTER TO MASTER_DELAY= 10; |
| 29 |
--source include/start_slave.inc |
| 30 |
|
| 31 |
--sleep 3 |
| 32 |
# Should be NULL and idle |
| 33 |
--let $status_items= SQL_Remaining_Delay, Slave_SQL_Running_State |
| 34 |
--source include/show_slave_status.inc |
| 35 |
|
| 36 |
--connection master |
| 37 |
INSERT INTO t1 VALUES (1); |
| 38 |
--source include/sync_slave_io_with_master.inc |
| 39 |
|
| 40 |
--connection slave |
| 41 |
--let $actual_delay= query_get_value(SHOW SLAVE STATUS, SQL_Delay, 1) |
| 42 |
--let $sleep_time= `SELECT 5 + $actual_delay` |
| 43 |
--echo "Sleeping for $sleep_time" |
| 44 |
--sleep $sleep_time |
| 45 |
|
| 46 |
--let $assert_cond= [SHOW SLAVE STATUS, Seconds_Behind_Master, 1] <= 10 |
| 47 |
--let $assert_text= Seconds_Behind_Master should be less than MASTER_DELAY |
| 48 |
--source include/rpl_assert.inc |
| 49 |
|
| 50 |
# The row should be available in table after master_delay=20 seconds. |
| 51 |
--let $assert_text= One row shoule be found in table t1. |
| 52 |
--let $assert_cond= COUNT(*) = 1 FROM t1 |
| 53 |
--source include/rpl_assert.inc |
| 54 |
|
| 55 |
--echo "======= Clean up ========" |
| 56 |
STOP SLAVE; |
| 57 |
CHANGE MASTER TO MASTER_DELAY=0; |
| 58 |
START SLAVE; |
| 59 |
|
| 60 |
--connection master |
| 61 |
DROP TABLE t1; |
| 62 |
--sync_slave_with_master |
| 63 |
|
| 64 |
--connection master |
| 65 |
--source include/rpl_end.inc |