Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Fix
-
10.2.12, 5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL)
Description
Hi,
When I run replication normally, I get a value in "Seconds_Behind_Master" from "SHOW SLAVE STATUS". However, when I run only the SQL Thread (on local relay logs that have been downloaded previously), I have "NULL" in "Seconds_Behind_Master". I would expect to have a numeric value.
Also, note that the manual ([1]) does not document a "NULL" value in "Seconds_Behind_Master", even if "NULL" is shown when the SQL Thread is not running. This might be a different bug thought and is documentation related.
[1]: https://mariadb.com/kb/en/library/show-slave-status/
mysql <<< "select version();"
|
version()
|
10.2.12-MariaDB-log
|
mysql <<< "start slave; do sleep(1); show slave status\G stop slave" | grep Seconds_Behind_Master
|
Seconds_Behind_Master: 130422
|
mysql <<< "start slave sql_thread; do sleep(1); show slave status\G stop slave" | grep Seconds_Behind_Master
|
Seconds_Behind_Master: NULL
|
mysql <<< "stop slave; do sleep(1); show slave status\G" | grep Seconds_Behind_Master
|
Seconds_Behind_Master: NULL
|
Many thanks for looking into that,
JFG
It looks like a usual documentation deficiency. MySQL manual actually describes it quite explicitly:
https://dev.mysql.com/doc/refman/5.6/en/show-slave-status.html
So, both before and after 5.6.9, the field was/is NULL when IO thread was not running.
I'll leave it to Elkin to decide if he wants to change it. In any case, it should be documented much better, since Seconds_Behind_Master is one of the most notoriously confusing status values in MySQL / MariaDB.
--source include/master-slave.inc
--sync_slave_with_master
--let $status_items= Seconds_Behind_Master
--source include/show_slave_status.inc
STOP SLAVE IO_THREAD;
--source include/wait_for_slave_io_to_stop.inc
--let $status_items= Seconds_Behind_Master
--source include/show_slave_status.inc
START SLAVE IO_THREAD;
--source include/wait_for_slave_io_to_start.inc
--let $status_items= Seconds_Behind_Master
--source include/show_slave_status.inc
--connection master
--sync_slave_with_master
--let $status_items= Seconds_Behind_Master
--source include/show_slave_status.inc
# Cleanup
--connection master
output
include/master-slave.inc
[connection master]
create table t1 (i int);
drop table t1;
connection slave;
Seconds_Behind_Master = '0'
STOP SLAVE IO_THREAD;
include/wait_for_slave_io_to_stop.inc
Seconds_Behind_Master = 'NULL'
START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc
Seconds_Behind_Master = '0'
connection master;
create table t1 (i int);
drop table t1;
connection slave;
Seconds_Behind_Master = '0'
connection master;
include/rpl_end.inc
bug.mdev15010 'mix' [ pass ] 992