From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: [OSSTEST PATCH 7/9] db retry: Break out Osstest::Executive::JobDB::_need_retry
Date: Tue, 20 Dec 2016 18:38:00 +0000 [thread overview]
Message-ID: <1482259082-30767-8-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1482259082-30767-1-git-send-email-ian.jackson@eu.citrix.com>
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.Jackson@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
next prev parent reply other threads:[~2016-12-20 18:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-20 18:37 [OSSTEST PATCH 0/9] db retry: fixes and workarounds Ian Jackson
2016-12-20 18:37 ` [OSSTEST PATCH 1/9] mg-schema-test-database: Revamp sequence handling Ian Jackson
2016-12-20 18:37 ` [OSSTEST PATCH 2/9] mg-schema-test-database: Wrap some withtest psql_do in subshells Ian Jackson
2016-12-20 18:37 ` [OSSTEST PATCH 3/9] cs-bisection-step: Do not acquire the repo lock Ian Jackson
2016-12-20 18:37 ` [OSSTEST PATCH 4/9] db retry, bisection: Reset %jobs_created on db retry Ian Jackson
2016-12-20 18:37 ` [OSSTEST PATCH 5/9] db retry, bisect: Cache build reuse investigations Ian Jackson
2016-12-20 18:37 ` [OSSTEST PATCH 6/9] db retry: Document $@ as an implicit parameter to need_retry Ian Jackson
2016-12-20 18:38 ` Ian Jackson [this message]
2016-12-20 18:38 ` [OSSTEST PATCH 8/9] db retry: Use HandleError and exceptions to detect when to retry Ian Jackson
2016-12-20 18:38 ` [OSSTEST PATCH 9/9] db retry: Retry on $dbh->state eq '' Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1482259082-30767-8-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).