Skip to content

feat: draining members and the index of their destinations - #62

Merged
marcopiraccini merged 3 commits into
mainfrom
feat/draining-members
Nov 14, 2026
Merged

marcopiraccini merged 3 commits into
mainfrom
feat/draining-members

Conversation

@marcopiraccini

@marcopiraccini marcopiraccini commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Two additions for pods which stop gracefully, both needed by Lavoratore to move the Durable Objects of a Watt instance away before it stops.

Draining: member.setDraining(true) sets a draining field in the record of the pod, which the heartbeats keep and which goes with the record when it expires or the pod deregisters. pickMember skips draining pods, and the resolve script refuses to bind or to reassign a destination to one, atomically with the binding: a pod picked from a list read before it started draining is refused, and the registry picks another. The destinations a draining pod holds keep resolving to it. listLiveMembers() and listPeerLoad() report the flag.

Member index: with memberIndex: true on the Registry and the Member, every binding also records the destination in the set of the pod, <keyPrefix>:owned:<memberId>, in the same script or transaction, and the unbinding removes it: claims, reassignments, the pruning of dead pods, addPodToDestination, deregisterDestination and the destination methods of Member. registry.listOwned(memberId) and member.listOwned() read it, so that the destinations of a pod are listed without a scan. The option is off by default; the README says that every writer must maintain it and that the sets of existing destinations need a backfill.

Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
@marcopiraccini marcopiraccini changed the title feat: refuse to bind destinations to draining members feat: draining members and the index of their destinations Nov 14, 2026
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@marcopiraccini
marcopiraccini merged commit eaed5f0 into main Nov 14, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants