fix(persistence): flow grain storage cancellation tokens - #10641
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates Orleans persistence so that caller cancellation tokens are propagated end-to-end from IStorage operations through StateStorageBridge into IGrainStorage, enabling storage providers to observe and act on cancellation.
Changes:
- Added
CancellationTokenoverloads toIGrainStorageusing default interface implementations to preserve compatibility with existing providers. - Updated
StateStorageBridgeto forward cancellation tokens to storage providers and to avoid wrapping caller-requested cancellations. - Updated docs/API surface and added focused tests verifying overload delegation and token propagation behavior.
Show a summary per file
| File | Description |
|---|---|
| test/Orleans.Core.Tests/Storage/StateStorageBridgeCancellationTests.cs | Adds tests validating IGrainStorage default-overload delegation and StateStorageBridge token propagation behavior. |
| src/Orleans.Runtime/Storage/StateStorageBridge.cs | Forwards cancellation tokens from IStorage calls to IGrainStorage and preserves caller-requested cancellation semantics. |
| src/Orleans.Persistence.Memory/Storage/MemoryStorageWithLatency.cs | Updates XML doc <see cref> targets to disambiguate after new overloads were introduced. |
| src/Orleans.Core/Providers/IGrainStorage.cs | Introduces cancellation-token overloads with default implementations delegating to legacy methods for compatibility. |
| src/Azure/Orleans.Persistence.AzureStorage/Providers/Storage/AzureTableStorage.cs | Updates XML doc <see cref> targets to the now-ambiguous method signatures. |
| src/Azure/Orleans.Persistence.AzureStorage/Providers/Storage/AzureBlobStorageOptions.cs | Updates XML doc reference to the disambiguated ClearStateAsync overload. |
| src/Azure/Orleans.Persistence.AzureStorage/Providers/Storage/AzureBlobStorage.cs | Updates XML doc <see cref> targets to disambiguate after overload additions. |
| src/AWS/Orleans.Persistence.DynamoDB/Provider/DynamoDBGrainStorage.cs | Updates XML doc <see cref> targets to the now-ambiguous method signatures. |
| src/api/Orleans.Core/Orleans.Core.cs | Updates generated public API surface to include the new IGrainStorage overloads. |
| src/AdoNet/Orleans.Persistence.AdoNet/Storage/Provider/AdoNetGrainStorage.cs | Updates XML doc <see cref> targets to disambiguate after overload additions. |
| docs/site/src/content/docs/tutorials-and-samples/custom-grain-storage.md | Documents the new cancellation-token overloads and the token-flow behavior. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 11/11 changed files
- Comments generated: 1
- Review effort level: Lite
Comment on lines
+11
to
+13
| using Orleans.Serialization.Activators; | ||
| using Orleans.Serialization.Serializers; | ||
| using Orleans.Storage; |
ReubenBond
marked this pull request as ready for review
August 18, 2026 00:05
This was referenced Aug 28, 2026
Merged
Merged
This was referenced Sep 4, 2026
This was referenced Sep 8, 2026
Closed
This was referenced Sep 16, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Grain persistence exposes cancellation-aware
IStorageoperations, butStateStorageBridgepreviously invoked only the cancellation-freeIGrainStoragemethods. Storage providers therefore could not receive the caller's cancellation token.This change adds cancellation-token overloads to
IGrainStorageand forwards tokens throughStateStorageBridge. Parameterless operations passCancellationToken.None, and caller-requested cancellation propagates without storage-failure wrapping.The new interface methods use default implementations which delegate to the existing overloads, preserving compatibility for storage providers while allowing providers to opt into backend cancellation. The provider-authoring documentation, public API surface, XML references, and focused cancellation coverage are updated accordingly.
Microsoft Reviewers: Open in CodeFlow