diff mbox

[OSSTEST,9/9] db retry: Retry on $dbh->state eq ''

Message ID 1482259082-30767-10-git-send-email-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ian Jackson Dec. 20, 2016, 6:38 p.m. UTC
This is supposed to represent success.  But now that _need_retry is
only called within a HandleError hook, we know there has been a
failure.

Retry such failures, in the hope that they are stochastic.  If they
aren't, we will fail eventually when we run out of retries.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 Osstest/JobDB/Executive.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/Osstest/JobDB/Executive.pm b/Osstest/JobDB/Executive.pm
index 5545849..83e19e4 100644
--- a/Osstest/JobDB/Executive.pm
+++ b/Osstest/JobDB/Executive.pm
@@ -62,11 +62,14 @@  sub _need_retry ($) {
     my ($dbh) = @_;
     return
 	($dbh->err() // 0)==7 &&
-	($dbh->state =~ m/^(?:40P01|40001|23|40002)/);
+	($dbh->state =~ m/^(?:40P01|40001|23|40002|$)/);
     # DEADLOCK DETECTED or SERIALIZATION FAILURE
     # or any Integrity Constraint Violation including
     # TRANSACTION_INTEGRITY_CONSTRAINT_VIOLATION.
     #
+    # Or the empty string, which it seems that we sometimes get on
+    # serialisation errors.
+    #
     # An Integrity Constraint Violation ought not to occur with
     # serialisable transactions, so it is aways a bug.  These bugs
     # should not be retried.  However, there is a longstanding bug in