feat(streaming): add grain-backed stream checkpointer - #10345
Open
ReubenBond wants to merge 1 commit into
Open
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3f5060d4-b229-476c-bdf3-9923ad459bb2
Contributor
There was a problem hiding this comment.
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.Numericand 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 on lines
+198
to
+200
| await inProgressSave.WaitAsync(cancellationToken); | ||
|
|
||
| lock (_lock) |
Comment on lines
+12
to
+15
| [PreferLocalPlacement] | ||
| [GrainType("streamcheckpointergrain")] | ||
| public class StreamCheckpointerGrainGrain : Grain, IStreamCheckpointerGrain | ||
| { |
Comment on lines
+1
to
+5
| using Microsoft.Extensions.DependencyInjection; | ||
| using Microsoft.Extensions.Options; | ||
| using Orleans.Configuration; | ||
| using System; | ||
| using System.Threading.Tasks; |
Comment on lines
+162
to
+164
| context.GrainId.Returns(GrainId.Create( | ||
| "streamcheckpointergrain", | ||
| GrainStreamQueueCheckpointer.GetGrainKey( |
Comment on lines
+28
to
+30
| internal interface IConfiguredStreamCheckpointerGrain : IStreamCheckpointerGrain | ||
| { | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split from #8967.
Adds a provider-independent stream checkpointer backed by Orleans grain storage. Persistence interval, grain storage provider, and checkpoint ordering are configurable, with deterministic contract coverage for persistence, flushing, cancellation, failures, and monotonic updates.
Event Hubs can opt into the grain-backed checkpointer while Azure Table Storage remains the default. This unblocks the Kinesis provider in #8967.