Skip to content

test(directory): assert rolling upgrade invariants by phase - #10705

Merged
ReubenBond merged 5 commits into
dotnet:mainfrom
ReubenBond:rb-fix-rolling-upgrade-integrity
Aug 20, 2026
Merged

ReubenBond merged 5 commits into
dotnet:mainfrom
ReubenBond:rb-fix-rolling-upgrade-integrity

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Aug 20, 2026

Copy link
Copy Markdown
Member

During a mixed LocalGrainDirectory/DistributedGrainDirectory rolling upgrade, compatibility recovery can expose one older local activation alongside one newer distributed activation. This cross-membership transition state converges when the legacy host exits; exact registration uniqueness and partition integrity are steady-state guarantees after every host uses DistributedGrainDirectory and directory views converge.

Make the rolling-upgrade validation phase-aware. Mixed checkpoints require conflicts to contain exactly one older LocalGrainDirectory activation and one newer DistributedGrainDirectory activation, while bounded tracked grains continue to prove fresh authoritative lookup and traffic progress. Homogeneous checkpoints require unique activations and fresh matching registrations, and the fully distributed phase also validates partition ownership and complete directory integrity.

Fixes #10519

Microsoft Reviewers: Open in CodeFlow

Deactivate registrations which lose distributed directory recovery after the recovered range unlocks, and serialize conditional cleanup with activation registration.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 20, 2026 08:57

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 addresses a distributed grain directory recovery edge case during rolling upgrades where multiple valid activations for a single grain can be recovered, ensuring that only the deterministically selected “winner” remains active and that integrity validation does not fail due to stale-but-valid losing activations.

Changes:

  • Track all recovered activation candidates during range recovery, compute which recovered activations are duplicates (non-winners), and retire those duplicates.
  • Gate integrity checking on completion of any in-flight recovery cleanup so validation doesn’t race deactivation.
  • Add conditional deactivation logic in the catalog/activation lifecycle so deletes only deactivate an activation when its address (and membership version) matches, including during Creating/Activating states.
Show a summary per file
File Description
test/Orleans.GrainDirectory.Tests/GrainDirectory/GrainDirectoryPartitionTests.cs Extends recovery-ordering test to assert duplicate detection behavior.
src/Orleans.Runtime/GrainDirectory/GrainDirectoryPartition.cs Returns duplicates from recovery, kicks off post-recovery cleanup, and makes integrity checks await cleanup completion.
src/Orleans.Runtime/Catalog/Catalog.cs Makes DeleteActivations conditional on the target activation address (and membership version) matching the current context.
src/Orleans.Runtime/Catalog/ActivationData.cs Adds an address-matching deactivation operation that runs through the activation’s serialized operation queue when needed.

Review details

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

  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/Orleans.Runtime/GrainDirectory/GrainDirectoryPartition.cs Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 20, 2026 09:32

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.

Review details

  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/Orleans.Runtime/Catalog/ActivationData.cs Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 20, 2026 10:13

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.

Review details

  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Treat cross-version Local/Distributed activation conflicts as a bounded mixed-mode state while retaining strict registration and ownership checks after convergence.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 20, 2026 15:52
@ReubenBond ReubenBond changed the title fix(directory): retire recovery duplicates test(directory): assert rolling upgrade invariants by phase Aug 20, 2026

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.

Review details

  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

Keep the bounded-grain checkpoint message separate from phase-specific activation and partition validation output.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 20, 2026 16:30

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.

Review details

  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@ReubenBond
ReubenBond merged commit 6673ff0 into dotnet:main Aug 20, 2026
196 of 201 checks passed
@ReubenBond
ReubenBond deleted the rb-fix-rolling-upgrade-integrity branch August 20, 2026 17:50
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 20, 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 test: rolling upgrade restart reports a directory integrity violation

2 participants