Skip to contentSkip to conversation

Executive database: Handle 40001 "SERIALIZATION FAILURE" too

PATCH New Ian Jackson 1 participant 1 message Dec 2, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Executive database: Handle 40001 "SERIALIZATION FAILURE" too

This can happen if the locks are removed, which we are about to do.

---
 Osstest/JobDB/Executive.pm | 3 ++-
 tcl/JobDB-Executive.tcl    | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)
Osstest/JobDB/Executive.pm +2 -1
index 557cee1..c3fd449 100644
@@ -54,7 +54,8 @@ sub need_retry ($$$) {
     my ($jd, $dbh,$committing) = @_;
     return
 	($dbh_tests->err() // 0)==7 &&
-	($dbh_tests->state =~ m/^40P01/); # DEADLOCK DETECTED
+	($dbh_tests->state =~ m/^(?:40P01|40001)/);
+    # DEADLOCK DETECTED or SERIALIZATION FAILURE
 }
 
 sub current_flight ($) { #method
tcl/JobDB-Executive.tcl +3 -2
index 6225bd9..6eb43f6 100644
@@ -382,8 +382,9 @@ proc transaction {tables script {autoreconnect 0}} {
 	db-close
 	if {$rc} {
 	    switch -glob $errorCode {
-		{OSSTEST-PSQL * 40P01} {
-		    # DEADLOCK DETECTED
+		{OSSTEST-PSQL * 40P01} -
+		{OSSTEST-PSQL * 40001} {
+		    # DEADLOCK DETECTED or SERIALIZATION FAILURE
 		    db-execute ROLLBACK
 		    logputs stdout "transaction deadlock ($result) retrying ..."
 		    if {[incr retries -1] <= 0} {
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel