Marc G. Fournier marc
Tue Feb 28 22:37:24 PST 2006
On Tue, 28 Feb 2006, Brad Nicholson wrote:

> Marc G. Fournier wrote:
>
>> Looking at http://linuxfinances.info/info/addthings.html, I'm wondering if 
>> someone has an example slonik script that would add one table to an 
>> existing set, where one is dealing with a single slave?
>> 
>> Is it as simple as:
>> 
> Yes (besides a a typo in the merge set - extra 9)
>
>> slonik <<_EOF_
>>   CREATE SET ( ID = 999, ORIGIN = 1, COMMENT = 'Add New Table' );
>>
>>   SET ADD TABLE (
>>         SET ID = 999,
>>         ORIGIN = 1,
>>         ID = 20,
>>         FULLY QUALIFIED NAME = 'public.newtable',
>>         COMMENT = 'New Table To Add'
>>     );
>>
>>   SUBSCRIBE SET (
>>        ID = 999,
>>        PROVIDER = 1,
>>        RECEIVER = 2,
>>        FORWARD = YES
>>     );
>>
>>   MERGE SET ( ID = 1,
>>          ADD ID = 9999,
>>          ORIGIN = 1 );
>> 
>> _EOF_
>> 
>> Now, I'm guessing right now, but PROVIDER/RECEIVER can "reuse" the ones 
>> that are already defined as part of the original replication set, I don't 
>> need to create new ones just for the temporary set, do I?
>>
>> 
> These are on a set by set basis, the fact that they are defined for another 
> set is irrelevant.
>
>> Also, is there a way in slonik of telling SET ADD TABLE to use the next 
>> available ID, or do I have to query the sl_table for 'max(tab_id) + 1' 
>> before I setup the script?
>>
>> 
> No way to do it automatically.
>
>> And, finally, I hope ... MERGE SET automatically gets rid of the TEMP SET 
>> that I'm creating for this purpose, or do I need to remove that after its 
>> MERGEd?
>> 
>
> Once you merge, set 999 will indeed be gone.

What about the extra nodes that you indicate above I have to create?  Will 
those disappear also?  Is there any 'clean up' I'll need to do?

Basically, I'm trying to build up an 'add table' script for an application 
that creates tables on the fly, so need to make sure I'm not going to step 
on anything each time the script gets executed :(

thanks ...



More information about the Slony1-general mailing list