BTW, thanks Jan...see my followup below.
On Fri, 9 Feb 2007, Jeff Frost wrote:
> On Fri, 9 Feb 2007, Jan Wieck wrote:
>
>> On 2/9/2007 12:29 AM, Jeff Frost wrote:
>>> I've been using SYNC and WAIT FOR EVENT for some time since 1.2.x came out
>>> and I've noticed that occassionally it doesn't seem to work in 1.2.6. It's
>>> not every time, just occassionally. I have a script that looks like this
>>> (the execute script creates the test table):
>>>
>>> ===========
>>> #!/usr/local/slony/bin/slonik
>>>
>>> INCLUDE </home/postgres/lib/preamble.slonik>;
>>>
>>> EXECUTE SCRIPT (
>>> SET ID = 1,
>>> FILENAME = '/home/postgres/sql/create-test-table.sql',
>>> EVENT NODE = 1
>>> );
>>>
>>> CREATE SET (id = 9998, origin = 1, comment = 'temp set');
>>> SET ADD TABLE (set id=9998, origin=1, id=15,
>>> FULL QUALIFIED NAME = 'public.test', comment='test table');
>>>
>>> SUBSCRIBE SET (id=9998, provider=1, receiver=2);
>>> WAIT FOR EVENT (origin=2, confirmed =1);
>>
>> Add "WAIT ON = 2" to this one.
>
> So it would look like:
>
> CREATE SET (id = 9998, origin = 1, comment = 'temp set');
> SET ADD TABLE (set id=9998, origin=1, id=15,
> FULL QUALIFIED NAME = 'public.test', comment='test table');
>
> SUBSCRIBE SET (id=9998, provider=1, receiver=2);
> WAIT FOR EVENT (origin=2, confirmed =1);
> WAIT ON = 2;
Oh, looks like I found it in the docs, it's just not in the examples..should
be like this:
WAIT FOR EVENT (origin=2,
confirmed = 1,
wait on = 2);
Then presumably, the entire thing should look like:
=======
#!/usr/local/slony/bin/slonik
INCLUDE </home/postgres/lib/preamble.slonik>;
EXECUTE SCRIPT (
SET ID = 1,
FILENAME = '/home/postgres/sql/create-test-table.sql',
EVENT NODE = 1
);
CREATE SET (id = 9998, origin = 1, comment = 'temp set');
SET ADD TABLE (set id=9998, origin=1, id=15,
FULL QUALIFIED NAME = 'public.test', comment='test table');
SUBSCRIBE SET (id=9998, provider=1, receiver=2);
WAIT FOR EVENT (origin=2, confirmed=1, wait on=2);
SYNC(id = 1);
WAIT FOR EVENT (origin=1, confirmed =2, wait on=1);
MERGE SET ( id = 1, add id = 9998, origin = 1 );
========
yah?
>
> SYNC(id = 1);
> WAIT FOR EVENT (origin=1, confirmed =2);
>
> MERGE SET ( id = 1, add id = 9998, origin = 1 );
>
> Is that correct? If so, I don't see it in the docs.
>
>
>
>>
>>
>> Jan
>>
>>> SYNC(id = 1);
>>> WAIT FOR EVENT (origin=1, confirmed =2);
>>>
>>> MERGE SET ( id = 1, add id = 9998, origin = 1 );
>>> ==========
>>>
>>> After it runs for a few seconds, I'm greeted with:
>>>
>>> DDL on origin - PGRES_TUPLES_OK
>>> bin/v022-001-create-test-table.slonik:20: PGRES_FATAL_ERROR select
>>> "_T1".mergeSet(1, 9998); - ERROR: Slony-I: set 9998 has subscriptions in
>>> progress - cannot merge
>>>
>>> And of course if I go merge the set manually with pgadmin, it works fine.
>>>
>>> But, I thought the whole point of the SYNC followed by WAIT FOR EVENT was
>>> to make sure the subcription had completed. Have I read the docs wrong?
>>> Has it just been working as a race condition before or do I have my syntax
>>> a little off?
>>>
>>
>>
>>
>
>
--
Jeff Frost, Owner <[EMAIL PROTECTED]>
Frost Consulting, LLC http://www.frostconsultingllc.com/
Phone: 650-780-7908 FAX: 650-649-1954
_______________________________________________
Slony1-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/slony1-general