Skip to content

fix(directory): deactivate recovery duplicates - #11030

Merged
ReubenBond merged 3 commits into
dotnet:mainfrom
ReubenBond:rb-fix-10998-rolling-upgrade-duplicates
Sep 3, 2026
Merged

ReubenBond merged 3 commits into
dotnet:mainfrom
ReubenBond:rb-fix-10998-rolling-upgrade-duplicates

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Sep 3, 2026 •

Copy link
Copy Markdown
Member

Distributed grain-directory recovery can observe multiple live activations for one grain during the final rolling-upgrade transition. Recovery selected the registration from the newest membership view, but the losing activation remained valid after directory membership and range ownership converged.

This change records registrations which lose recovery selection and marks each exact losing activation deactivating before the recovered range is exposed. Cleanup is identity-safe, bounded into message-sized batches, preserves the newest observation of a repeated activation identity, and removes any activation which later becomes the final winner from the cleanup set. Full teardown and identity-conditional deregistration continue after the activation becomes unroutable, so recovery does not hold the range lock across grain deactivation callbacks.

This makes directory convergence include activation uniqueness while preserving normal deactivation and legacy-directory cleanup behavior.

Fixes #10998

Microsoft Reviewers: Open in CodeFlow

Copilot AI lite review requested due to automatic review settings September 3, 2026 10:11

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.

Copilot review overview

🔵 Needs a closer look

It changes distributed directory recovery and activation lifecycle behavior in the runtime, which warrants final human validation for correctness under rolling-upgrade/convergence scenarios.

Review tier: Lite
Findings: None

What changed in this PR

This PR addresses a rolling-upgrade recovery edge case in the distributed grain directory where multiple live activations for a single grain can remain visible after convergence, by tracking “losing” recovery observations and proactively deactivating the exact losing activation(s) before exposing the recovered directory range.

Changes:

  • Update recovery entry selection to return the “losing” registration (when a duplicate is detected) while still preserving the newest membership-view winner.
  • During partition-range recovery, collect duplicates, remove any that later become the winner, and deactivate remaining duplicates in bounded batches before completing recovery.
  • Adjust ICatalog.DeleteActivations implementation to deactivate only the exact activation address (identity-safe) and return immediately after making the loser unroutable; add/expand unit tests for the new recovery/cleanup behavior.
File Description
test/​Orleans.GrainDirectory.Tests/​GrainDirectory/​GrainDirectoryPartitionTests.cs Expands recovery tests to assert duplicate reporting, winner re-observation handling, and membership-version refresh for same activation identity.
src/​Orleans.Runtime/​GrainDirectory/​GrainDirectoryPartition.cs Tracks recovery duplicates, removes re-observed winners from cleanup, and deactivates remaining duplicate activations in batches before exposing recovered ranges.
src/​Orleans.Runtime/​Catalog/​Catalog.cs Makes duplicate cleanup identity-safe by deactivating only when the local activation address matches exactly, and returns without awaiting full teardown.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage

Metric Pull request Current main Variance
Lines 81.88% (106,426 / 129,980) 81.91% (106,420 / 129,922) -0.0319 pp
Branches 71.00% (30,392 / 42,808) 70.97% (30,359 / 42,780) +0.0307 pp

Report-only conclusion: mixed.

The current-main baseline is commit 4d301ee0e8 and uses the same reviewed coverage matrix.

Coverage combines every CI test matrix job, including providers, CodeGen, .NET 8/10, Linux, Windows, and macOS, using canonical physical source and branch identities.

The comparison remains report-only while normal line and branch variance is calibrated.

Coverage details

Copilot AI review requested due to automatic review settings September 3, 2026 18:38

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.

Copilot review overview

🔵 Needs a closer look

It changes core directory recovery and activation deactivation semantics in a way that can affect rolling-upgrade convergence behavior across silos, warranting final human validation.

Review tier: Lite
Findings: None

Copilot AI review requested due to automatic review settings September 3, 2026 18:54
@ReubenBond
ReubenBond force-pushed the rb-fix-10998-rolling-upgrade-duplicates branch from a51ff17 to c133649 Compare September 3, 2026 18:54

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.

Copilot review overview

🔵 Needs a closer look

It changes distributed recovery behavior and activation deactivation semantics in a way that’s correctness-critical under rolling-upgrade conditions and warrants final human review.

Review tier: Lite
Findings: None

@ReubenBond
ReubenBond merged commit ce4d9a6 into dotnet:main Sep 3, 2026
139 of 141 checks passed
@ReubenBond
ReubenBond deleted the rb-fix-10998-rolling-upgrade-duplicates branch September 3, 2026 20:29
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 4, 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.

Flaky rolling-upgrade test reports duplicate activations after convergence

2 participants