Repository navigation
test(logservice): make the HAKeeper allocate-retry cancellation test deterministic - #31800
Closed
MatrixAdventurer wants to merge 1 commit into
Closed
MatrixAdventurer wants to merge 1 commit into
MatrixAdventurer wants to merge 1 commit into
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Contributor
|
will fixed by @XuPeng-SH |
This branch had an error being deployed
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 type of PR is this?
Which issue(s) this PR fixes:
Fixes #31789
Summary
TestAllocateBatchIDRetriesPrepareClientErrorUntilContextDonegave the whole call a 55 ms deadline with a 20 ms retry interval and required at least 2 discovery attempts. A scheduler pause after the first attempt (CPU throttling in CI) used up the deadline, so the product correctly returnedDeadlineExceededafter 1 attempt and the attempt-count assertion failed.Test-only change (
hakeeper_client_test.go, no production code):retries until canceled: discovery keeps failing withnet.ErrClosed; the stub cancels the caller context during the 3rd attempt (1-minute safety timeout). Assertscontext.Canceledand exactly 3 attempts, so the retry count comes from the stub, not from wall-clock time.stops at deadline: a 20 ms caller deadline still ends the loop withcontext.DeadlineExceeded; onlyattempts >= 1is asserted.Product retry and cancellation behavior is unchanged.
Evidence
Same SIGSTOP injection as in the issue (race test binary,
GOMAXPROCS=1, pause 100 ms, 5 ms after=== RUN):"1" is not greater than or equal to "2", line 1888)go test -race -tags matrixone_test -short -run TestAllocateBatchIDRetries ./pkg/logservicepasses;TestAllocate*with-count=50underGOMAXPROCS=1passes.Merge Danger
None for production; one test function rewritten.