Skip to content

Use membership versions for stale directory cleanup#10087

Merged
ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:split/pr10085-02-stale-version-cleanup
May 12, 2026
Merged

Use membership versions for stale directory cleanup#10087
ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:split/pr10085-02-stale-version-cleanup

Conversation

@ReubenBond

@ReubenBond ReubenBond commented May 12, 2026

Copy link
Copy Markdown
Member

Part 2 of 7 split from #10085.

Problem:
Directory cleanup could remove registrations for silos which are absent from the current snapshot even when the registration was observed at the same or a newer membership version.

Solution:
Use the registration membership version to distinguish stale unknown-silo entries from entries which may be newer than the applied membership snapshot.

Stack:
Merge after #10086. This branch is stacked on split/pr10085-01-membership-reconcile; until #10086 merges, GitHub may show earlier stack changes in this PR. Incremental compare: ReubenBond/orleans@split/pr10085-01-membership-reconcile...split/pr10085-02-stale-version-cleanup

Review focus:
The stale-entry predicate for unknown silos and the point where LocalGrainDirectory removes directory/cache entries.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Orleans runtime grain directory’s cleanup logic to use cluster membership snapshots/versions when deciding whether directory/cache entries are stale, aiming to avoid removing registrations for “unknown” silos when those registrations may be newer than the applied membership view.

Changes:

  • Switched LocalGrainDirectory membership handling from silo-status events to consuming IClusterMembershipService snapshots and applying updates on the directory scheduler.
  • Updated local directory/cache cleanup to use a membership-version-aware predicate for entries whose silo is missing from the current snapshot.
  • Simplified/adjusted directory handoff operation scheduling and moved directory-owner deactivation logic out of Catalog into LocalGrainDirectory.
Show a summary per file
File Description
test/Orleans.Core.Tests/Directory/CachedGrainLocatorTests.cs Updates test setup to provide a cluster membership service when constructing LocalGrainDirectory.
src/Orleans.Runtime/GrainDirectory/LocalGrainDirectory.cs Processes membership snapshots, updates membership ring, and uses membership versions when deciding if unknown-silo entries are stale.
src/Orleans.Runtime/GrainDirectory/GrainDirectoryHandoffManager.cs Adds additional successor validation, filters accepted registrations, and changes pending-operation scheduling behavior.
src/Orleans.Runtime/Catalog/Catalog.cs Removes silo-status-change handling which has been moved into LocalGrainDirectory.

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 4

Comment thread src/Orleans.Runtime/GrainDirectory/LocalGrainDirectory.cs Outdated
Comment thread src/Orleans.Runtime/GrainDirectory/LocalGrainDirectory.cs
Comment thread src/Orleans.Runtime/GrainDirectory/GrainDirectoryHandoffManager.cs
Comment thread src/Orleans.Runtime/GrainDirectory/GrainDirectoryHandoffManager.cs Outdated
@ReubenBond ReubenBond force-pushed the split/pr10085-02-stale-version-cleanup branch from 737161c to 8d7d37d Compare May 12, 2026 14:25
ReubenBond and others added 2 commits May 12, 2026 09:33
Evict LocalGrainDirectory directory and cache entries for terminating silos immediately, and only evict unknown-silo entries when the address was registered before the applied membership snapshot.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ReubenBond ReubenBond force-pushed the split/pr10085-02-stale-version-cleanup branch from 8d7d37d to a8ef248 Compare May 12, 2026 16:47
@ReubenBond ReubenBond enabled auto-merge May 12, 2026 16:53
@ReubenBond ReubenBond added this pull request to the merge queue May 12, 2026
Merged via the queue into dotnet:main with commit deba6a7 May 12, 2026
62 checks passed
@ReubenBond ReubenBond deleted the split/pr10085-02-stale-version-cleanup branch May 12, 2026 17:48
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants