Dedupe follow-up: ProjectionCoordinatorBase (#4516) + HiloSequenceBase (#4527)#4532
Merged
jeremydmiller merged 2 commits intoMay 20, 2026
Merged
Conversation
…bclass #326 lifted the projection-coordinator execute loop + agent-start resilience + lifecycle (Start/Pause/Resume/Stop) into JasperFx.Events.Daemon.ProjectionCoordinatorBase. Reduce Marten's coordinator to a subclass: - Supply via the base ctor: BuildDistributor(store), the store's ResiliencePipeline, Events.TimeProvider, and the three settings (LeadershipPollingTime as a TimeSpan, AgentPauseTime, HealthCheckPollingTime). - Implement the seams: ResolveDaemon (keeps Marten's ImHashMap + double-checked-lock daemon cache) and ResolvedDaemons; keep the existing DaemonForMainDatabase / DaemonForDatabase / AllDaemonsAsync. - Delete the lifted-into-base members: executeAsync, start/stopAgentsIfNecessary, tryStartAgent, the Start/Pause/Resume/Stop bodies, pauseDistributor, and the DaemonShardName record. Behavior is unchanged (the base adopted Marten's resilient agent-start + single-cancellation lifecycle verbatim). DaemonTests 185/0; HotCold leadership-election tests (detect_high_water_mark, end_to_end_with_events_already_published) pass. Closes #4516. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Completes #4527 (the serialization-enum subset landed in #4529). weasel#287 lifted the dialect-agnostic Hi-Lo pieces into Weasel.Core.Sequences: HiloSequenceBase (state + arithmetic), ISequence, IReadOnlyHiloSettings, HiloSettings, and HiloSequenceAdvanceToNextHiAttemptsExceededException. - Marten's HiloSequence now derives from HiloSequenceBase, keeping only the PostgreSQL I/O (mt_get_next_hi stored function in AdvanceToNextHi/Sync, the mt_hilo floor update in SetFloor). The client-side arithmetic (AdvanceValue/ShouldAdvanceHi/NextInt/NextLong/TrySetCurrentHi/hi-lo state) is inherited verbatim — id allocation is unchanged. - Delete Marten's ISequence / IReadOnlyHiloSettings / HiloSettings / HiloSequenceAdvanceToNextHiAttemptsExceededException copies and alias the old names via the shared dedupe file (shapes identical; the exception's base changed MartenException -> Exception but nothing catches it as MartenException). - AdvanceToNextHiSync is protected on the base; the one test that drove it directly now invokes it reflectively to keep exercising the sync I/O path. Hi-Lo + sequence-id tests pass (32/0). Closes #4527. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The two mechanical "lift-consume" refactors deferred from #4529. Each is a separate commit; both delete a Marten implementation in favor of the lifted JasperFx/Weasel base with behavior preserved verbatim. Closes #4516 and #4527.
#4516 — ProjectionCoordinator → ProjectionCoordinatorBase
#326 lifted the leadership-election + agent-lifecycle loop into
JasperFx.Events.Daemon.ProjectionCoordinatorBase. Marten's coordinator is now a subclass:BuildDistributor(store), the store'sResiliencePipeline,Events.TimeProvider, and the three settings (LeadershipPollingTime as TimeSpan, AgentPauseTime, HealthCheckPollingTime);ResolveDaemon(keeps Marten's ImHashMap + double-checked-lock daemon cache) +ResolvedDaemons; existingDaemonForMainDatabase/DaemonForDatabase/AllDaemonsAsyncretained;#4527 — HiloSequence → Weasel.Core.Sequences.HiloSequenceBase
weasel#287 lifted the Hi-Lo state + client-side arithmetic into
Weasel.Core.Sequences. (The serialization-enum subset of #4527 already landed in #4529.)HiloSequencenow derives fromHiloSequenceBase, keeping only the PostgreSQL I/O (mt_get_next_hi function, mt_hilo floor update); the arithmetic is inherited verbatim — id allocation unchanged;ISequence/IReadOnlyHiloSettings/HiloSettings/HiloSequenceAdvanceToNextHiAttemptsExceededExceptioncopies, aliased the old names via the shared dedupe file (shapes identical);AdvanceToNextHiSyncis protected on the base; the one test driving it directly now invokes it reflectively to keep exercising the sync I/O path.Test plan
dotnet build src/Marten.slnx -c Release— 0 errors (net9 + net10).Not in this PR
#4526/#4528 (IRevisioned int-revert + new ILongVersioned codegen/concurrency path) is a feature-grade change with its own test matrix (incl. a Version > Int32 case) — it gets a separate focused PR.
Refs [Master] Marten 9.0 (#4349) · pillar #214.
🤖 Generated with Claude Code