Steve Singer ssinger at ca.afilias.info
Fri Nov 9 10:13:54 PST 2012
On 12-11-08 12:31 PM, Glyn Astill wrote:
> Hi Guys,
>
> I was just taking a look at the changes to lockset() between 2.0 and 2.1
> and noticed it now uses a lock on the row in sl_set rather than a table
> lock on sl_config_lock.
>
> I was wondering, does this now make it possible to do something along
> the lines of:
>
> TRY {
> LOCK SET ( ID = 1, ORIGIN = 1);
> LOCK SET ( ID = 2, ORIGIN = 1);
> }
> ON ERROR ( blah }
> MOVE SET ( ID = 1, OLD ORIGIN = 1, NEW ORIGIN = 2);
>

No the LOCK SET needs to be done as part of the same transaction as the 
MOVE SET.  You can't do that across the bounds of a try block. You also 
can't do WAIT FOR EVENT inside of a try block.

WAIT FOR EVENT (ORIGIN = 1, CONFIRMED = ALL, WAIT ON = 1, TIMEOUT = 0);
> MOVE SET ( ID = 2, OLD ORIGIN = 1, NEW ORIGIN = 2);
> WAIT FOR EVENT (ORIGIN = 1, CONFIRMED = ALL, WAIT ON = 1, TIMEOUT = 0);
>
> (Or even wrap the move sets in a try too?)

Why can't you just do

try {
LOCK SET ( ID = 1, ORIGIN = 1);
LOCK SET ( ID = 2, ORIGIN = 1);
MOVE SET ( ID = 1, OLD ORIGIN = 1, NEW ORIGIN = 2);
MOVE SET ( ID = 2, OLD ORIGIN = 1, NEW ORIGIN = 2);
}
WAIT FOR EVENT(ORIGIN=1, CONFIRMED=ALL...)

(I haven't actually tested the above but I think it will work in cases 
were both sets are on the same origin).


>
> The reason I ask is we're currently using 2.0.7 and when we move a bunch
> of sets between nodes it'd be ideal if they were all locked before they
> were moved.
>
> Sorry if I've got the wrong end of the stick here, or this has already
> been answered somewhere, I did do a good search before posting!
>
> Thanks
> Glyn
>
>
>
>
>
>
> _______________________________________________
> Slony1-general mailing list
> Slony1-general at lists.slony.info
> http://lists.slony.info/mailman/listinfo/slony1-general
>



More information about the Slony1-general mailing list