Steve Singer ssinger_pg at sympatico.ca
Sun May 16 18:41:34 PDT 2010
I've been looking into the behaviour of subscribe set for something and I'm 
a bit confused.

I was under the impression that the proper way of subscribing to a set is

subscribe set(id=1,provider=1,receiver=2);
wait for event(id=1, origin=1,confirmed=all);
sync(id=1);
wait for event(id=1, origin=1,confirmed=all);

(The documentation uses this sequence 
http://www.slony.info/documentation/addthings.html)

I thought that the 'wait for event' after the subscribe was to ensure that 
the sync happens after the enable subscription event has been generated. 
The documentation (on the SUBSCRIBE SET page in the admin docs) says

'subscription involves two events; the SUBSCRIBE_SET, initiated from the 
provider node, and an ENABLE_SUBSCRIPTION, which is initiated on the 
subscriber node'

which is consistent with why would need that first wait.  The problem I am 
having is that I don't think this is right.  In 2.0.x, if I subscribe to a 
set with no slons running I see both the SUBSCRIBE SET and the ENABLE 
SUBSCRIPTION events in the sl_event table of the provider (and looking at 
the code this makes sense).

Looking at the code, I it seems that the SUBSCRIBE SET and the ENABLE 
SUBSCRIPTION are both inserted into sl_event as part of the same 
transaction. The ENABLE SUBSCRPTION get processed on the receiver but it 
gets inserted into the event queue BEFORE slonik finishes with the 
'subscribe set' line.  So why the need to do that first WAIT FOR?

Am I misunderstanding something or did the location where the ENABLE 
SUBSCRIPTION event is created get changed and the documentation not get 
updated?


Steve



More information about the Slony1-hackers mailing list