In the deadlock case, we need to ROLLBACK.  In other error cases we
are going to close the connection.  And in those other cases the
ROLLBACK might fail, causing our error recovery to go wrong.

So do ROLLBACK only on the single path where we might continue to use
the connection.

Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com>
---
 tcl/JobDB-Executive.tcl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tcl/JobDB-Executive.tcl b/tcl/JobDB-Executive.tcl
index c0cd4e9..535fbd7 100644
--- a/tcl/JobDB-Executive.tcl
+++ b/tcl/JobDB-Executive.tcl
@@ -320,10 +320,10 @@ proc transaction {tables script} {
        set ec $errorCode
        db-close
        if {$rc} {
-           db-execute ROLLBACK
            switch -glob $errorCode {
                {OSSTEST-PSQL * 40P01} {
                    # DEADLOCK DETECTED
+                   db-execute ROLLBACK
                    logputs stdout "transaction deadlock ($result) retrying ..."
                    if {[incr retries -1] <= 0} {
                        error \
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to