Repository navigation
Record locks: drain by recall so a membership change is not a ~6 minute lock outage #861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kriszyp
merged 7 commits into
feat/record-lock-cluster-transport
from
kris/856-drain-by-recall
Sep 17, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
65afd02
Drain on stage, so a membership change need not wait out the lease
kriszyp 1a0f53a
Drain on the coordinating thread, outside the transition queue
kriszyp fd32822
Expose the one predicate an orchestrator may skip the interval on
kriszyp 0f6d0f2
Pin core at the ownership-based quiescence proof
kriszyp 6490ef8
Pin core at the ownership-only quiescence proof
kriszyp 231b7b0
Pin core at the retired-coordinator reporting fix
kriszyp de3f39a
Check every field of a drain reply positively
kriszyp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule core
updated
2 files
| +203 −0 | resources/recordLockCoordinator.ts | |
| +199 −0 | unitTests/resources/recordLockCoordinator.test.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing test:
quiesceOnOwner's cross-thread relay path — the actual "drain by recall" mechanism this PR adds — has no coverage at all.quiesceOnOwneris the new public entry point this PR wires in as the drain reader (recordLockTransport.ts:setHomesDrainReader((database, deadlineMs) => quiesceOnOwner(database, deadlineMs));). It has two branches that matter: answering locally whenownership.ownsDatabase(database), and relaying to the owner worker via the new'quiesce'RelayKindotherwise (with fail-closed handling when the relay times out, there's no owner, or the reply isn't a proper{ outstanding: [...] }shape).The only tests added in this PR (
unitTests/replication/recordLockHomes.test.mjs) exercisestageGeneration/drainForStage/provesQuiescenceentirely throughsetHomesDrainReader(mock), which replacesquiesceOnOwnerwholesale — none of them callquiesceOnOwneritself.unitTests/replication/recordLockRpc.test.mjsdoesn't exist, andintegrationTests/cluster/recordLockCluster.test.mjs(unchanged by this PR) has no reference toquiesce/outstanding/provesQuiescenceanywhere.So the code that this PR's own title is about — reaching the actual coordinating worker for a database during a membership change, across the new
'quiesce'relay hop — is exercised by nothing: not the happy path (relay reaches the owner and gets a realQuiesceResult), not "no owner yet," not a relay timeout, not a malformed reply. Given the sibling functionprovesQuiescenceneeded a follow-up fix in this same PR for a shape it didn't handle correctly, this relay path (relay()/executeLocally()/routeFromMain()forkind: 'quiesce') is exactly the kind of new branch that benefits from a direct test — e.g. a unit test with two fake worker "threads" (mirroring the existingrecordLockTransport.test.mjsstyle) verifyingquiesceOnOwnerreturns the owner's real result when relayed, and throws the fail-closed 503 when the relay times out or no owner is registered.