Add ClearLogAsync method to JournaledGrain#9849
Merged
ReubenBond merged 6 commits intodotnet:mainfrom Feb 15, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a ClearLogAsync method to JournaledGrain to enable complete erasure of stored grain data. This addresses a feature request (#8408) for a way to reset event-sourced grains to their initial state.
Key Changes:
- Added
ClearLogAsyncmethod to theJournaledGrainbase class andILogViewUpdateinterface - Implemented
ClearLogAsyncin StateStorage, LogStorage, and CustomStorage adaptors - Added backward-compatible default implementation to
ICustomStorageInterfaceusing C# default interface methods
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Orleans.EventSourcing/JournaledGrain.cs | Exposes protected ClearLogAsync method for grain subclasses |
| src/Orleans.EventSourcing/LogConsistency/ILogViewAdaptor.cs | Adds ClearLogAsync to the ILogViewUpdate interface |
| src/Orleans.EventSourcing/StateStorage/LogViewAdaptor.cs | Implements clear logic for state storage backend |
| src/Orleans.EventSourcing/LogStorage/LogViewAdaptor.cs | Implements clear logic for log storage backend |
| src/Orleans.EventSourcing/CustomStorage/LogViewAdaptor.cs | Implements clear logic for custom storage backend |
| src/Orleans.EventSourcing/CustomStorage/ICustomStorageInterface.cs | Adds default ClearStoredState method with NotSupportedException |
| src/Orleans.EventSourcing/Common/PrimaryBasedLogViewAdaptor.cs | Adds base implementation, ResetTentativeState helper, and caches initial state |
5aca271 to
007619d
Compare
Member
|
@m3nax I added a commit to serialize clear operations w.r.t other pending operations and rebased. |
ReubenBond
approved these changes
Feb 14, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Route ClearLogAsync through PrimaryBasedLogViewAdaptor worker to avoid races with pending updates. - Introduce provider ClearPrimaryLogAsync hooks and explicit cancellation checks for providers without token-aware clear APIs. - Expose Clear() on log test grains and add non-Azure LogTestGrainClearTests for DefaultStorage, SharedLogStorage, and CustomStoragePrimaryCluster. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
007619d to
4ff73cc
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
Thank you for reviewing my pr |
rkargMsft
pushed a commit
to rkargMsft/orleans
that referenced
this pull request
Feb 27, 2026
* Added ClearLogAsync method to JournaledGrain * Added supporto for ClearLog to ICustomStorageInterface<TLogView, TLogEntry> * Fixed property naming * Update src/Orleans.EventSourcing/LogConsistency/ILogViewAdaptor.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Serialize ClearLog and add integration tests - Route ClearLogAsync through PrimaryBasedLogViewAdaptor worker to avoid races with pending updates. - Introduce provider ClearPrimaryLogAsync hooks and explicit cancellation checks for providers without token-aware clear APIs. - Expose Clear() on log test grains and add non-Azure LogTestGrainClearTests for DefaultStorage, SharedLogStorage, and CustomStoragePrimaryCluster. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address PR dotnet#9849 feedback Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Reuben Bond <reuben.bond@gmail.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Added ClearLogAsync to the JournaledGrain in order to completely erase the stored data of the grain
Implemented the method in StateStorage and LogStorage
Added the method to be implemented in the ICustomStorageInterface interface with a default implementation in order to avoid breaking changes
REF: #8408
Microsoft Reviewers: Open in CodeFlow