We are going to want to reorganise this.  As prep work, break the $dbh
state checking (and the corresponding comment) into a separate sub.

No functional changel.

(There is still an anomaly: need_retry passes it $dbh_tests, not the
$dbh it got from the caller.  This will go away shortly.)

Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com>
---
 Osstest/JobDB/Executive.pm | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/Osstest/JobDB/Executive.pm b/Osstest/JobDB/Executive.pm
index ebafb4c..5f2aac9 100644
--- a/Osstest/JobDB/Executive.pm
+++ b/Osstest/JobDB/Executive.pm
@@ -58,11 +58,11 @@ sub begin_work ($$$) { #method
     }
 }
 
-sub need_retry ($$$) {
-    my ($jd, $dbh,$committing) = @_; # implicitly, $@ is an argument too
+sub _need_retry ($) {
+    my ($dbh) = @_;
     return
-       ($dbh_tests->err() // 0)==7 &&
-       ($dbh_tests->state =~ m/^(?:40P01|40001|23|40002)/);
+       ($dbh->err() // 0)==7 &&
+       ($dbh->state =~ m/^(?:40P01|40001|23|40002)/);
     # DEADLOCK DETECTED or SERIALIZATION FAILURE
     # or any Integrity Constraint Violation including
     # TRANSACTION_INTEGRITY_CONSTRAINT_VIOLATION.
@@ -109,6 +109,11 @@ sub need_retry ($$$) {
     # 
https://www.postgresql.org/message-id/flat/D960CB61B694CF459DCFB4B0128514C203937E44%40exadv11.host.magwien.gv.at
 }
 
+sub need_retry ($$$) {
+    my ($jd, $dbh,$committing) = @_; # implicitly, $@ is an argument too
+    return _need_retry($dbh_tests);
+}
+
 sub readonly_report ($$) { #method
     my ($jd, $dbh) = @_;
     
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to