Steve Singer ssinger at ca.afilias.info
Fri Jan 14 12:09:21 PST 2011
On 11-01-13 04:13 PM, Christopher Browne wrote:
> Bug #173 is about the notion of extending Slonik to allow one to
> ask a Slonik script to error out upon running into particular
> conditions.
>
> These "ABORT" statements could be used to guard a script; if it runs
> into unacceptable pre-conditions, it may terminate before it does any
> damage to the cluster.
>
> I suggest the following, as starting points:
>
> - Behind by...
>     ->= 5 events
>     ->= 30 seconds
>
>    ABORT IF BEHIND ( PROVIDER = 1, RECEIVER = 3, SECONDS = 30, comment = 'Behind by 30 seconds', return=1);
>    ABORT IF BEHIND ( PROVIDER = 1, RECEIVER = 3, EVENT = 5, comment= 'Behind by 5 events', return=2);
>

I like this idea in principal:
-Do you mean provider or do you really mean origin?
-I think EVENT should be 'EVENT COUNT' or something to indicate that we 
are checking the number of events it is behind, versus ('has the 
receiver received event number 5')
.


> Other Health Criteria
> - Is node there?

This is worthwhile. Slonik already has a function that basically does 
this. (I see this as a connectivity test not an existance test where you 
obviously can't connect to something that doesn't exist).

> - Is replication set there?
> - Is subscription active?
> - Run SQL, fail if ERROR
>
>    ABORT IF NODE ABSENT ( EVENT NODE = 1, ID = 3, comment = 'Node 3 missing according to node 1',return=3);
>    ABORT IF SET ABSENT ( EVENT NODE = 1, ID = 3, comment = 'Set 3 missing according to node 1',return=4);
>    ABORT IF SET NOT SUBSCRIBED ( EVENT NODE = 1, ID = 3, comment = 'Set 3 not subscribed by node 1', return=5 );
>    ABORT IF SCRIPT ERROR ( EVENT NODE = 1, script = '/tmp/myscript.sql',return=6 );

These lead me to want things like:  "Is the replication set there? If 
not don't abort run these slonik commands to create it'.  All of these 
are also questions about the configuration of the cluster I wonder if 
script writers wouldn't be better off querying the sl_* tables directly 
to answer this from a 'real' scripting language (shell,perl, etc...)

Back when we were discussing ideas for 2.1 I had discussed an idea where 
we replace slonik with stored functions that can connect to remote nodes 
via libpq.   You could then write your slonik scripts in your favorite 
pl for conditionals and loops.   Though this is a huge change and not in 
scope for 2.1








More information about the Slony1-general mailing list