Repository navigation
fix: evict idle lock routes after CN scale-down - #30269
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? |
631780c to
79239a8
Compare
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 6368e84d6f90875b639527c71fbd6444f70ebc4e
Assessment: approve
Reviewed the complete 13-file delta and affected callers. The design appropriately reuses the keeper, exact binding references and existing synchronization. Idle eviction preserves admitted transactions and replacement generations. The prior cleanup defect is resolved: TN-confirmed retirement no longer depends on replacement-owner discovery. No actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
Validation:
-
Full lockservice race suite passed: 664 root tests, no failures or skips.
-
Fifteen affected concurrency tests each passed 100 repetitions under race, including both Unlock APIs, discovery failures, delayed publication and replacement preservation.
-
The real three-CN-to-one-CN regression passed: after membership convergence and TN retirement, the first DROP DATABASE succeeded without client retry; fixture cleanup completed.
-
Stable keeper benchmarks across 0, 10,000 and 100,000 cached routes measured 224.6–300.3 ns/round, 272 bytes and four allocations. Cached Lock/Unlock tests confirmed unchanged GetBind counts.
-
Verified native provenance, clean frozen source, commands, exit receipts and retained logs. Evidence is recorded in /home/xupeng/.local/state/mo-bot/jobs/55fed108a890a67baec030ff/attempt-1/validation-audit.json; the final audit also passed.
Limitations:
-
Membership changes still require a full route scan and proportional candidate storage; only eviction attempts are capped at 64 per round. The benchmark measures stable keeper work with mock inventory, not SQL throughput or membership-change latency.
-
Integration covers controlled scale-down, not every network-partition scenario. The standalone linked-issue body and raw author validation logs were not supplied; author claims were not counted as verified execution.
iamlinjunhong
left a comment
There was a problem hiding this comment.
Reviewed head 6368e84d6f90875b639527c71fbd6444f70ebc4e against supplied main base e8b3ed7f21c2b1966d74814adaa2bcd96d8c129f, including all 13 changed files, transaction admission/reference accounting, remote Unlock, allocator-state fencing, route publication, proxy cleanup, and keeper paths. No current actionable findings; APPROVE.
The previous blocking cleanup finding is resolved. handleBindChangedFromAllocator no longer performs replacement-owner discovery. After accepting changed TN binding evidence, an unpublishable replacement causes exact old-binding fencing and detachment, returns successful cleanup, and closes the retired table after releasing service locks. An already-published or newer concurrent route is preserved. The added regression exercises ordinary and context-bounded Unlock with an unreachable old owner and absent/failed replacement discovery; it also checks other old consumers, retained-reference release, and replacement-consumer preservation.
Reviewed the idle-eviction and publication tests, including reference preservation during in-flight Lock, bounded eviction, generation checks, stale discovery confirmations, brief join/leave, and the embedded scale-down SQL case. Membership absence only governs idle routing hints; accepted TN evidence remains the authority for retiring active generations.
Validation: git diff --check passed; the local full patch matches the supplied GitHub patch apart from index-hash abbreviation. A temporary extracted-source harness exercised the actual current idle-route functions and allocator-change handler with dependency stubs: cleanup, rejection/cancellation, batching/generation preservation, and confirmation/snapshot behavior passed 100 repetitions under -race. Substituting the previous-head handler made both missing-owner and discovery-error cleanup controls fail as expected. This is control-flow validation, not a native lockservice package or live-cluster run; the added native tests and SQL regression were inspected but not rerun. Source files remain unchanged and the sparse checkout was not expanded.
The supplied exact-head CI snapshot has 28 completed checks: 12 successful, 14 skipped, and 2 neutral, with no failures. GitHub reports mergeable, with the branch behind main. Prior reviews, review-thread comments, and PR conversation were inspected; no explicit author reply is present in the supplied history. Approval follows resolution of the previous blocking finding and absence of current findings.
Merge Queue Status
This pull request spent 2 hours 58 minutes 3 seconds in the queue, with no time running CI. ReasonPull request #30269 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Waiting for any of
All conditions
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 #29447
What this PR does / why we need it:
After a controlled CN scale-down, idle remote lock-table routes could remain cached indefinitely because remote-lock heartbeats only cover bindings referenced by active transactions. The first
DROP DATABASEcould then contact a retired owner and fail with 20702 even after TN had completed retirement.The existing remote keeper now reconciles idle routes with the local raw CN inventory and evicts exact bindings only after their transaction references reach zero. Membership removal triggers a cache scan; eviction is limited to 64 attempts per keeper round. Membership remains a routing hint, while TN remains authoritative for binding validity and active transactions retain their existing recovery behavior.
Cold publication confirms owners missing from the keeper snapshot against current discovery, using the existing on-demand refresh only on an address miss. Confirmation runs outside service locks and is checked against the same immutable snapshot before publication. A coalesced scan request also covers owners that join and leave between keeper rounds. Cached
Lock/Unlockadds no RPC or discovery lookup.Accepted TN binding changes retire the exact old generation independently of replacement-owner discovery. If the replacement cannot be published, cleanup still completes and the missing route remains cold for the normal GetBind path. A concurrently published replacement and its transaction consumers are preserved. This prevents Unlock from retrying an owner TN has already superseded.
Validation:
-vet=all, and the full package under-race, both with-short.-race. The new cleanup regression covers an unreachable old owner and absent/failed replacement discovery through both ordinary and context-bounded Unlock, plus exact-generation fencing and preservation of concurrently published routes.DROP DATABASEsucceeds without a client retry.Membership changes can still trigger one full route-cache scan.