fix(lockservice): bound remote wait-for snapshot retries#25999
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? |
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
No findings. The timeout cleanly bounds the previously infinite remote snapshot retry chain, preserves earlier cancellation, releases detector workers and active-check state, and allows periodic rechecks. Focused tests passed 20 runs and 10 race-enabled runs; CI is green.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed exact head 097dba6. No blocking findings. The per-lock-key deadline preserves earlier caller/shutdown cancellation, bounds the GetTxnLock + bind-refresh + backoff retry chain, releases detector workers and activeCheckTxn state on timeout, and leaves periodic rechecks intact without imposing a cumulative traversal deadline. Independently passed focused tests (20 runs), focused race tests (10 runs), full pkg/lockservice tests with and without -race, pkg/util/status tests, go vet, and go build.
Merge Queue Status
This pull request spent 40 minutes 10 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. Tick the box to put this pull request back in the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #25870
What this PR does / why we need it:
#25901 made remote wait-for snapshot retries context-aware, so caller cancellation and detector shutdown now propagate correctly. However, deadlock-detector checks run with a service-lifetime context. While the service remains live, a permanently unavailable remote lock-table owner can still keep
remoteLockTable.getLockretrying forever and occupy one of the four detector workers indefinitely.This PR adds a 35-second deadline to one remote lock-key snapshot lookup. The bound covers a failed
GetTxnLockRPC, bind refresh, retry backoff, and another RPC attempt. It deliberately does not bound an entire transaction snapshot or wait-for graph traversal: healthy checks may need to scan many lock keys and transactions, and a cumulative deadline would repeatedly restart the traversal and could permanently miss a deeper deadlock edge.On timeout, the existing error path unwinds the deadlock check, removes the transaction from
activeCheckTxn, and returns the worker to the detector queue. Caller deadlines and detector shutdown cancellation still take precedence over the internal bound.The regression test fills all four detector workers with blocked remote snapshot lookups, verifies that they return with
context.DeadlineExceeded, confirmsactiveCheckTxncleanup, and proves that a fifth queued check is processed without invoking the deadlock-abort callback.Validation:
-count=50-count=10pkg/lockservicetest suitepkg/lockservicerace suitego build ./pkg/lockservicego vet ./pkg/lockservicepkg/util/statustests