Re: [PR] fix(store-client): bound DEADLINE_EXCEEDED retries to one per call and honour thread interrupts in NodeTxExecutor [hugegraph]
codecov[bot] commented on PR #3204: URL: https://github.com/apache/hugegraph/pull/3204#issuecomment-5674182946 ## [Codecov](https://app.codecov.io/gh/apache/hugegraph/pull/3204?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report :white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 93.25%. Comparing base ([`60c8803`](https://app.codecov.io/gh/apache/hugegraph/commit/60c8803d5a85943eaa05e74eb37fe7d57b2256a0?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`5ffb221`](https://app.codecov.io/gh/apache/hugegraph/commit/5ffb221c6972059f71fc6eb035fec6d8de070ef5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)). Additional details and impacted files ```diff @@ Coverage Diff @@ ## master#3204 +/- ## = + Coverage 37.86% 93.25% +55.39% + Complexity 6586 65 -6521 = Files 8009 -791 Lines 68985 267-68718 Branches 9172 22 -9150 = - Hits 26120 249-25871 + Misses397968-39788 + Partials 3069 10 -3059 ``` [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/hugegraph/pull/3204?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache). :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache). :rocket: New features to boost your workflow: - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [PR] fix(store-client): bound DEADLINE_EXCEEDED retries to one per call and honour thread interrupts in NodeTxExecutor [hugegraph]
SebastianGruza commented on code in PR #3204:
URL: https://github.com/apache/hugegraph/pull/3204#discussion_r4005149480
##
hugegraph-store/hg-store-client/src/main/java/org/apache/hugegraph/store/client/NodeTxExecutor.java:
##
@@ -373,35 +391,75 @@ boolean ifAnyTrue(Supplier>> nodeStreamSuppl
}
Optional retryingInvoke(Supplier supplier) {
+boolean[] deadlineRetried = {false};
return IntStream.rangeClosed(0, NODE_MAX_RETRYING_TIMES).boxed()
.map(
i -> {
+if
(Thread.currentThread().isInterrupted()) {
+// The caller (e.g. a REST worker
hitting
+// restserver.request_timeout) gave
up: stop
+// retrying instead of holding its
thread.
+// InterruptedException as the root
cause: the
+// server's task cancel path
recognises it
+// (HugeException.isInterrupted()).
+throw HgStoreClientException.of(
+"Interrupted before retry " +
i,
+new InterruptedException());
+}
T buffer = null;
try {
buffer = supplier.get();
} catch (Throwable t) {
-if (i + 1 <= NODE_MAX_RETRYING_TIMES) {
-try {
-int sleepTime;
-// The first three times try
once every second
-if (i < 3) {
-sleepTime = 1;
-} else {
-// Subsequent incremental
-sleepTime = i - 1;
-}
-log.info("Waiting {} seconds "
+
- "for the next try.",
- sleepTime);
-Thread.sleep(sleepTime *
1000L);
-} catch (InterruptedException e) {
-log.error("Failed to sleep",
e);
+Failure failure = classify(t);
+if (failure != Failure.DEADLINE) {
+// a different failure in between
means the
+// next deadline is not "in a row"
again
+deadlineRetried[0] = false;
Review Comment:
Agreed, the reset reopened the long wait through D, X, D, X. Done in 5ffb221
— the budget is a per-call counter now: the second `DEADLINE_EXCEEDED` ends the
call whatever failed in between, so one call blocks on at most two deadlines.
`testDeadlineBudgetResetsAfterAnotherFailure` became
`testSecondDeadlineFailsEvenWithAnotherFailureInBetween` (D, UNAVAILABLE, D →
three attempts, then the deadline is thrown); the `Failure` javadoc and the PR
description say "at most once per call" instead of "in a row". Title changed to
"bound DEADLINE_EXCEEDED retries to one per call" as you suggested.
`NodeTxExecutorTest` 11/11 on JDK 17.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
-
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
