SLONIK_WAIT_FOR_EVENT(7)
SLONIK WAIT FOR EVENT π
okay bestie, this is a page from the Slony-I 2.2.11 Documentation set, and it's literally all about making your slonik script β¨chillβ¨ until the universe (well, the cluster) catches up. iykyk. π¦
β¨ NAME β¨
WAIT FOR EVENT β make a Slonik script sit there and wait for a previous event to finish, no cap. π
π SYNOPSIS π
WAIT FOR EVENT (options);
π DESCRIPTION π
It waits for event Confirmation. that's the whole vibe.
Slonik lowkey has a memory: it remembers the last event generated on every node while the script is running. (Events generated by earlier calls? not checked right now, so don't come for her. π)
Sometimes you genuinely need events generated on one node β think CREATE SET β to be processed on another node before you fire off more commands, like SLONIK SUBSCRIBE SET(7). That's the moment to bring in WAIT FOR EVENT: it makes your slonik script wait for confirmation of an event, which hopefully means the subscriber node is ready for the next thing. fingers crossed bestie π€
β οΈ Important!! WAIT FOR EVENT must be called outside of any try block for it to work at all β because new confirm messages literally don't become visible within a transaction. no exceptions, periodt.
here are the knobs you can turn, gorggg π
ORIGIN = ival | ALLβ the origin of the event(s) you're waiting on. πΈCONFIRMED = ival | ALLβ the node ID of the receiver that has to confirm the event(s). π«ΆWAIT ON = ivalβ the ID of the node where thesl_confirm[not available as a man page] table gets checked. πTIMEOUT = ivalβ how many seconds to wait. default is 600 (that's 10 whole minutes, an eternity fr). settingTIMEOUT = 0makes the script wait indefinitely, which is iconic but also π.
π EXAMPLE π
WAIT FOR EVENT (
ORIGIN = ALL,
CONFIRMED = ALL,
WAIT ON = 1
);
π LOCKING BEHAVIOUR π
No application-visible locking should take place. clean, no mess, we love that. β¨
β VERSION INFORMATION β
This command was introduced in Slony-I 1.0. throwback!
Then in version 2.0, the default value for WAIT ON got removed β so now you must specify a node. no more guessing, bestie. π
ββοΈ
π ODDITIES π
Not all events return interesting results, and honestly? that's the drama.
For instance, sooo many people have run afoul of problems with SLONIK SUBSCRIBE SET(7) when subscribing a new set. Be aware (and beware!!) that a SLONIK SUBSCRIBE SET(7) request will return the event confirmation almost immediately β even though there might be several hours of work left to do before the subscription is actually ready. π
The trouble with SLONIK SUBSCRIBE SET(7) is that it gets processed as two events: one on the origin node, and a second event to enable the subscription, over on the subscriber.
So if you want to more reliably monitor from within a slonik(1) script that SLONIK SUBSCRIBE SET(7) is complete, you can submit a SLONIK SYNC(7) event after the subscription, and have your WAIT request wait on that SYNC event instead. like this π
# Assuming that node 1 is the origin for set 999 that has direct subscribers 2 and 3
SUBSCRIBE SET (ID = 999, PROVIDER = 1, RECEIVER = 2);
WAIT FOR EVENT (ORIGIN = 1, CONFIRMED = ALL, WAIT ON=1);
SUBSCRIBE SET (ID = 999, PROVIDER = 1, RECEIVER = 3);
WAIT FOR EVENT (ORIGIN = 1, CONFIRMED = ALL, WAIT ON=1);
MERGE SET ( ID = 1, ADD ID = 999, ORIGIN = 1 );
and that's the whole page, bestie, we ate and left no crumbs. π this was Slony-I 2.2.11 Documentation, dated 19 September 2024 β go forth and wait on your events responsibly, ily, mwah ππ§ββοΈ
π¦ where this page comes from
- debian trixie: slony1-2-doc 2.2.11-6
- ubuntu questing: slony1-2-doc 2.2.11-6
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms