Skip to content

fix(directory): stabilize rolling upgrade handoff test - #10341

Merged
ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:reubenbond-fix-grain-directory-regression
Aug 5, 2026
Merged

ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:reubenbond-fix-grain-directory-regression

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

The restart-in-place rolling upgrade test required a non-empty split-partition handoff even though its small grain set and randomized ring topology can legitimately produce only empty handoffs.

Move the mandatory non-empty durability assertion to the higher-load local-to-distributed upgrade scenario, where split handoffs are intentionally exercised. The restart-in-place scenario continues to verify that recipient completion precedes sender removal whenever a non-empty handoff occurs.

After final convergence, validate the complete live activation set: reject duplicate activations for a grain, require every activation to exactly match its directory registration, verify every directory entry belongs to the correct partition, and surface integrity violations in release builds. These checks are non-mutating so recovery cannot hide missing registrations.

Move mandatory non-empty handoff coverage to the higher-load rolling upgrade scenario while preserving ordering checks in the restart-in-place scenario.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f6f95cf2-6bf9-4ee4-9a93-a9e9c1acebb9
Copilot AI review requested due to automatic review settings August 4, 2026 23:47

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

Stabilizes Grain Directory rolling-upgrade tests by making the “non-empty split-partition handoff occurred” expectation conditional, so scenarios which can legitimately produce empty handoffs are no longer forced to fail. This keeps the durability/ordering validation while relocating the strict “must have exercised a handoff” requirement to the higher-load local-to-distributed upgrade test.

Changes:

  • Added phase-aware log capture to the local-to-distributed rolling upgrade test and asserted that it exercises a non-empty split-partition handoff.
  • Updated the restart-in-place rolling upgrade scenario to allow empty handoffs while still validating correct completion-before-removal ordering when handoffs occur.
  • Extended AssertSplitPartitionHandoffsAreDurable with a requireNonEmptyHandoff switch to support both behaviors.
Show a summary per file
File Description
test/Orleans.GrainDirectory.Tests/GrainDirectory/GrainDirectoryRollingUpgradeTests.cs Makes split-partition handoff assertions conditional and relocates the “must be non-empty” requirement to the local-to-distributed scenario using phase-aware log capture.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

Validate final directory ownership and registration state without recovery, fail release tests on integrity violations, and reject duplicate live activations.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: f6f95cf2-6bf9-4ee4-9a93-a9e9c1acebb9
Copilot AI review requested due to automatic review settings August 5, 2026 00:07

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's findings

Suppressed comments (3)

src/Orleans.Runtime/GrainDirectory/GrainDirectoryPartition.cs:873

  • Similar to the other invariant exception, this message would be more actionable if it identified the partition/view/range which received an out-of-range registration (especially since this is thrown from a system target and may be surfaced remotely).
                    if (!IsOwner(current, entry.GrainId))
                    {
                        throw new InvalidOperationException(
                            $"Invariant violated. This host was sent a registration for grain '{entry.GrainId}' which it should not own.");
                    }

test/Orleans.GrainDirectory.Tests/GrainDirectory/GrainDirectoryRollingUpgradeTests.cs:1087

  • The comment above this integrity check still refers to invoking recovery, but the code now only performs non-mutating validation (ValidateObservedAddressesAsync + CheckIntegrityAsync). Updating the comment will prevent confusion about whether recovery is still happening here.
        var integrityChecks = distributedPartitions
            .Select(static partition => partition.CheckIntegrityAsync().AsTask())
            .ToArray();

src/Orleans.Runtime/GrainDirectory/GrainDirectoryPartition.cs:859

  • This exception is now thrown in release builds, but the message does not include which partition/range/view detected the problem. Including the partition identity and membership version will make failures much easier to diagnose from test logs.

This issue also appears on line 869 of the same file.

            {
                if (!range.Contains(entry.Key))
                {
                    throw new InvalidOperationException($"Invariant violated. This host is not the owner of grain '{entry.Key}'.");
                }
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new

@ReubenBond
ReubenBond merged commit d8e3224 into dotnet:main Aug 5, 2026
66 of 67 checks passed
@ReubenBond
ReubenBond deleted the reubenbond-fix-grain-directory-regression branch August 5, 2026 00:29
This was referenced Aug 28, 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