Repository navigation
feat(streaming): replay retained stream history - #11076
ReubenBond wants to merge 74 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Several new/updated StreamSequenceToken types declare Orleans serialization field ids which overlap with their base type’s ids, which can break generated serialization and persisted token compatibility.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Lite
Findings: 3
New issues introduced by this change (3)
| Severity | Finding |
|---|---|
src/AWS/Orleans.Streaming.Kinesis/Streams/KinesisSequenceToken.cs — KinesisSequenceToken declares additional Orleans-serialized members using [Id(0..2)], which… |
|
src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamSequenceToken.cs — AdoNetStreamSequenceToken uses [Id(0..2)] for its own members even though it inherits… |
|
src/Orleans.Streaming/Common/PartitionedStreamSequenceToken.cs — The [Id] values on PartitionedStreamSequenceToken overlap with the base EventSequenceTokenV2 field… |
What changed in this PR
This PR extends Orleans persistent streaming to support replaying retained stream history when a subscription start token falls outside the live in-memory cache, enabling a gap-free handoff from historical replay to live delivery. It introduces provider-neutral replay abstractions plus provider-specific implementations for Kinesis and the ADO.NET partitioned stream provider, along with updated docs and expanded conformance tests around token identity, ordering, and checkpoint/retention behavior.
Changes:
- Add a provider-neutral async replay cursor model and supporting streaming/cache primitives (cursor progress, adapter-aware comparisons, pooled-cache purge behavior).
- Implement retained-history replay support for Kinesis and update ADO.NET streaming to a partitioned, retention/lease-based replay model (plus new checkpoint store contracts).
- Update documentation and add/adjust unit/provider tests to cover new token semantics, checkpoint contracts, eviction behavior, and replay expectations.
| File | Description |
|---|---|
| test/Orleans.Streaming.Tests/StreamingTests/PubSubRendezvousGrainTests.cs | Adds coverage for subscription-unregistered diagnostics emitted after state is cleared. |
| test/Orleans.Streaming.Tests/StreamingTests/ClientStreamTestRunner.cs | Adjusts dropped-client test flow to optionally assert delivery failure counts without forcing a default counter. |
| test/Orleans.Streaming.Tests/OrleansRuntime/Streams/PooledCacheBufferOwnershipTests.cs | New tests validating pooled buffer behavior after purge-to-empty scenarios. |
| test/Orleans.Streaming.Tests/OrleansRuntime/Streams/EncodedOffsetPooledQueueCacheTests.cs | New tests for adapter-aware cached-message searches using encoded offsets. |
| test/Orleans.Streaming.Tests/OrleansRuntime/Streams/CachedMessageBlockTests.cs | Adds tests ensuring cache blocks clear payload references on remove/reset. |
| test/Orleans.Streaming.Tests/JsonConverters/StreamingJsonConverterTests.cs | Adds JSON round-trip coverage for partitioned stream sequence tokens. |
| test/Orleans.Streaming.Tests/Checkpointers/StreamQueueCheckpointerTests.cs | Adds numeric-boundary checkpoint persistence coverage. |
| test/Orleans.Streaming.Tests/Checkpointers/ReusableStreamQueueCheckpointerTests.cs | New tests for conditional checkpoint conflicts and retry semantics with versioned stores. |
| test/Extensions/Orleans.Streaming.Kinesis.Tests/KinesisBatchContainerTests.cs | Expands Kinesis batch/token tests (event index, ordering, legacy payload shape, recoverable adapter behavior). |
| test/Extensions/Orleans.Streaming.Kinesis.Tests/KinesisAdapterTests.cs | Adjusts Kinesis adapter test to validate cache cursor behavior using first observed tokens. |
| test/Extensions/Orleans.Streaming.Kinesis.Tests/DynamoDBStreamQueueCheckpointerTests.cs | Updates DynamoDB checkpointer tests for versioned checkpoint-store state. |
| test/Extensions/Orleans.Streaming.EventHubs.Tests/EvictionStrategyTests/EHPurgeLogicTests.cs | Updates expectations for purge behavior when caches become empty. |
| test/Extensions/Orleans.Streaming.EventHubs.Tests/EventHubSequenceTokenTests.cs | New tests covering Event Hub token cross-version symmetry and ordering rules. |
| test/Extensions/Orleans.Streaming.EventHubs.Tests/CheckpointerTests/EventHubCheckpointerTests.cs | Updates EventHub checkpointer tests for new signatures/inner state handling. |
| test/Extensions/Orleans.Streaming.EventHubs.Tests/CheckpointerTests/AzureTableStreamQueueCheckpointerContractTests.cs | New contract tests for Azure Table checkpointer against the shared checkpointer test suite. |
| test/Extensions/Orleans.Redis.Tests/Streaming/RedisStreamSequenceTokenTests.cs | New tests for Redis token equality/ordering and rejection of base tokens. |
| test/Extensions/Orleans.Redis.Tests/Streaming/RedisStreamBatchContainerTests.cs | Adds CreateSequenceTokenForEvent coverage preserving Redis position metadata. |
| test/Extensions/Orleans.Azure.Tests/UnitTestAzureTableDataManager.cs | Updates test table init to pass cancellation tokens through. |
| test/Extensions/Orleans.AdoNet.Tests/Streaming/AdoNetStreamMessageStreamIdTests.cs | New tests ensuring stored StreamId bytes + namespace boundary reconstruct correctly. |
| test/Extensions/Orleans.AdoNet.Tests/Streaming/AdoNetQueueAdapterTests.cs | Updates ADO.NET adapter tests for partitioned provider behavior and new storage read paths. |
| test/Extensions/Orleans.AdoNet.Tests/Streaming/AdoNetQueueAdapterFactoryTests.cs | Updates factory tests for rewindable behavior, shared receiver/cache registry, and failure handler settings. |
| test/Extensions/Orleans.AdoNet.Tests/Streaming/AdoNetClientStreamTests.cs | Updates dropped-client test to rely on subscription-unregistered behavior without dead-letter counting. |
| test/Extensions/Orleans.AdoNet.Tests/Streaming/AdoNetBatchContainerTests.cs | Updates message schema handling and adds JSON round-trip + recoverable adapter tests for ADO.NET tokens. |
| test/Extensions/Orleans.AdoNet.Tests/StorageTests/Relational/RelationalStorageExtensionsTests.cs | Updates relational storage extension tests to flow cancellation tokens. |
| test/Benchmarks.AdoNet/Streaming/StreamPartitionAppendBenchmark.cs | New benchmark for stream-partition append throughput under contention/payload/concurrency variation. |
| test/Benchmarks.AdoNet/Streaming/MessageQueueingBenchmark.cs | Removes older queueing benchmark superseded by partition append benchmark. |
| test/Benchmarks.AdoNet/Streaming/MessageDequeueingBenchmark.cs | Removes older dequeueing benchmark superseded by new partitioned model benchmarks. |
| src/Redis/Orleans.Streaming.Redis/Streams/RedisStreamSequenceToken.cs | Updates token CreateSequenceTokenForEvent override and enforces comparable-type constraints in CompareTo. |
| src/Orleans.Streaming/QueueAdapters/IQueueCacheCursorProgress.cs | Adds new cursor progress interfaces used for safe contiguous partition progress tracking. |
| src/Orleans.Streaming/QueueAdapters/IQueueCache.cs | Updates delivery-progress doc semantics to “earliest safe contiguous partition position”. |
| src/Orleans.Streaming/QueueAdapters/IAsyncQueueCacheCursor.cs | Adds async cursor API + transient replay exception + MoveNext result enum for retained-history reads. |
| src/Orleans.Streaming/PubSub/PubSubRendezvousGrain.cs | Emits subscription-unregistered diagnostic when clearing state after removal. |
| src/Orleans.Streaming/PersistentStreams/QueueStreamDataStructures.cs | Adds per-subscription tracking for cursor start/safe-partition tokens and replay availability. |
| src/Orleans.Streaming/PersistentStreams/Options/PersistentStreamProviderOptions.cs | Adds configurable delivery progress update interval for pulling agents. |
| src/Orleans.Streaming/MemoryStreams/MemoryPooledCache.cs | Clears current buffer reference when purge leaves cache empty. |
| src/Orleans.Streaming/JsonConverters/EventSequenceTokenJsonConverter.cs | Extends converter to support partitioned tokens (identity + position + seq/event index). |
| src/Orleans.Streaming/Generator/GeneratorPooledCache.cs | Adds internal ctor for purge predicate injection and clears current buffer when cache becomes empty. |
| src/Orleans.Streaming/Common/RecoverableStreams/RecoverableStreamStartPosition.cs | Adds a value type describing checkpoint/start-from-now initialization for recoverable sources. |
| src/Orleans.Streaming/Common/RecoverableStreams/QueueAdapterReceiverRegistry.cs | Adds a receiver/cache registry to ensure one coordinator per queue shared by receiver + cache factories. |
| src/Orleans.Streaming/Common/RecoverableStreams/IRecoverableStreamSource.cs | Adds recoverable partition source abstraction for ordered reads and lifecycle. |
| src/Orleans.Streaming/Common/RecoverableStreams/IRecoverableStreamReplaySource.cs | Adds replay source factory + replay reader contracts + replay read result type. |
| src/Orleans.Streaming/Common/RecoverableStreams/IRecoverableStreamQueueCache.cs | Adds cache contract used by recoverable receiver, including newest/oldest offsets and replay progress hooks. |
| src/Orleans.Streaming/Common/RecoverableStreams/IRecoverableStreamDataAdapter.cs | Adds data-adapter contract mapping immutable records to cached messages and provider offsets. |
| src/Orleans.Streaming/Common/RecoverableStreamOptions.cs | Introduces RecoverableStreamReplayOptions (bounded readers/pending/cache/read batch size/retry delay). |
| src/Orleans.Streaming/Common/RecoverableStreamConfigurator.cs | Wires replay options into configurator extension points and logging configuration. |
| src/Orleans.Streaming/Common/PooledCache/IEvictionStrategy.cs | Adds OnPurgeCompleted hook for post-owner purge accounting. |
| src/Orleans.Streaming/Common/PooledCache/ICacheDataAdapter.cs | Adds adapter-aware Compare hook for caches with external offsets. |
| src/Orleans.Streaming/Common/PooledCache/FixedSizeBuffer.cs | Adds internal Position and ResetTo to support precise buffer state management. |
| src/Orleans.Streaming/Common/PooledCache/ChronologicalEvictionStrategy.cs | Refactors purge completion and ensures buffers are freed when cache becomes empty. |
| src/Orleans.Streaming/Common/PooledCache/CachedMessageBlock.cs | Clears cached message slots on remove/reset and adds adapter-aware index search overload. |
| src/Orleans.Streaming/Common/PartitionedStreamSequenceToken.cs | Adds provider/partition identity + position-aware token type with JSON support. |
| src/Orleans.Streaming/Common/EventSequenceTokenV2.cs | Preserves concrete derived token type when creating per-event tokens and clarifies compatibility semantics. |
| src/Orleans.Streaming/Common/EventSequenceToken.cs | Same as V2: preserve concrete type for CreateSequenceTokenForEvent and clarifies compatibility semantics. |
| src/Orleans.Streaming/Checkpointers/StreamQueueCheckpointerOptions.cs | Adds new options type for StreamQueueCheckpointer. |
| src/Orleans.Streaming/Checkpointers/StreamQueueCheckpointer.cs | Adds versioned, conditional-update-based checkpointer implementation with throttling and retry behavior. |
| src/Orleans.Streaming/Checkpointers/StreamCheckpointStoreState.cs | Adds value type representing (checkpoint, version) state from a checkpoint store. |
| src/Orleans.Streaming/Checkpointers/IStreamCheckpointStore.cs | Adds interface for checkpoint stores supporting conditional versioned updates. |
| src/Orleans.Streaming/Checkpointers/GrainStreamQueueCheckpointer.cs | Refactors grain-based checkpointer to use StreamQueueCheckpointer via an adapter. |
| src/Azure/Shared/Storage/AzureTableDataManager.cs | Adds cancellation support to init/insert operations and adds conditional update helper. |
| src/Azure/Orleans.Streaming.EventHubs/Providers/Streams/EventHub/EventHubSequenceToken.cs | Tightens equality/ordering to Event Hub token versions only; rejects generic tokens. |
| src/Azure/Orleans.Streaming.EventHubs/Providers/Streams/EventHub/EventHubQueueCache.cs | Clears current buffer reference when purge empties the cache. |
| src/Azure/Orleans.Streaming.EventHubs/Providers/Streams/EventHub/EventHubCheckpointer.cs | Adds cancellation-aware factory overloads for checkpointer creation. |
| src/Azure/Orleans.Streaming.EventHubs/Providers/Streams/EventHub/EventHubAdapterFactory.cs | Uses shared receiver/cache registry instead of ad-hoc receiver dictionary. |
| src/Azure/Orleans.Streaming.EventHubs/Providers/Streams/EventHub/AzureTableStreamQueueCheckpointerFactory.cs | Adds cancellation-aware Create overload and obsoletes non-CT overload. |
| src/Azure/Orleans.Reminders.AzureStorage/Storage/AzureBasedReminderTable.cs | Passes lifecycle cancellation through table initialization. |
| src/Azure/Orleans.GrainDirectory.AzureStorage/AzureTableGrainDirectory.cs | Passes cancellation token through table initialization. |
| src/AWS/Orleans.Streaming.Kinesis/Streams/KinesisSequenceToken.cs | Extends Kinesis token with partition identity and ordering based on durable shard sequence. |
| src/AWS/Orleans.Streaming.Kinesis/Streams/KinesisBatchContainer.cs | Preserves event-index ordering and supports cached-record reconstruction with identity-aware tokens. |
| src/AWS/Orleans.Streaming.Kinesis/Streams/KinesisAdapterReceiver.cs | Clarifies receiver-local ordinal usage for legacy token compatibility. |
| src/AWS/Orleans.Streaming.Kinesis/Streams/KinesisAdapterFactory.cs | Switches to shared receiver/cache, marks provider rewindable, and wires replay options. |
| src/AWS/Orleans.Streaming.Kinesis/Streams/DynamoDBStreamQueueCheckpointer.cs | Migrates to StreamQueueCheckpointer + IStreamCheckpointStore semantics. |
| src/AWS/Orleans.Streaming.Kinesis/Streams/DynamoDBStreamCheckpointStore.cs | Migrates to versioned checkpoint store state for conditional updates. |
| src/AWS/Orleans.Streaming.Kinesis/README.md | Documents retained-history replay configuration and failure modes. |
| src/AWS/Orleans.Streaming.Kinesis/Hosting/SiloKinesisStreamConfigurator.cs | Adds replay configuration plumbing for silos. |
| src/AWS/Orleans.Streaming.Kinesis/Hosting/ClusterClientKinesisStreamConfigurator.cs | Adds replay configuration plumbing for clients. |
| src/api/Azure/Orleans.Streaming.EventHubs/Orleans.Streaming.EventHubs.cs | Updates generated API surface for new/updated Event Hubs streaming APIs. |
| src/api/AWS/Orleans.Streaming.Kinesis/Orleans.Streaming.Kinesis.cs | Updates generated API surface for new replay configuration methods. |
| src/api/AdoNet/Orleans.Streaming.AdoNet/Orleans.Streaming.AdoNet.cs | Updates generated API surface for ADO.NET provider option/schema changes and replay configuration. |
| src/AdoNet/Shared/Storage/RelationalStorageExtensions.cs | Adds cancellation token support to relational storage ReadAsync extension. |
| src/AdoNet/Orleans.Streaming.AdoNet/README.md | Updates provider guidance for partitioned model, retention, and replay leases (alpha schema v3). |
| src/AdoNet/Orleans.Streaming.AdoNet/Hosting/SiloAdoNetStreamConfigurator.cs | Adds replay options to named configuration and exposes ConfigureReplay. |
| src/AdoNet/Orleans.Streaming.AdoNet/Hosting/ClusterClientAdoNetStreamConfigurator.cs | Adds replay options to named configuration and exposes ConfigureReplay. |
| src/AdoNet/Orleans.Streaming.AdoNet/Extensions.cs | Removes time-rounding helper extensions (replaced by AdoNetStreamTime). |
| src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamTime.cs | Adds SQL-safe interval validation and “round up to seconds” conversion. |
| src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamSequenceToken.cs | Adds identity-aware ADO.NET stream token implementing partitioned token interface. |
| src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamReplayState.cs | Adds internal state types for replay lease and page result handling. |
| src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamPartitionState.cs | Adds internal state type for partition durable position and retained bounds. |
| src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamOptionsValidator.cs | Updates validation to new partitioned options/interval constraints and replay lease rules. |
| src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamOptions.cs | Replaces legacy queue/dead-letter options with partitioned retention, checkpoint, cleanup, and replay lease settings. |
| src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamMessage.cs | Updates stored message schema (stream id bytes + namespace length) and exposes reconstructed StreamId. |
| src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamFailureHandler.cs | Switches to logging-based failure handling while preserving shared partition records. |
| src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamDeadLetter.cs | Removes dead-letter model (no longer used by partitioned provider). |
| src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamConfirmationAck.cs | Removes confirmation ack model (no longer used). |
| src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamConfirmation.cs | Removes confirmation model (no longer used). |
| src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamCleanupResult.cs | Adds internal model describing cleanup outcomes including hard-retention deletions. |
| src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamCheckpointUpdate.cs | Adds internal model describing epoch-fenced checkpoint update results. |
| src/AdoNet/Orleans.Streaming.AdoNet/AdoNetQueueAdapterFactory.cs | Makes factory also act as queue cache provider and wires replay options into adapter creation. |
| src/AdoNet/Orleans.Streaming.AdoNet/AdoNetQueueAdapter.cs | Makes adapter rewindable, switches enqueue to partition append, and uses shared receiver/cache registry. |
| src/AdoNet/Orleans.Streaming.AdoNet/AdoNetBatchContainer.cs | Updates event-index token assignment to preserve per-record event index across type filtering. |
| docs/site/src/content/docs/streaming/stream-providers.md | Updates provider matrix and ADO.NET/Kinesis rewindability guidance. |
| docs/site/src/content/docs/streaming/kinesis-streaming.md | Documents retained-history replay behavior and configuration for Kinesis. |
| docs/site/src/content/docs/streaming/delivery-semantics.md | Updates delivery/replay semantics documentation to include retained-history replay and handoff behavior. |
| docs/site/src/content/docs/streaming/data-adapters.md | Clarifies token construction guidance relative to stream partitions. |
| docs/site/src/content/docs/streaming/custom-queue-adapter.md | Updates guidance for implementing retained-history adapters and async cursors. |
| docs/site/src/content/docs/implementation/streams-implementation/index.md | Updates internal streaming implementation docs for safe contiguous partition progress semantics. |
| docs/site/src/content/docs/host/monitoring/signals.md | Tightens wording around dashboard vs durable telemetry. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The change set introduces new streaming replay APIs and touches multiple providers and persistence/checkpoint paths, requiring careful end-to-end validation beyond what automated review can confidently approve.
Review tier: Lite
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/Orleans.Streaming/JsonConverters/EventSequenceTokenJsonConverter.cs — ReadPartitionedToken rejects deserializing discriminator=3 tokens when the requested type is… |
Issues resolved since last review (3)
| Severity | Finding |
|---|---|
src/Orleans.Streaming/Common/PartitionedStreamSequenceToken.cs — The [Id] values on PartitionedStreamSequenceToken overlap with the base EventSequenceTokenV2 field… View resolved comment |
|
src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamSequenceToken.cs — AdoNetStreamSequenceToken uses [Id(0..2)] for its own members even though it inherits… View resolved comment |
|
src/AWS/Orleans.Streaming.Kinesis/Streams/KinesisSequenceToken.cs — KinesisSequenceToken declares additional Orleans-serialized members using [Id(0..2)], which… View resolved comment |
|
Current CI at head \60cd72566f\ has a PR-specific Redis streaming regression in both net8.0 and net10.0 (run 33901060370). Five \RedisStreamingResumeTests\ cases consistently time out waiting for expected delivery: \ResumeAfterInactivity, \ResumeAfterDeactivationActiveStream, \ResumeAfterDeactivation, \ResumeAfterSlowSubscriber, and \ResumeAfterInactivityNotInCache. The cross-target repetition indicates the retained-history changes need correction rather than a blind retry. The active PR session is addressing this together with the new base-typed partition-token round-trip review finding. |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It introduces broad streaming API/behavior changes across multiple providers and requires full end-to-end validation beyond the issues noted in code review comments.
Review tier: Lite
Findings: None
Issues resolved since last review (1)
| Severity | Finding |
|---|---|
src/Orleans.Streaming/JsonConverters/EventSequenceTokenJsonConverter.cs — ReadPartitionedToken rejects deserializing discriminator=3 tokens when the requested type is… View resolved comment |
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamOptions.cs:60
- The XML remarks state that fractional-second values are rounded up, but the validator enforces a minimum of 1 second (via AdoNetStreamTime.IsValidSqlInterval and AdoNetStreamOptionsValidator). Either the validator should allow sub-second values (rounding them up), or the docs should explicitly state the 1-second minimum to avoid misleading configuration guidance.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Newly created Kinesis live-delivery tokens still omit stream/shard identity (null), undermining the intended token-identity validation for retained-history replay and risking cross-partition token misuse.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Lite
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/AWS/Orleans.Streaming.Kinesis/Streams/KinesisAdapterReceiver.cs — KinesisSequenceToken now supports embedding stream/shard identity, but live reads still construct… |
Suppressed comments (4)
Previously missed (2) — in code that hasn't changed since the last review.
src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamSequenceToken.cs:53
- Provider identity/position are recomputed via string allocations (interpolated
GetProviderIdentity+SequenceNumber.ToString(...)) on everyEqualscall. Since tokens are compared and hashed frequently, consider caching these computed strings in non-serialized fields and reusing them.
This issue also appears in the following locations of the same file:
- line 65
- line 81
src/Orleans.Streaming/Common/PartitionedStreamSequenceToken.cs:147
ComparePositionsusesleft[leftStart..]/right[rightStart..]which allocates new substrings on every comparison. Since these tokens are compared frequently (ordering, equality, cache positioning), this can create avoidable allocations. Prefer a span-based numeric check (similar toGetPositionHashCode).
src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamSequenceToken.cs:85
GetHashCodealso recomputes provider identity and position strings, which can allocate and add overhead when tokens are used as dictionary/set keys. IfProviderIdentity/Positionare cached, use them here too to keep hashing allocation-free.
src/AdoNet/Orleans.Streaming.AdoNet/AdoNetStreamSequenceToken.cs:69CompareTocurrently allocates viaGetProviderIdentity(...)andSequenceNumber.ToString(...)each time it runs. With cachedProviderIdentity/Positionstrings, this method can avoid those per-compare allocations.
3dbc0a2 to
dadea50
Compare
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It introduces broad runtime and public-API changes across multiple streaming providers and core caching/checkpoint semantics, requiring careful end-to-end validation beyond this automated review.
Review tier: Lite
Findings: None
Issues resolved since last review (1)
| Severity | Finding |
|---|---|
src/AWS/Orleans.Streaming.Kinesis/Streams/KinesisAdapterReceiver.cs — KinesisSequenceToken now supports embedding stream/shard identity, but live reads still construct… View resolved comment |
dadea50 to
56a2ad3
Compare
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It introduces broad public API and behavioral changes across multiple streaming providers (replay, checkpointing, token semantics, cache/eviction), which warrants careful end-to-end validation and human review.
Review tier: Lite
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/Azure/Orleans.Streaming.EventHubs/Providers/Streams/EventHub/EventHubCheckpointer.cs — The legacy Create(partition) overload is obsolete on IStreamQueueCheckpointerFactory, but this… |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The changes span core streaming abstractions, provider implementations, serialization/token semantics, and checkpointing, which is broad enough that it warrants final human review despite test and documentation updates.
Review tier: Lite
Findings: None
Issues resolved since last review (2)
| Severity | Finding |
|---|---|
src/Azure/Orleans.Streaming.EventHubs/Providers/Streams/EventHub/EventHubCheckpointer.cs — The legacy Create(partition) overload is obsolete on IStreamQueueCheckpointerFactory, but this… View resolved comment |
|
src/AWS/Orleans.Streaming.Kinesis/Streams/KinesisSequenceToken.cs — KinesisSequenceToken declares additional Orleans-serialized members using [Id(0..2)], which… View resolved comment |
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/AWS/Orleans.Streaming.Kinesis/Streams/KinesisAdapterFactory.cs:37
- SemaphoreSlim
_initializationSemaphoreis introduced to guard one-time adapter initialization but is never disposed, even though this type implementsIDisposable. This can leak a wait handle for the lifetime of the process (especially if multiple factories are created in tests or dynamically).
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The change set spans core streaming APIs, multiple providers, serialization/token contracts, checkpointing, and cache eviction behavior, requiring careful end-to-end validation beyond an automated review.
Review tier: Lite
Findings: None
Preserve legacy Kinesis token serialization, reject invalid ADO.NET replay positions, integrate cache-miss recovery, retain future replay starts, and align provider documentation with implemented replay ranges.
Port the isolated runtime correction and four regression cases from foundation commit 79e7864af6b44b847540c4bd78ca209e5faa5622. Exercise this branch's explicit record-count capacity while preserving inclusive delivery, retry, quiet-partition scan, and checkpoint barriers.
Regenerate all four replay-related package API surfaces after rebasing onto current main. Capture the Azure Table adapter cancellation overloads integrated with the reusable checkpoint core.



Problem
Persistent stream subscriptions need to resume from retained provider positions older than the live Orleans cache and transition continuously into live delivery.
Solution
Add a provider-neutral asynchronous replay cursor and receiver-owned replay manager with bounded admissions, pooled replay fragments, partition-order filtering, explicit retention failures, and atomic live-cache handoff.
Kinesis opens independent shard readers from retained arbitrary-precision sequence positions, renews iterators, shares shard read throttling, and validates stream/shard token identity while preserving the legacy serialized shard-sequence field. ADO.NET streaming uses schema version 3 with epoch-fenced, provider-visible replay leases whose safe watermarks protect cleanup across silos. SQL Server, PostgreSQL, and MySQL implement the same admission, renewal, release, cleanup, and hard-retention contract.
Event Hubs and Redis provide live-cache rewind. Their durable transport positions support receiver recovery independently from per-subscription retained-history replay.
Decomposition and final completion target
This PR is the final merge target which closes #756. It preserves the integrated retained-history implementation while smaller, release-ready prerequisites are extracted. Independent slices target
main; human-merged predecessors are removed by rebasing. The final scope includes ADO.NET replay activation, cross-provider replay conformance, and complete user-facing guidance.mainmain; result-API migration supplied by #11230mainmainmain; newer producer-retirement protocol remains a coordinated #10588 prerequisitemain; provider integration remains hereThe first wave and intermediate provider PRs reference #756. This PR retains
Closes #756and reaches its final completion scope once the prerequisites and complete rewind/replay outcome are ready. Decomposition remains an agreed extraction sequence, with the current integrated branch preserving the source until each slice has a verified disposition.Source preservation and current integration
Original source snapshot:
aa2c36d0c3eb9de5c3279ba24d52b0b7c59818b5against81b4e84a0f771bd0930d3369295fa73b0363ca9c(57 commits, 133 files). Its embedded foundation ends atc1f1a89362e8d2b9d3c792801cd81d416b8a063a; that historical snapshot remains available for change accounting.The current branch is rebased onto
mainat9222be9a19196335e129e211718619f47bf73adc, including #10532, #11249, #11154, #11155, #11260, and #11268. It preserves prefetched recovery batches, admission/drain ownership, handshake request identities and generations, compatible drained-subscription progress, legacy cursor scheduling, and replay-specific stream/shard identity and live handoff.The preparation fixes are isolated:
ad26902337: a heartbeat failure recorded during an in-flight ADO.NET replay read retains its original transient, ownership-loss, or retention classification, whether SQL observes cancellation or finishes successfully. Ordinary caller and shutdown cancellation retain cancellation semantics. Transient replay failures therefore reach cursor recreation from the established safe position.6876df9b17: quiet-partition scans wake progress-aware cursors while preserving matching-stream legacy scheduling; replay read errors use the captured handshake request ID. ADO.NET shutdown guidance describes checkpoint and replay-lease ownership.c18042691b: ports the isolated Latest correction from feat(streaming)!: unify stream partition recovery #10588 commit79e7864af6b44b847540c4bd78ca209e5faa5622. A new Latest cursor records its excluded partition prefix as safe scan progress; included deliveries and retries retain their checkpoint barrier. The four integration cases exercise this branch's explicit record-count capacity.0a8870ea10: regenerates the Event Hubs API surface for the integrated Azure Table cancellation overloads, using the repository GenAPI workflow.Explicit residual slices and release decisions
The newer #10588 encoded-byte capacity, buffered-overflow ownership, and producer-initiated retirement protocols remain distinct integration prerequisites. Their port must preserve this branch's replay ownership, atomic handoff, current admission/drain guarantees, and handshake identities. #8273 shares the canonical foundation dependency and coordinates its provider integration separately.
ADO.NET currently has one consistent schema-v3 contract across runtime validation, all three SQL dialects, query keys, options, generated APIs, compatibility treatment, and migration documentation. Its implemented upgrade is a coordinated replacement: stop producers and consumers, export required payloads, replace streaming objects/query rows with the current scripts, verify version and replay keys, then restart.
The human release decision is whether the foundation and replay ship as one unreleased final schema transition or establish a separately released v2 boundary with an explicit staged migration. The current v3 replacement policy is preserved pending that agreement. SQL/runtime/ownership/checkpoint/cleanup behavior and replay lease activation form one coherent release unit; slices 12 and 13 can be combined to maintain that contract.
Each extracted slice carries its runtime behavior, regression coverage, generated API surface, scoped package compatibility treatment, and documentation. Contributor branches remain in their forks, and subsequent slices target updated
mainwith explicit prerequisites.Guarantees
DataNotAvailableException.Closes #756
Microsoft Reviewers: Open in CodeFlow