[Journaling] Auto-retire & purge state machines#9684
Merged
ReubenBond merged 36 commits intodotnet:mainfrom Oct 31, 2025
Merged
[Journaling] Auto-retire & purge state machines#9684ReubenBond merged 36 commits intodotnet:mainfrom
ReubenBond merged 36 commits intodotnet:mainfrom
Conversation
ReubenBond
reviewed
Sep 17, 2025
ReubenBond
reviewed
Sep 17, 2025
Co-authored-by: Reuben Bond <203839+ReubenBond@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements automatic retirement and purging of state machines in the journaling system. When a state machine is no longer registered with the manager, it enters a grace period before being permanently removed, allowing for potential resurrection if re-registered within that timeframe.
Key Changes
- Introduced
StateMachineManagerOptionswith configurableRetirementGracePeriod(default: 1 hour) - Implemented retirement tracking system that monitors unregistered state machines and purges them after the grace period
- Added
RetiredStateMachineVesselto buffer data for retired machines during the grace period, supporting resurrection
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Orleans.Journaling/StateMachineManagerOptions.cs | New options class defining retirement grace period configuration |
| src/Orleans.Journaling/StateMachineManager.cs | Core implementation of retirement tracking, vessel buffering, and purging logic |
| src/Orleans.Journaling/DurableDictionary.cs | Made ApplyRemove internal and GetStorage virtual to support retirement tracker |
| src/Orleans.Journaling/HostingExtensions.cs | Added StateMachineManagerOptions registration to DI container |
| test/Orleans.Journaling.Tests/StateMachineManagerTests.cs | Comprehensive test covering full retirement lifecycle including grace period and resurrection |
| test/Orleans.Journaling.Tests/StateMachineTestBase.cs | Updated test infrastructure to support TimeProvider injection and ManagerOptions |
| test/Orleans.Journaling.Tests/LogSegmentTests.cs | Updated StateMachineManager instantiations with new constructor parameters |
| test/Orleans.Journaling.Tests/Orleans.Journaling.Tests.csproj | Added Microsoft.Extensions.TimeProvider.Testing package reference |
| Orleans.slnx | Cleaned up project type attributes |
ReubenBond
reviewed
Oct 23, 2025
ReubenBond
reviewed
Oct 23, 2025
ReubenBond
approved these changes
Oct 23, 2025
Member
ReubenBond
left a comment
There was a problem hiding this comment.
I left a couple of comments that I think we should address. Looks great, this is a very nice addition!
Member
|
Ah, sorry, my fix to StateMachineManager caused a conflict |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Member
|
Can you rebase on main @ledjon-behluli? |
…et#9696) The `CreateIfNotExistsAsync` method's response will have a 409-statuscode if the table already exists and will always return the `TableItem` if the call is successful.
…image (dotnet#9699) * Initial plan * Fix ZooKeeper CI tests: correct service name and use specific image tag Co-authored-by: ReubenBond <203839+ReubenBond@users.noreply.github.com> * Use official ZooKeeper Docker image instead of bitnami Co-authored-by: ReubenBond <203839+ReubenBond@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ReubenBond <203839+ReubenBond@users.noreply.github.com>
* Fix Consul key format to comply with allowed characters Co-authored-by: ReubenBond <203839+ReubenBond@users.noreply.github.com> * Use custom encoding for Consul keys instead of URL encoding Co-authored-by: ReubenBond <203839+ReubenBond@users.noreply.github.com> * Simplify encoding logic to handle both IPv4 and IPv6 Co-authored-by: ReubenBond <203839+ReubenBond@users.noreply.github.com> * Revert breaking changes and use older Consul version for tests Co-authored-by: ReubenBond <203839+ReubenBond@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ReubenBond <203839+ReubenBond@users.noreply.github.com>
…metry specification (dotnet#9703) * Initial plan * Remove explicit ActivityStatusCode.Ok per OpenTelemetry spec Co-authored-by: ReubenBond <203839+ReubenBond@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ReubenBond <203839+ReubenBond@users.noreply.github.com>
Bumps [dotnet-sdk](https://github.com/dotnet/sdk) from 9.0.303 to 9.0.305. - [Release notes](https://github.com/dotnet/sdk/releases) - [Commits](dotnet/sdk@v9.0.303...v9.0.305) --- updated-dependencies: - dependency-name: dotnet-sdk dependency-version: 9.0.305 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
fix potentiall NRE in the activation repartioner
* Timeout.InfiniteTimeSpan is not allowed for reminders * Specifically check for InfiniteTimeSpan to make clear it's usage is not allowed (and to allow for an eventual future change of the InfiniteTimeSpan value) --------- Co-authored-by: Jerremy Koot <jerremy.koot@gmail.com>
Bumps [dotnet-sdk](https://github.com/dotnet/sdk) from 9.0.305 to 9.0.306. - [Release notes](https://github.com/dotnet/sdk/releases) - [Commits](dotnet/sdk@v9.0.305...v9.0.306) --- updated-dependencies: - dependency-name: dotnet-sdk dependency-version: 9.0.306 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Changed isSynchronousAdoNetImplementation from true to false for PostgreSQL thanks to updates in Npgsql 8.0. npgsql/npgsql#1130
Enable merge queue
Add missing validation for the Nats stream provider
…eduler (dotnet#9726) * ActivationDataActivatorProvider: always run grain constructor on ActivationTaskScheduler * ActivationDataActivatorProvider: always run grain constructor on ActivationTaskScheduler
…otnet#9671) Co-authored-by: Ramzi Mourtada <ramourt@microsoft.com>
ReubenBond
approved these changes
Oct 31, 2025
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.
Microsoft Reviewers: Open in CodeFlow