Repository navigation
fix(lockservice): preserve GET_LOCK session liveness - #28820
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.
GPT-6 medium deep review at head 8f826c3449b305ab043550ca5383cb5ad4ae92ae: no verified correctness, concurrency, liveness, or resource-lifecycle blocker found.
I traced registration before Lock through acquisition failure, successful unlock, failed/canceled unlock, and detached retry. Liveness remains registered until terminal unlock succeeds. Probe attempts use distinct transaction IDs consistently through Lock, cleanup keys, and Unlock. CheckActiveTxn, GetActiveTxn fallback, and local orphan recovery consult the registry; Register/Close admission is serialized. The added tests cover two-service remote-holder orphan recovery and registration cleanup.
Validation is separate from this code review: shared build passed, while Ubuntu UT, SCA, UT coverage, and multi-CN BVT are still pending; skipped jobs are not counted as passes.
XuPeng-SH
left a comment
There was a problem hiding this comment.
GPT-6 medium deep review at head ae6bbd336c0c1abbb49b955b5683d2a39a80670e: no verified correctness, concurrency, liveness, or resource-lifecycle blocker found.
I reviewed the full eight-file diff. Registration admission is serialized with service close; GET_LOCK and probe liveness remains registered until unlock succeeds, with failed/canceled cleanup retaining bounded ownership; probe IDs are carried consistently through lock, cleanup, and unlock; and orphan/timeout recovery checks the registry while preserving the existing transaction and unknown-commit paths. Session close follows the existing synchronous release and bounded retry handoff. The migration entry rejects sessions that still hold user locks. The added service and SQL tests cover remote-holder orphan recovery, successful/failed cleanup, registration retention, and probe uniqueness. Compared with the previously reviewed head 8f826c3449b305ab043550ca5383cb5ad4ae92ae, the current diff only removes a seven-line unused test helper; production behavior is unchanged.
Validation is separate from the code conclusion: shared build, SCA, and UT coverage pass. Ubuntu UT and PROXY/PESSIMISTIC multi-CN BVT are still pending, so this is not a claim that CI is complete. The author reports a focused race run, but I could not independently verify the full named selection and terminal output in this review.
XuPeng-SH
left a comment
There was a problem hiding this comment.
GPT-6 medium deep review at current head 414e131e5856533b15c0628f8b2602cdfbc6a75b: no verified correctness, concurrency, liveness, or resource-lifecycle blocker found.
I re-reviewed the full eight-file PR diff from merge-base 288a0a2b0f07189216630f7c9eea89c384b4f708. The merge commit brings in unrelated bitwise-error changes from main; I checked the affected files and found no GET_LOCK or lockservice interaction. Registration remains tied to the session lock lifecycle: it is added before acquisition, removed only after successful unlock, and failed/canceled cleanup keeps an owner. Probe transaction IDs remain consistent across Lock, cleanup, and Unlock. Service close serializes registration admission and clears the registry; orphan recovery and existing transaction/unknown-commit checks remain consistent.
Exact-head CI run 34757601519 completed successfully, including SCA, Ubuntu UT, coverage, shared build, and PROXY/PESSIMISTIC multi-CN BVT. UT job 103724608444 reports the lockservice package passing in 116.62s, TestRemoteSessionLockIsNotUnlockedAsOrphan passing in 0.16s, and both TestExternalTxnLiveness* tests passing in 0.08s each. Skipped jobs are not counted as passes.
) Fixes matrixorigin#28808. ## Root cause GET_LOCK creates synthetic lock-service txn IDs for SQL session-level locks. Those IDs are intentionally absent from Config.TxnIterFunc, which tracks frontend transactions. When another CN waits on the same lock, CheckActiveTxn therefore reports the live holder inactive; after the allocator confirms it is not committing, orphan recovery fences and unlocks it. The waiter then acquires the lock before the requested timeout. ## Fix - Add an optional external transaction liveness registry and consult it in CheckActiveTxn, the legacy GetActiveTxn fallback, and local orphan/timeout recovery. - Register GET_LOCK and RELEASE_LOCK/IS_FREE_LOCK probe IDs before Lock; retain registration across failed cleanup and unregister only after successful Unlock. - Give every probe attempt a unique txn ID and carry that exact ID through cleanup, so delayed cleanup cannot affect a later probe. - Add a deterministic dual-LockService regression test for the live remote-holder path. ## Validation - go test ./pkg/lockservice -count=1 - go test ./pkg/sql/plan/function -count=1 - Focused -race tests for the dual-service orphan check and SQL liveness/cleanup paths. The full SQL BVT was not run locally because the Docker daemon is unavailable; CI should run it on this PR.
) Fixes matrixorigin#28808. ## Root cause GET_LOCK creates synthetic lock-service txn IDs for SQL session-level locks. Those IDs are intentionally absent from Config.TxnIterFunc, which tracks frontend transactions. When another CN waits on the same lock, CheckActiveTxn therefore reports the live holder inactive; after the allocator confirms it is not committing, orphan recovery fences and unlocks it. The waiter then acquires the lock before the requested timeout. ## Fix - Add an optional external transaction liveness registry and consult it in CheckActiveTxn, the legacy GetActiveTxn fallback, and local orphan/timeout recovery. - Register GET_LOCK and RELEASE_LOCK/IS_FREE_LOCK probe IDs before Lock; retain registration across failed cleanup and unregister only after successful Unlock. - Give every probe attempt a unique txn ID and carry that exact ID through cleanup, so delayed cleanup cannot affect a later probe. - Add a deterministic dual-LockService regression test for the live remote-holder path. ## Validation - go test ./pkg/lockservice -count=1 - go test ./pkg/sql/plan/function -count=1 - Focused -race tests for the dual-service orphan check and SQL liveness/cleanup paths. The full SQL BVT was not run locally because the Docker daemon is unavailable; CI should run it on this PR.
) Fixes matrixorigin#28808. ## Root cause GET_LOCK creates synthetic lock-service txn IDs for SQL session-level locks. Those IDs are intentionally absent from Config.TxnIterFunc, which tracks frontend transactions. When another CN waits on the same lock, CheckActiveTxn therefore reports the live holder inactive; after the allocator confirms it is not committing, orphan recovery fences and unlocks it. The waiter then acquires the lock before the requested timeout. ## Fix - Add an optional external transaction liveness registry and consult it in CheckActiveTxn, the legacy GetActiveTxn fallback, and local orphan/timeout recovery. - Register GET_LOCK and RELEASE_LOCK/IS_FREE_LOCK probe IDs before Lock; retain registration across failed cleanup and unregister only after successful Unlock. - Give every probe attempt a unique txn ID and carry that exact ID through cleanup, so delayed cleanup cannot affect a later probe. - Add a deterministic dual-LockService regression test for the live remote-holder path. ## Validation - go test ./pkg/lockservice -count=1 - go test ./pkg/sql/plan/function -count=1 - Focused -race tests for the dual-service orphan check and SQL liveness/cleanup paths. The full SQL BVT was not run locally because the Docker daemon is unavailable; CI should run it on this PR.
Fixes #28808.
Root cause
GET_LOCK creates synthetic lock-service txn IDs for SQL session-level locks. Those IDs are intentionally absent from Config.TxnIterFunc, which tracks frontend transactions. When another CN waits on the same lock, CheckActiveTxn therefore reports the live holder inactive; after the allocator confirms it is not committing, orphan recovery fences and unlocks it. The waiter then acquires the lock before the requested timeout.
Fix
Validation
The full SQL BVT was not run locally because the Docker daemon is unavailable; CI should run it on this PR.