MySQL Forums
Forum List  »  Replication

[4.1.14] patch for slave delay
Posted by: Paul Wankadia
Date: September 21, 2005 02:07AM

If I want the slave to lag behind the master by at least one hour, would the following patch be suitable? Thanks in advance.


--- sql/slave.cc.orig Thu Aug 18 03:06:30 2005
+++ sql/slave.cc Wed Sep 21 17:50:10 2005
@@ -3468,6 +3468,14 @@

while (!sql_slave_killed(thd,rli))
{
+#define MAX_SLAVE_DELAY_PAUSE 3600
+ if (mi->rli.last_master_timestamp)
+ {
+ long tmp = (long)((time_t)time((time_t*) 0) - mi->rli.last_master_timestamp) - mi->clock_diff_with_master;
+ if (MAX_SLAVE_DELAY_PAUSE > tmp)
+ safe_sleep(thd, MAX_SLAVE_DELAY_PAUSE - tmp, (CHECK_KILLED_FUNC)sql_slave_killed, (void*)rli);
+ }
+
thd->proc_info = "Reading event from the relay log";
DBUG_ASSERT(rli->sql_thd == thd);
THD_CHECK_SENTRY(thd);

Options: ReplyQuote


Subject
Views
Written By
Posted
[4.1.14] patch for slave delay
2534
September 21, 2005 02:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.