Dmitry Koterov dmitry at koterov.ru
Tue Nov 13 09:49:31 PST 2007
Hello.

I need to automate teble creation operations. So I created the following
script:

cluster name =3D ...;
node 1 admin conninfo=3D'...';
node 2 admin conninfo=3D'...';
try {
  DEFINE TMP_SET_ID      667;
  DEFINE MASTER_SET_ID   1;
  DEFINE MASTER_NODE_ID  1;
  CREATE SET (id =3D @TMP_SET_ID, origin =3D @MASTER_NODE_ID, comment =3D
'Temporary set');
  INCLUDE <a.slnk>;
}
ECHO 'Subscribing node 2 to set...';
SUBSCRIBE SET (id =3D @TMP_SET_ID, provider =3D @MASTER_NODE_ID, receiver =
=3D 2,
forward =3D yes);
ECHO 'Wait for event A...';
WAIT FOR EVENT (ORIGIN =3D 2, CONFIRMED =3D @MASTER_NODE_ID);
SYNC (ID =3D @MASTER_NODE_ID);
ECHO 'Wait for event B...';
WAIT FOR EVENT (ORIGIN =3D @MASTER_NODE_ID, CONFIRMED =3D 2);
try {
  MERGE SET (id =3D @MASTER_SET_ID, add id =3D @TMP_SET_ID, origin =3D
@MASTER_NODE_ID);
}

But seems WAIT FOR EVENT does not wait for a node subscription, because the
result is:

<stdin>:14: Subscribing node 2 to set...
<stdin>:16: Wait for event A...
<stdin>:19: Wait for event B...
<stdin>:21: PGRES_FATAL_ERROR select "_moikrug_cluster".mergeSet(1, 667);  -
ERROR:  Slony-I: set 667 has subscriptions in progress - cannot merge

The question is: how to wait for a subscription finish.

Slony documentation is quite conflicting:
a) http://slony.info/documentation/stmtwaitevent.html says "There is no
reliable way, at present, to monitor from within a
slonik<http://slony.info/documentation/slonik.html>script that
SUBSCRIBE
SET <http://slony.info/documentation/stmtsubscribeset.html> is complete."
b) http://slony.info/documentation/stmtmergeset.html gives us an example of
such waiting (but in this example SYNC and WAIT FOR EVENT are seems to be
wrongly ordered)
c) http://slony.info/documentation/stmtsubscribeset.html says "This means
that WAIT FOR EVENT cannot directly wait for completion of a subscription.
If you need to wait for completion of a subscription, then what you need to
do instead is to submit a SYNC request, and wait for that event.", but it
does not work too (slonik version 1.2.9).

Possibly the new slony version (1.2.12) solves all these problems? If yes,
what should we do with all that conflicts in documentation?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.slony.info/pipermail/slony1-general/attachments/20071113/=
45f19d34/attachment.htm


More information about the Slony1-general mailing list