From 77b3fecf9425ceeb8e6c5e7323aa3e9e7dd775a2 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 1 Jul 2016 12:23:12 +0100 Subject: [PATCH] tcl daemons: transaction: Only try ROLLBACK when necessary 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 --- 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 ab6760a..45fdb18 100644 --- a/tcl/JobDB-Executive.tcl +++ b/tcl/JobDB-Executive.tcl @@ -321,10 +321,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.39.5