fix: add backoff to retry loops - #24653
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? |
There was a problem hiding this comment.
Pull request overview
Adds capped exponential backoff to three previously busy-spin retry loops: remote lock table unlock/getLock and txn service parallelSendWithRetry. The parallelSendWithRetry path is also made context-aware so cancellation exits promptly. Targeted unit tests cover the backoff doubling/cap and cancellation behavior. As noted in the PR description, the lockop budget=0 change from #24107 is intentionally not reapplied because main already classifies ErrLockTableBindChanged as a bounded retry error.
Changes:
- Add exponential backoff (100ms → 5s) to
remoteLockTable.unlockandgetLockretry loops, preserving the no-error unlock contract. - Add context-aware exponential backoff (100ms → 1s) to
service.parallelSendWithRetry, returning nil promptly on ctx cancel. - Add unit tests for backoff doubling/cap, get-lock retry path, and cancellation-during-backoff behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/lockservice/lock_table_remote.go | Adds package-level backoff knobs and helpers; inserts sleep+next-backoff into the unlock and getLock retry loops. |
| pkg/lockservice/lock_table_remote_test.go | New tests verifying nextRemoteRetryBackoff doubling/cap and a successful retry path for getLock after an RPC timeout. |
| pkg/txn/service/service.go | Adds context-aware backoff wait and next-backoff helpers; applies them to parallelSendWithRetry send failures; resets backoff after a successful send. |
| pkg/txn/service/service_test.go | Adds a stub retryTestSender and tests that parallelSendWithRetry exits during backoff on cancel and returns nil when ctx is already canceled. |
Merge Queue Status
This pull request spent 1 hour 3 minutes 31 seconds in the queue, including 1 hour 2 minutes 22 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #24654
What this PR does / why we need it:
This ports the still-needed retry-loop fixes from the closed PR #24107 to current main.
The lockop budget=0 change from #24107 is intentionally not reapplied because current main already treats ErrLockTableBindChanged as a bounded retry error.
Tests:
Note: the lockservice test was run outside the sandbox because it needs to bind unix sockets.