Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2.8, 10.2(EOL)
-
RHEL 6 x86_64
Description
When attempting to delay a Slave attached with GTID, there appears to be an extra delay applied initially. For example, this output reflects a Slave that is already delayed by 43200 seconds. When switching to GTID replication, replication is paused until SQL_Remaining_Delay counts down to 0:
MariaDB [(none)]> stop slave; CHANGE MASTER TO master_use_gtid=current_pos; CHANGE MASTER TO MASTER_DELAY=43200; start slave;
Relay_Master_Log_File: bin-log.018039
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Exec_Master_Log_Pos: 625
Seconds_Behind_Master: 44847
Using_Gtid: Current_Pos
SQL_Delay: 43200
SQL_Remaining_Delay: 43089
Slave_SQL_Running_State: Waiting until MASTER_DELAY seconds after master executed event
When switching to conventional replication coordinates, the delay is applied as expected:
MariaDB [(none)]> change master to master_log_file='bin-log.018040', master_log_pos=20289860;
Query OK, 0 rows affected (0.25 sec)
Relay_Master_Log_File: bin-log.018040
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Exec_Master_Log_Pos: 28182467
Seconds_Behind_Master: 43636
Using_Gtid: No
SQL_Delay: 43200
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Unlocking tables
Attachments
Issue Links
- relates to
-
MDEV-17469 Replication Slave + SQL_Delay
-
- Closed
-
Thanks for the report.
The test below is for reproducing only, do not put it into the regression suite!
The test sets delay to 20 seconds, then runs 2 inserts on master with 10-second interval, and checks status on the slave over the next minute.
Comments show which result is expect at which step.
With master_use_gtid=no everything works as expected. With master_use_gtid=current_pos, indeed, there is an extra delay:
####################################
# After 13 seconds waiting (expected behind ~13, remaining ~7, 1 row)
Slave_IO_Running = 'Yes'
Slave_SQL_Running = 'Yes'
Seconds_Behind_Master = '23'
SQL_Delay = '20'
SQL_Remaining_Delay = '17'
select * from t1;
i
####################################
# After 23 seconds waiting (expected behind 0, remaining NULL, 2 rows)
Slave_IO_Running = 'Yes'
Slave_SQL_Running = 'Yes'
Seconds_Behind_Master = '33'
SQL_Delay = '20'
SQL_Remaining_Delay = '7'
select * from t1;
i
At the end the slave catches up.
mdev13895.test
--source include/master-slave.inc
--source include/have_binlog_format_mixed.inc
--sync_slave_with_master
stop slave;
start slave;
--connection master
--sleep 10
--let $status_items= Slave_IO_Running,Slave_SQL_Running,Seconds_Behind_Master,SQL_Delay,SQL_Remaining_Delay
--connection slave
--echo ####################################
--echo # First check, 10 sec since 1st insert (expected behind ~10, remaining ~10, no rows)
--source include/show_slave_status.inc
--sleep 5
--echo ####################################
--echo # After 5 seconds waiting (expected behind ~15, remaining ~5, no rows)
--source include/show_slave_status.inc
--sleep 8
--echo ####################################
--echo # After 13 seconds waiting (expected behind ~13, remaining ~7, 1 row)
--source include/show_slave_status.inc
--sleep 10
--echo ####################################
--echo # After 23 seconds waiting (expected behind 0, remaining NULL, 2 rows)
--source include/show_slave_status.inc
--sleep 10
--echo ####################################
--echo # After 33 seconds waiting (expected behind 0, remaining NULL, 2 rows)
--source include/show_slave_status.inc
# Cleanup
stop slave;
start slave;
--connection master
--sync_slave_with_master
--connection master