SLONIK WAIT FOR EVENT

Name

WAIT FOR EVENT -- Have Slonik script wait for previous event to
complete

Synopsis

WAIT FOR EVENT (options);

Description

Waits for event Confirmation.

Slonik remembers the last event
generated on every node during script execution (events generated
by earlier calls are currently not checked). In certain situations
it is necessary that events generated on one node (such as
CREATE SET) are processed on another node
before issuing more commands (for instance, SLONIK SUBSCRIBE SET). WAIT FOR EVENT
may be used to cause the slonik script
to wait for confirmation of an event, which hopefully means that
the subscriber node is ready for the next action.

WAIT FOR EVENT must be called outside of
any try block in order to work, since new
confirm messages don't become visible within a transaction.

The number of seconds to wait. Default is 600
(10 minutes). TIMEOUT = 0 causes the script
to wait indefinitely.

Example

WAIT FOR EVENT (
ORIGIN = ALL,
CONFIRMED = ALL,
WAIT ON = 1
);

Locking Behaviour

No application-visible locking should take place.

Version Information

This command was introduced in Slony-I 1.0

In version 2.0, the default value for WAIT ON
was removed, so a node must be specified.

Oddities

Not all events return
interesting results. For instance, many people have run afoul of
problems with SLONIK SUBSCRIBE SET, when subscribing a
new set. Be aware (and beware!) that a SLONIK SUBSCRIBE SET request will return the event
confirmation almost immediately, even though there might be several
hours of work to do before the subscription is ready. The trouble
with SLONIK SUBSCRIBE SET is that it is processed as
two events, one on the origin node, with a
second event, to enable the subscription, on the subscriber.

In order to more reliably monitor from within a slonik script that SLONIK SUBSCRIBE SET is
complete, you may submit a SLONIK SYNC event after
the subscription, and have the WAIT request wait on the
SYNC event, as follows.