Dmitry Koterov dmitry at koterov.ru
Wed Jul 25 13:09:28 PDT 2007
Hello.

I have a timestamp (let it be X) on an origin database. I need to determine
if a subscriber have processed ALL updates commited BEFORE the time X (we
will say that in such case a subscriber is "up-to-date relative to X").
Please say, how do I do this correctly?


P.S.
I tried to scan sl_event table on a subscriber checking if we have an event
with ev_timestamp greater than X:

EXISTS (SELECT * FROM sl_event WHERE ev_timestamp > X)   -- run on a
subscriber

But this method is wrong - sometimes it says that a subscriber is
up-to-date, but the data inserted in a table before X is still not appeared
on a subscriber! Experiment shows that if I exclude SYNC events from
checking, all work fine:

EXISTS (SELECT * FROM sl_event WHERE ev_timestamp > X AND ev_type !=3D 'SYN=
C')
-- run on a subscriber

But excluding of SYNC is not a good method, because the next non-SYNC event
may be generated too late (e.g. in 30 minutes).

P.P.S.
In my situation X is calculated as clock_timestamp_before_an_update +
time_took_by_this_update. So, I assign the origin time to X, execute an
UPDATE+COMMIT query and then - adds time spent in this query to X to
determine the time of UPDATE finish for later checking.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.slony.info/pipermail/slony1-general/attachments/20070726/=
23ee6d6b/attachment.htm


More information about the Slony1-general mailing list