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.jack...@eu.citrix.com>
Acked-by: Ian Campbell <ian.campb...@citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel