Skip to content

feat(streaming): add reusable checkpoint state machine - #11154

Merged
ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:rb-refactor-streaming-checkpoint-core
Sep 10, 2026
Merged

ReubenBond merged 1 commit into
dotnet:mainfrom
ReubenBond:rb-refactor-streaming-checkpoint-core

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Sep 5, 2026 •

Copy link
Copy Markdown
Member

Problem

Checkpoint throttling, coalescing, retry, monotonicity, and optimistic-conflict handling are embedded in the Grain-backed implementation, so custom queue adapters cannot reuse those guarantees with their own durable checkpoint store.

This extracts the checkpoint-focused first wave from #11076 and reconciles overlapping code with the newer #10588 foundation.

Solution

  • Add IStreamCheckpointStore, StreamCheckpointStoreState, StreamQueueCheckpointer, and StreamQueueCheckpointerOptions as the reusable checkpoint core.
  • Delegate GrainStreamQueueCheckpointer to the reusable state machine while preserving its public facade and storage-provider behavior.
  • Cover cancellation, flush retry, update coalescing, monotonic checkpoints, numeric boundaries, and optimistic version conflicts with focused contract tests.
  • Regenerate the Orleans.Streaming public API and document how custom queue adapters compose a durable checkpoint store with the reusable checkpointer.

Rationale

Separating persistence from checkpoint coordination gives custom adapters one implementation of the state-machine guarantees while keeping the existing Grain adapter as an immediate production consumer. Provider migrations, replay, pooled cache, pulling-agent, and receiver changes remain independent follow-ups.

Related #756

Microsoft Reviewers: Open in CodeFlow

Copilot AI lite review requested due to automatic review settings September 5, 2026 15:39

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 review overview

🔵 Needs a closer look

It introduces new public API surface and a concurrency-sensitive checkpoint state machine whose correctness is critical to recovery behavior and warrants final human validation.

Review tier: Lite
Findings: None

What changed in this PR

This PR extracts a reusable, provider-agnostic checkpoint coordination core for Orleans streaming, so custom queue adapters can reuse checkpoint coalescing/throttling/flush and optimistic-conflict handling without depending on the grain-backed implementation.

Changes:

  • Introduces a reusable checkpoint persistence abstraction (IStreamCheckpointStore) and state representation (StreamCheckpointStoreState), plus the StreamQueueCheckpointer state machine and StreamQueueCheckpointerOptions.
  • Refactors GrainStreamQueueCheckpointer to delegate checkpoint coordination to the new reusable StreamQueueCheckpointer while preserving the grain-backed storage facade.
  • Adds focused contract tests for numeric boundary behavior and optimistic conflict/retry behavior; updates custom adapter docs and regenerates the Orleans.Streaming public API surface.
File Description
test/​Orleans.Streaming.Tests/​Checkpointers/​StreamQueueCheckpointerTests.cs Extends shared contract tests to validate numeric-boundary progression scenarios.
test/​Orleans.Streaming.Tests/​Checkpointers/​ReusableStreamQueueCheckpointerTests.cs Adds contract tests specific to the reusable checkpointer, including version-conflict retry and retry-after-failed-write behavior.
src/​Orleans.Streaming/​Checkpointers/​StreamQueueCheckpointerOptions.cs Adds public options for persist throttling interval and optional monotonic comparer.
src/​Orleans.Streaming/​Checkpointers/​StreamQueueCheckpointer.cs Adds the reusable checkpoint coordination state machine (coalescing, throttling, flush, conflict handling).
src/​Orleans.Streaming/​Checkpointers/​StreamCheckpointStoreState.cs Adds the public state container for checkpoint + backend version/etag.
src/​Orleans.Streaming/​Checkpointers/​IStreamCheckpointStore.cs Adds the reusable persistence abstraction for conditional checkpoint updates.
src/​Orleans.Streaming/​Checkpointers/​GrainStreamQueueCheckpointer.cs Refactors to use the reusable state machine via an adapter over the existing grain API.
src/​api/​Orleans.Streaming/​Orleans.Streaming.cs Regenerated public API to include the new types.
docs/​site/​src/​content/​docs/​streaming/​custom-queue-adapter.md Documents composing a durable custom checkpoint store with the reusable checkpointer.

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

@ReubenBond
ReubenBond merged commit bfef5e6 into dotnet:main Sep 10, 2026
71 checks passed
@ReubenBond
ReubenBond deleted the rb-refactor-streaming-checkpoint-core branch September 10, 2026 00:28
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 10, 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