Christopher Browne cbbrowne
Mon Jul 17 09:27:04 PDT 2006
Csaba Nagy wrote:
>> This is still probably *somewhat* susceptible to race conditions, but
>> it seems to be a "safening action" to me...
>>     
>
> Wouldn't it be feasible to use a form of "LOCK ... NOWAIT" to lock first
> the truncated tables in the proper mode, and then only truncate if the
> lock succeeded, otherwise issue the warning ? That would probably
> eliminate the race condition. 
>
> OTOH this would only work for postgres 8.x and newer.
>
>   
That would do the trick for newer version, alas, it's not much help for 7.4.

I'm not sure it's needful to go to the NOWAIT extreme on this; the
conflict conditions would be where you're either doing pg_dump or vacuum
on the whole database, where it's a big DB; the chances of hitting a
race condition given the attempt to check locks should be minimal. 
Trying to avoid locking may be good enough...



More information about the Slony1-general mailing list