Repository navigation
fix(runtime): align consistent ring routing with unsigned ranges - #11599
Conversation
Use unsigned silo hash positions for member ordering, local boundaries, and primary-owner lookup. Signed and unsigned ordering differ only by a rotation, preserving published cyclic ranges during rolling upgrades.
There was a problem hiding this comment.
🟢 Approval recommended
The localized correction preserves existing ranges and has focused regression coverage, with no unresolved issues identified.
No open issues 🎉
What changed in this PR
Fixes non-virtual consistent-ring routing by using unsigned silo hashes consistently, aligning key lookup with published ownership ranges while preserving cyclic range boundaries.
Changes:
- Aligns member ordering, range calculations, and owner lookup with unsigned hash positions.
- Adds the exact regression case and deterministic and randomized coverage for boundaries, membership changes, shutdown exclusion, and legacy range preservation.
Test execution and automated coverage results were not available for this assessment.
| File | Description |
|---|---|
| test/Orleans.Runtime.Internal.Tests/LivenessTests/ConsistentRingProviderTests.cs | Adds routing, ownership, compatibility, and shutdown regression tests. |
| src/Orleans.Runtime/ConsistentRing/ConsistentRingProvider.cs | Uses unsigned hashes consistently for ring ordering, ranges, and lookup. |
Review effort: Balanced
Code coverage
Report-only conclusion: current-main baseline stale. The newest successful coverage run tested d1f2a16, not current main 1ea0875. 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 |
Fixes #11584.
Use unsigned silo hash positions consistently for non-virtual ring ordering, local ranges, and primary-owner lookup. This routes keys to their published owner across negative hashes, the sign boundary, and wraparound.
The affected provider is selected with
ConsistentRingOptions.UseVirtualBucketsConsistentRing = false. Default-configured clusters useVirtualBucketsRingProvider, which already uses unsigned lookup. The defective comparison and the virtual-bucket default are both present in the initial public source import on January 22, 2015.Adds the issue's exact reproduction, deterministic negative/positive/mixed rings with membership changes and endpoint-adjacent keys, shutdown exclusion coverage, and a bounded CsCheck property verifying lookup/ownership agreement and preservation of the legacy ranges.
Rolling upgrades and impact
Signed and unsigned sorting differ only by a rotation, so cyclic predecessors and published ranges remain identical for the same membership and insertion order. Range formats, stored data, public APIs, and hash bits remain unchanged. The default virtual-bucket provider retains its behavior.
Old callers retain the lookup defect until upgraded; upgraded callers select the existing range owner. Reminders use the shared reminder table as authority and reconcile stale-target writes on the next successful refresh (default period: five minutes). A misrouted registration can miss early occurrences before the owner loads the row; schedule updates can take effect late, and unregistering can leave additional ticks until reconciliation. The next scheduled occurrence is selected when a row is loaded, rather than replaying elapsed ticks. This behavior is also present in released v10.4.0.
Consistent-ring stream queue balancing uses the preserved ranges, keeping its allocations stable for identical membership. Custom grain services which kept authoritative state at the formerly misrouted target require application-specific rollout handling.
The full consumer, historical, and patch-release compatibility assessment is preserved as artifact #1 on #11584. Backport for 10.4.1: #11598.
Microsoft Reviewers: Open in CodeFlow