Bug #5116 | Seconds_Behind_Master incorrectly reported | ||
---|---|---|---|
Submitted: | 20 Aug 2004 0:23 | Modified: | 21 Sep 2004 2:52 |
Reporter: | Devananda v | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | MySQL Server: Replication | Severity: | S3 (Non-critical) |
Version: | 4.1.3-beta | OS: | Linux (Mandrake 9.2) |
Assigned to: | Assigned Account | CPU Architecture: | Any |
[20 Aug 2004 0:23]
Devananda v
[20 Aug 2004 23:52]
Matthew Lord
Hi, You may be having system time problems for some reason. Can you enable the logging of warnings with the msyqld startup option --log-warnings and see if you see this in your .err file: Warning: "SELECT UNIX_TIMESTAMP()" failed on master, do not trust column Seconds_Behind_Master of SHOW SLAVE STATUS" Thanks!
[21 Aug 2004 2:37]
Matthew Lord
After looking at this again I'm not sure that this is a bug but maybe a feature request. The Seconds_Behind_Master is a comparison of the the current system time and the timestamp for the last statement executed by replication's SQL thread. Based on the example you presented the seconds behind master came out to about 14 hours. Is it possible that no updates had happened on the master for that long? Best Regards
[21 Aug 2004 2:44]
Matthew Lord
We could add a feature request that adds a check to try and determine if the slave is fully caught up and display 0 instead of "The number of seconds that have elapsed since the timestamp of the last master's event executed by the slave SQL thread. " That is from http://dev.mysql.com/doc/mysql/en/SHOW_SLAVE_STATUS.html
[21 Aug 2004 2:52]
Devananda v
>After looking at this again I'm not sure that this is a bug but maybe a >feature request. The Seconds_Behind_Master is a comparison of the the current system time >and the timestamp for the last statement executed by replication's SQL thread. >Based on the example you presented the seconds behind master came out >to about 14 hours. Is it possible that no updates had happened on the master for that long? It is entirely possible, but then I have two questions regarding this. We have currently 7 pairs of servers each replicating A -> B and B -> A, where only A recieves client connections - therefor B is continuously processing A's binlog whereas A is indefinitely 'waiting for master (B) to send event'. Why would I see Seconds_Behind_Master increasing on only 3 of the 7 B's, when they are all (theoretically) following this model? Also, a hypothetical question: if I set up 2 servers, C and D, and began replication from C to D only, then connected to C and ran a couple transactions and verfied that D had replicated them (at this point seconds_behind_master should be ~0) and then *left them alone for a while* and did nothing on either C or D until an hour later, would D report that it was 3600 seconds_behind_master ? If this is the case (and how mysql is intended to behave), then this shows me that we have some other sort of problem, and 4 of our pairs (the ones that are reporting seconds_behind_master=0) are somehow misbehaving and I need to investigate that instead, and then I must apologize for thinking it was your bug, and not ours :) Thanks for your feedback! Devananda Neopets, Inc
[14 Feb 2005 22:54]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[1 Jun 2006 12:25]
Martijn van den Burg
This issue is popping up here, as well. Setup: replication A -> B, using 5.0.18-standard (Solaris 8). Seconds_Behind_Master sometimes reaches very high values for only a short period of time. Example: at Thu Jun 1 13:45:49 2006, the value of 'Seconds_Behind_Master' is 2449, for just one second. No queries were being executed at that time, and the latest query occurred just a few minutes before. The system time on the servers is identical and they are located closely together, on the same network segment. Here are the excerpts from the master and slave binlogs from around that time: MASTER #060601 13:42:21 server id 32 end_log_pos 125 Query thread_id=50809 exec_time=0 error_code=0 SET TIMESTAMP=1149162141; update LOGGER set VISITORS = (VISITORS + 1) where LOGGER_ID = 1; # at 2145566 #060601 13:42:21 server id 32 end_log_pos 2145593 Xid = 1185303 COMMIT; # at 2145593 #060601 13:52:59 server id 32 end_log_pos 28 Intvar SET INSERT_ID=17; # at 2145621 #060601 13:52:59 server id 32 end_log_pos 259 Query thread_id=54329 exec_time=0 error_code=0 SET TIMESTAMP=1149162779; insert into TIME_STATUS (MACHINE_ID, START_CODE, START_TIME, STATUS_TYPE_ID, MACHINE_STATUS_ID, MODE) values (327,'TM-1100', from_unixtime(1149162777),26,35,'N' ); # at 2145852 #060601 13:52:59 server id 32 end_log_pos 2145879 Xid = 1186847 COMMIT; # at 2145879 SLAVE #060601 13:42:21 server id 32 end_log_pos 125 Query thread_id=50809 exec_time=0 error_code=0 use msm; SET TIMESTAMP=1149162141; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1; SET @@session.sql_mode=0; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8; update LOGGER set VISITORS = (VISITORS + 1) where LOGGER_ID = 1; # at 16748 #060601 13:42:21 server id 32 end_log_pos 16775 Xid = 1446 COMMIT; # at 16775 #060601 13:52:59 server id 32 end_log_pos 28 Intvar SET INSERT_ID=17; # at 16803 #060601 13:52:59 server id 32 end_log_pos 259 Query thread_id=54329 exec_time=0 error_code=0 SET TIMESTAMP=1149162779; SET @@session.time_zone='SYSTEM'; insert into TIME_STATUS (MACHINE_ID, START_CODE, START_TIME, STATUS_TYPE_ID, MACHINE_STATUS_ID, MODE) values (327,'TM-1100', from_unixtime(1149162777),26,35,'N' ); # at 17034
[1 Jun 2006 12:44]
Martijn van den Burg
I would like to add the following: Seconds_Behind_Master returns to 0 after the previously mentioned value of 2449, but 33 minutes and 42 seconds later it suddenly becomes 4472 (and then drops back to 0): Thu Jun 1 13:45:49 2006 Seconds_Behind_Master : 2449 - 0 in between - Thu Jun 1 14:19:31 2006 Seconds_Behind_Master : 4472