If the transaction fails, we have called db-close by the time we
discover it's for retry, so the dbh may be closed (depending whether
we have a persistent dbh).
So run ROLLBACK only if dbopen indicates that the db connection is
still open.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
proc transaction {tables script {autoreconnect 0}} {
global errorInfo errorCode
+ variable dbopen
set retries 100
while 1 {
set ol {}
{OSSTEST-PSQL * 40P01} -
{OSSTEST-PSQL * 40001} {
# DEADLOCK DETECTED or SERIALIZATION FAILURE
- db-execute ROLLBACK
+ if {$dbopen} { db-execute ROLLBACK }
logputs stdout "transaction deadlock ($result) retrying ..."
if {[incr retries -1] <= 0} {
error \