Repository navigation
GH-980: projection StopAndDrainAsync honours its timeout and skips queued pages - #983
Merged
Merged
Conversation
…eued pages Mirrors #953 for ProjectionExecution and GroupedProjectionExecution: a drain lets the page in flight finish, drops queued pages (grouped or not), awaits completion bounded by the token, then cancels; a page that finishes after cancellation doesn't mark progression. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8KxC18Q51z5w4u6YARwe4
…est harness The harness wrote the page to its channel before persisting progress, so fresh_deploy_suppresses_side_effects... could read the previous mark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8KxC18Q51z5w4u6YARwe4
Member
Author
|
Added a test-only commit: the BlueGreen gate harness announced each page before recording its progress, so 🤖 Generated with Claude Code |
jeremydmiller
force-pushed
the
gh-980-projection-drain-timeout
branch
from
October 5, 2026 23:31
2d3626f to
c3d3946
Compare
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.
Closes #980. Follow-up to #953, which did this for subscriptions.
What changed
ProjectionExecutionandGroupedProjectionExecutionnow drain the waySubscriptionExecutionBasedoes after #953:_drainingflag is checked where a page starts: inprocessRangeAsyncfor both executions, and also in the grouping stage forGroupedProjectionExecution. A page still being grouped when the drain starts is dropped before it's applied. The next owner of the shard picks the skipped pages up from the stored progression.DaemonSettings.StopAndDrainTimeout), and the execution is cancelled in afinally, so a timed-out drain cancels the page in flight. Its batch, including the progression update, doesn't commit.MarkSuccessAsync. In the grouped execution,ApplyPendingCacheUpdatesstill runs before that check, because the batch did commit.EnqueueAsyncignores pages posted after the drain started.Paths checked
CompositeReplayExecutor,ExecutionStage) callProcessRangeAsyncdirectly. Composite member executions are never drained, so they're unaffected. A replay on a composite execution that is being drained stops at the next page, which is what the existing cancellation check did already once the drain cancelled.ProcessImmediatelyAsync(catch-up) skips pages once a drain has started, as subscriptions do since fix: subscription StopAndDrainAsync honours its timeout and skips queued ranges #953.CompositeProjectionSource'sStopAndDrainAsyncwas already a no-op.DisposeAsync/HardStopAsyncstill discard the accumulator. Committed progress only advances at a flush, so the next owner resumes from the last one.AggregationRunner.FlushDeferredRebuildWritesAsyncis unchanged: a flush that commits just before cancellation still marks success in memory.Tests
ProjectionExecutionStopAndDrainTestsruns against the realProjectionExecutionandGroupedProjectionExecution, with gated substitute batches. Each case runs once per execution:ProcessRangeAsync, called directly, still applies the page and marks progression.Negative control: with the source changes reverted, 6 of the 10 cases fail. The enqueue-after-drain and direct-range cases pass either way, as expected.
Local run
./build.sh test-events:BlueGreenSideEffectGateTests.fresh_deploy_suppresses_side_effects_to_the_prior_version_mark_then_enables_them. That test uses its ownRecordingExecution, not the code changed here, and it failed in 4 of 6 standalone reruns. It's a pre-existing race between the recorded page and the progress assertion.Downstream
As with #953, Marten, Polecat and Fisher need a pin bump and a release note: JasperFx/marten#5610, JasperFx/polecat#744 and JasperFx/fisher#434. The release note in #981 currently says async projections are unchanged; it needs updating if this ships in the same release.
🤖 Generated with Claude Code
https://claude.ai/code/session_01J8KxC18Q51z5w4u6YARwe4