From: Ian Campbell <ian.campbell@citrix.com>
To: Ian Jackson <ian.jackson@eu.citrix.com>, xen-devel@lists.xenproject.org
Subject: Re: [OSSTEST PATCH 3/4] Database locking: Tcl: Cover LOCK TABLEs with catch
Date: Tue, 15 Dec 2015 16:34:49 +0000 [thread overview]
Message-ID: <1450197289.16856.203.camel@citrix.com> (raw)
In-Reply-To: <1450196786-27361-3-git-send-email-ian.jackson@eu.citrix.com>
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@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-12-15 16:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-15 16:26 [OSSTEST PATCH 1/4] Database locking: Perl: Retry all deadlocks in PostgreSQL Ian Jackson
2015-12-15 16:26 ` [OSSTEST PATCH 2/4] Database locking: Perl: Increase retry count Ian Jackson
2015-12-15 16:33 ` Ian Campbell
2015-12-15 16:26 ` [OSSTEST PATCH 3/4] Database locking: Tcl: Cover LOCK TABLEs with catch Ian Jackson
2015-12-15 16:34 ` Ian Campbell [this message]
2015-12-15 16:26 ` [OSSTEST PATCH 4/4] Database locking: Tcl: Limit number of retries Ian Jackson
2015-12-15 16:35 ` Ian Campbell
2015-12-15 16:33 ` [OSSTEST PATCH 1/4] Database locking: Perl: Retry all deadlocks in PostgreSQL Ian Campbell
2015-12-15 16:41 ` Ian Jackson
2015-12-15 16:47 ` Ian Campbell
2015-12-15 17:01 ` Ian Jackson
2015-12-15 17:20 ` Ian Jackson
2015-12-16 1:39 ` Robert Hu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1450197289.16856.203.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.