[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [OSSTEST PATCH 3/4] Database locking: Tcl: Cover LOCK TABLEs with catch

On Tue, 2015-12-15 at 16:26 +0000, Ian Jackson wrote:
> Previously we would retry only the body, but not LOCK TABLEs.
> We got away with it before because of the heavyweight locking of even
> long-running read-only transactions, but now the LOCK TABLEs can fail
> (at least in a mixed-version system, and perhaps even in a system with
> only new code).
> Additionally, if one of the LOCK TABLEs fails, the code's use of the
> db handle becomes stuck because of the failed transaction: the error
> is caught by the daemon's main loop error handler, but the db handle
> is not subjected to ROLLBACK and all future attempts to use it will
> fail.
> So: move the LOCK TABLEs (and the SET TRANSACTION) into the catch, so
> that deadlocks in LOCK TABLEs are retried (after ROLLBACK).
> The COMMIT remains outside the eval but this should be unaffected by
> DB deadlocks if the LOCK TABLEs are right.
> Note that this code does not attempt to distinguish DB deadlock errors
> from other errors.ÂÂArguably this is quite wrong.ÂÂFixing it to
> distinguish deadlocks is awkward because pg_execute does not leave the
> error information anywhere it can be found.ÂÂContrary to what the
> documentation seems to imply, it does not set errorCode (!)
> Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>

Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.