Repository navigation
Conversation
(cherry picked from commit e88f5e4)
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? |
LeftHandCold
left a comment
There was a problem hiding this comment.
Reviewed exact head a4f693ccfbbba3f218579eb150fee32f7429fa47. No blocking findings. The cleanup-only/confirmed state transitions are closed: failed remote responses remain conservatively unlockable but are excluded from wait-for edges; successful retries promote those rows; later failures do not downgrade confirmed holders; individual lock removal, table cleanup, and transaction reuse remove the auxiliary state. The deadlock scan snapshots both lock rows and uncertainty under the transaction read lock, and the newer 4.2-dev base changes do not overlap lockservice. This patch also matches the already approved and merged upstream fix in #26925. LGTM.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Approved exact head a4f693c. This backport has the same stable patch-id as the previously reviewed and merged upstream fix e88f5e4. The 4.2 branch differences around the affected state machine do not alter the cleanup-only/confirmed lock invariants: uncertain rows remain unlockable but are excluded from wait-for edges, successful retries promote them, later failures do not downgrade confirmed holders, and lock/table/transaction cleanup removes the auxiliary state.
What type of PR is this?
Which issue(s) this PR fixes:
Related to #27124.
Backport of #26925, which fixes #26922.
What this PR does / why we need it:
Root cause
When a remote Lock response is lost, canceled, or times out, the source CN must retain the requested rows so transaction close can conservatively send Unlock. In 4.2-dev those cleanup records are stored in
activeTxn.tableKeys, and distributed deadlock detection also treats every entry in that collection as proof that the transaction holds the row.If the request is still waiting on the owner, the owner returns that same transaction as a waiter and the polluted wait-for graph produces a false
T <= Tself-cycle. This exact sequence is present in #27124: a failed remote lock withcontext canceledis followed by a self-cycle and user-visible20701.Fix
tableKeysso conservative remote cleanup remains unchanged.fetchWhoWaitingMe.This does not suppress genuine multi-transaction deadlocks. It removes only deadlock edges that are not backed by a confirmed lock. Normal successful Lock calls do not allocate the sparse state.
Validation
TestRemoteWaitingListRequiresConfirmedHolder: passed; race-count=100passed.TestCleanupOnlyLockStateTransitions: passed; race-count=100passed.TestLockRemoteWithContextTimeoutTracksLockForUnlock: passed; race-count=100passed.go build ./pkg/lockservice: passed.go vet ./pkg/lockservice: passed.go test ./pkg/lockservice: passed.go test -race ./pkg/lockservice: passed.Cherry-picked from
e88f5e4a706f28590f6dd69076cd38981eceaaa9.