Last modified: 2014-08-17 17:44:24 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T50628, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 48628 - Provide replication lag as a database function
Provide replication lag as a database function
Status: NEW
Product: Wikimedia Labs
Classification: Unclassified
tools (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Marc A. Pelletier
:
Depends on:
Blocks: db-repl-track labs-replication 66868
  Show dependency treegraph
 
Reported: 2013-05-20 04:59 UTC by Tim Landscheidt
Modified: 2014-08-17 17:44 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Tim Landscheidt 2013-05-20 04:59:34 UTC
There should be a function tools.replag() (can MySQL tie functions to a database?) that provides the replication lag in seconds, and maybe another function tools.lastrepupdate() that returns "NOW() - replag()".

It should be a "SECURITY DEFINER" function that queries "SHOW SLAVE STATUS.Seconds_Behind_Master" (cf. mediawiki/core:includes/db/DatabaseMysql.php).  This is preferable to the Toolserver method of querying recentchanges as it gives a more accurate picture of the actual replication lag.  http://stackoverflow.com/questions/1570776/how-to-access-seconds-behind-master-from-sql has some information that this query should be possible, though not trivial.
Comment 1 Tim Landscheidt 2014-02-14 13:43:39 UTC
I wondered what effect multi-hop replication like in LabsDB (production DBs => sanitizer => LabsDB) has on Seconds_Behind_Master, and Sean said that for this reason WMF uses http://www.percona.com/doc/percona-toolkit/2.2/pt-heartbeat.html.  So a database function as proposed in this bug should probably query the heartbeat record instead.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links