Re: time-delayed standbys

Greg Stark <gsstark@mit.edu>

From: Greg Stark <gsstark@mit.edu>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>, pgsql-hackers@postgresql.org
Date: 2011-04-20T15:52:22Z
Lists: pgsql-hackers
On Wed, Apr 20, 2011 at 3:41 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Greg Stark <gsstark@mit.edu> writes:
>> Ah, so we did put the master's clock in every message?
>
> Yes, we did.

And by "we" I mean "you".... I realize I'm tossing in comments from
the peanut gallery to you and especially Robert who worked on this
stuff a lot already.


>> Then this
>> should be simple, no? Just compare the master's timestamp from the
>> record to the last master's clock seen in the messages. That sounds
>> equivalent but a lot safer than trying to keep a conversion between
>> them.
>
> Well, the question is what happens after you stop receiving master
> messages.  If you don't make use of the slave's clock somehow,
> application of WAL will stop dead in the water, which seems unlikely
> to be what's wanted.

I'm not convinced that's so bad. But even so the logic could be:

wait until (master.last_time_seen > this_record.master-timestamp+n minutes ||
               gettimeofday() > this_record.local_time_when_received+n minutes)




-- 
greg