Fix activity retry scheduled timestamps in the test server - #3078
Open
sangkyoonnam wants to merge 1 commit into
Open
sangkyoonnam wants to merge 1 commit into
sangkyoonnam wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
StateMachines#attemptActivityRetrynow sets the retry attempt'scurrent_attempt_scheduled_timeto the current time plus the backoff interval, instead of the failure time.ActivityRetryScheduledTimeTestcovering the scheduled timestamps of retry attempts on the test server. It is skipped against an external server, where the retries take over a minute of wall time.Why?
The test server already scheduled the retry timer correctly after the backoff, but stamped the attempt's scheduled time with the failure time. The retries ran at the right time, while
ActivityInfo#getCurrentAttemptScheduledTimestampreported the first retry as scheduled immediately (approximately 0, 0, 10, 30 seconds relative to the first attempt, instead of 0, 10, 30, 70 seconds). The real server sets the scheduled time to the next attempt time after the backoff, and the Nexus operation retry path in the same file already does this.lastAttemptCompleteTimeremains the failure completion time; only the next attempt's scheduled timestamp includes the backoff.Checklist
Closes TestWorkflowEnvironment schedules the first activity retry immediately #1069
How was this tested:
New
ActivityRetryScheduledTimeTestrecordsgetCurrentAttemptScheduledTimestamp()for four attempts with a 10s initial interval and 2.0 backoff coefficient, and asserts each gap is within [backoff - 1s, backoff + 5s]. Run with./gradlew :temporal-sdk:test --tests "io.temporal.workflow.activityTests.ActivityRetryScheduledTimeTest". The regression test fails with the implementation change reverted (attempt 2 scheduled PT0.01S after previous, expected between PT9S and PT15S) and passes with the fix.Any docs updates needed?
No.