I'm confused by a bit of the documentation here:
  http://dev.mysql.com/doc/refman/5.0/en/show-slave-status.html

In the section on Seconds_Behind_Master, first it says:

  When the slave SQL thread is actively running (processing updates),
  this field is the number of seconds that have elapsed since the
  timestamp of the most recent event on the master executed by that thread.

... but later it says:

 If the network connection between master and slave is fast, the slave
 I/O thread is very close to the master, so this field is a good
 approximation of how late the slave SQL thread is compared to the
 master. If the network is slow, this is not a good approximation; the
 slave SQL thread may quite often be caught up with the slow-reading
 slave I/O thread, so Seconds_Behind_Master often shows a value of 0,
 even if the I/O thread is late compared to the master. In other
 words, this column is useful only for fast networks.

These two sections seem contradictory to me.  If Seconds_Behind_Master
actually works the way it is first defined, then it should reflect any
delays caused by the network as well as delays in the SQL thread.

Since each event in the binary log is timestamped by the master, we
know when the operation happened on the master.  If we compare that
timestamp to the current time, we know how long ago it happened - so
if we look at the timestamp of the most recent event executed by the
slave SQL thread we see when it happened on the master, and can tell
how much time has elapsed since then.

Two problems with this approach would be:

 1. If the local clocks on the master and slave aren't in sync,
    the timestamp comparison to current time would be off.

 2. If no writes to the master database have happened in a while, this
    would report the slave as "behind" because the most recent operation
    on the master has a timestamp from some time ago.

Both of these lead me to suspect that Seconds_Behind_Master does *not*
actually work the way the first paragraph implies; if so, then the
second paragraph I quoted from the doc could very well be true.

But if so, what exactly does Seconds_Behind_Master show?
  -- Cos

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to