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.Jackson@eu.citrix.com>
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 \