Skip to content

feat(streaming): add grain-backed stream checkpointer - #10345

Merged
ReubenBond merged 5 commits into
dotnet:mainfrom
ReubenBond:feat/grain-stream-checkpointer
Aug 7, 2026
Merged

ReubenBond merged 5 commits into
dotnet:mainfrom
ReubenBond:feat/grain-stream-checkpointer

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Aug 6, 2026

Copy link
Copy Markdown
Member

Split from #8967.

Adds a provider-independent stream queue checkpointer backed by Orleans grain storage and configured through ISiloPersistentStreamConfigurator, allowing any persistent stream provider to use it.

The implementation supports per-stream-provider grain storage selection, validates that the selected keyed storage provider is registered, and uses collision-safe identities across services, stream providers, partitions, and storage providers. Checkpoint updates use compare-and-swap semantics to prevent stale writers from regressing persisted offsets.

Event Hubs can opt into the grain-backed checkpointer with numeric checkpoint ordering while retaining its existing Azure Table Storage checkpointer as the default. This also unblocks the Kinesis provider in #8967.

Follow-up: #10355 generalizes the Azure Table checkpointer and is based on this PR's head commit.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3f5060d4-b229-476c-bdf3-9923ad459bb2

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 introduces a provider-independent, grain-storage-backed stream queue checkpointer to Orleans.Streaming, adds a reusable checkpoint comparer (numeric ordering for arbitrary-sized offsets), and wires the new checkpointer into Event Hubs as an opt-in alternative to the existing Azure Table checkpointer. It also adds deterministic contract tests to validate persistence, throttling, flushing, cancellation, failure propagation, and monotonic update behaviors.

Changes:

  • Add GrainStreamQueueCheckpointer (+ factory/options) and supporting grains/state for persisting checkpoints via Orleans grain storage.
  • Add StreamCheckpointComparers.Numeric and tests to ensure safe numeric ordering for Event Hubs-style offsets.
  • Add configuration extensions + docs/tests so Event Hubs providers can opt into the grain-based checkpointer while preserving existing defaults.
Show a summary per file
File Description
test/Orleans.Streaming.Tests/Checkpointers/StreamQueueCheckpointerTests.cs Adds deterministic contract tests for IStreamQueueCheckpointer<string> implementations.
test/Orleans.Streaming.Tests/Checkpointers/StreamCheckpointComparersTests.cs Adds unit tests for the new numeric checkpoint comparer behavior.
test/Orleans.Streaming.Tests/Checkpointers/GrainStreamQueueCheckpointerTests.cs Adds tests for grain-backed checkpointer behavior and grain/state integration.
test/Extensions/Orleans.Streaming.EventHubs.Tests/CheckpointerTests/EventHubCheckpointerTests.cs Updates EventHub checkpointer tests and adds ordering/no-advance coverage.
test/Extensions/Orleans.Streaming.EventHubs.Tests/CheckpointerTests/EventHubCheckpointerConfigurationTests.cs Adds DI/hosting tests for selecting grain vs Azure Table checkpointers.
src/Orleans.Streaming/QueueBalancer/PersistentStreamConfiguratorExtension.cs Adds UseGrainCheckpointer extension on ISiloPersistentStreamConfigurator.
src/Orleans.Streaming/Checkpointers/StreamCheckpointerGrainState.cs Introduces persisted grain state model for checkpoints.
src/Orleans.Streaming/Checkpointers/StreamCheckpointerGrain.cs Adds grain implementations to read/write checkpoints via grain storage.
src/Orleans.Streaming/Checkpointers/StreamCheckpointComparers.cs Introduces common checkpoint comparer(s), including numeric ordering.
src/Orleans.Streaming/Checkpointers/IStreamCheckpointerGrain.cs Introduces grain interface for checkpoint persistence (and configured variant).
src/Orleans.Streaming/Checkpointers/GrainStreamQueueCheckpointerOptions.cs Adds options for persistence interval, storage provider selection, and ordering.
src/Orleans.Streaming/Checkpointers/GrainStreamQueueCheckpointerFactory.cs Adds factory for creating grain-backed checkpointers per partition.
src/Orleans.Streaming/Checkpointers/GrainStreamQueueCheckpointer.cs Implements grain-backed checkpointing with throttling/flush semantics.
src/Azure/Orleans.Streaming.EventHubs/README.md Documents opting into grain storage for Event Hubs checkpoints.
src/Azure/Orleans.Streaming.EventHubs/Providers/Streams/EventHub/EventHubStreamBuilder.cs Adds UseGrainCheckpointer for Event Hubs stream configurator (defaults numeric ordering).
src/api/Orleans.Streaming/Orleans.Streaming.cs Updates public API surface for new checkpointer/grain types/options/comparers/extensions.
src/api/Azure/Orleans.Streaming.EventHubs/Orleans.Streaming.EventHubs.cs Updates Event Hubs public API surface to include UseGrainCheckpointer.

Copilot's findings

  • Files reviewed: 17/17 changed files
  • Comments generated: 5

Comment thread src/Orleans.Streaming/Checkpointers/GrainStreamQueueCheckpointer.cs Outdated
Comment thread src/Orleans.Streaming/Checkpointers/StreamCheckpointGrain.cs
Comment thread src/Orleans.Streaming/Checkpointers/GrainStreamQueueCheckpointerFactory.cs Outdated
Comment thread src/Orleans.Streaming/Checkpointers/IStreamCheckpointerGrain.cs
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 74f81769-0c5e-4132-82f2-6f421750f500
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 74f81769-0c5e-4132-82f2-6f421750f500
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 577cd3e5-ccfb-44f2-98d5-b1953c4b8cd6
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 74f81769-0c5e-4132-82f2-6f421750f500
@ReubenBond
ReubenBond merged commit f2c317e into dotnet:main Aug 7, 2026
67 checks passed
@ReubenBond
ReubenBond deleted the feat/grain-stream-checkpointer branch August 7, 2026 22:54
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