Repository navigation
A recovered firing of an ungrouped trigger counts against its trigger group's execution limit, not RECOVERING_JOBS - #4148
Merged
Merged
Conversation
… group's execution limit, not RECOVERING_JOBS Under UseTriggerGroupWhenUnset an ungrouped firing is limited under its trigger's group, and a recovery trigger's group is RECOVERING_JOBS: the replay ran beside the firings its own group's limit held back, and was missing from that group's in-flight count until it ended (#4084 left this as a known limitation). Every path that builds a recovery trigger - cluster recovery, a shutdown hand-back and startup recovery - writes the original trigger's group into its data map. ExecutionLimits.LimitTriggerGroup reads it for an ungrouped trigger in the recovery group, and every place a limit key is resolved now goes through it: the scheduler thread's in-flight ledger, both stores' acquisition filters and the groups a held-back round names, and both stores' cluster in-flight counts. The ADO.NET delegate takes its slots after the candidate read, so that a recovery candidate's data map can be read; only such a candidate, under the derivation, costs that read. Closes #4142 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lahma
force-pushed
the
4142/recovery-limit-group
branch
from
October 19, 2026 19:19
85f53bc to
f97427e
Compare
|
This was referenced Oct 19, 2026
Merged
lahma
added a commit
that referenced
this pull request
Oct 20, 2026
…nd-after-count zone, recovery markers, and the options table CronTriggerImpl.Clone used MemberwiseClone rather than base.Clone(), so its clone shared the original's JobDataMap, which every other trigger type's clone copies: RAMJobStore stores and hands out clones, and a write to one reached the other. TriggerCloneTest holds all five built-in types to a map of their own. Startup recovery's SelectTriggersForRecoveringJobs wrote the FailedJobOriginalTrigger* markers over a replay of a replay, naming the first recovery trigger, where cluster recovery's StoreRecoveryTrigger keeps them. The second replay lost the original group, and with it the execution limit an ungrouped replay counts against (#4148). It now keeps the markers a recovery trigger's map already carries. DailyTimeIntervalScheduleBuilder.EndingDailyAfterCount works out the window's end at build time in InTimeZone's zone or TimeZoneInfo.Local, which the scheduler's DefaultTimeZone (#4146) cannot reach: it is applied when the trigger is stored. Left as it is and documented on the builder and in the default time zone section. Computing it at store time would move it out of the builder for a difference that exists only on a build day the zone changes its clocks, and EndingDailyAfterCountComputesAgainstTheTriggerBuildersClock pins that day-dependent check as intended. The scheduler options table in configuration/reference.md gains DefaultMisfireHandling (4.6, #4131); DefaultTimeZone was already there. StdAdoConstantsTest.SelectedColumns matches SELECT and FROM as whole words, so a column with FROM in its name no longer ends the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lahma
added a commit
that referenced
this pull request
Oct 26, 2026
…nd-after-count zone, recovery markers, and the options table CronTriggerImpl.Clone used MemberwiseClone rather than base.Clone(), so its clone shared the original's JobDataMap, which every other trigger type's clone copies: RAMJobStore stores and hands out clones, and a write to one reached the other. TriggerCloneTest holds all five built-in types to a map of their own. Startup recovery's SelectTriggersForRecoveringJobs wrote the FailedJobOriginalTrigger* markers over a replay of a replay, naming the first recovery trigger, where cluster recovery's StoreRecoveryTrigger keeps them. The second replay lost the original group, and with it the execution limit an ungrouped replay counts against (#4148). It now keeps the markers a recovery trigger's map already carries. DailyTimeIntervalScheduleBuilder.EndingDailyAfterCount works out the window's end at build time in InTimeZone's zone or TimeZoneInfo.Local, which the scheduler's DefaultTimeZone (#4146) cannot reach: it is applied when the trigger is stored. Left as it is and documented on the builder and in the default time zone section. Computing it at store time would move it out of the builder for a difference that exists only on a build day the zone changes its clocks, and EndingDailyAfterCountComputesAgainstTheTriggerBuildersClock pins that day-dependent check as intended. The scheduler options table in configuration/reference.md gains DefaultMisfireHandling (4.6, #4131); DefaultTimeZone was already there. StdAdoConstantsTest.SelectedColumns matches SELECT and FROM as whole words, so a column with FROM in its name no longer ends the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lahma
added a commit
that referenced
this pull request
Oct 26, 2026
…nd-after-count zone, recovery markers, and the options table CronTriggerImpl.Clone used MemberwiseClone rather than base.Clone(), so its clone shared the original's JobDataMap, which every other trigger type's clone copies: RAMJobStore stores and hands out clones, and a write to one reached the other. TriggerCloneTest holds all five built-in types to a map of their own. Startup recovery's SelectTriggersForRecoveringJobs wrote the FailedJobOriginalTrigger* markers over a replay of a replay, naming the first recovery trigger, where cluster recovery's StoreRecoveryTrigger keeps them. The second replay lost the original group, and with it the execution limit an ungrouped replay counts against (#4148). It now keeps the markers a recovery trigger's map already carries. DailyTimeIntervalScheduleBuilder.EndingDailyAfterCount works out the window's end at build time in InTimeZone's zone or TimeZoneInfo.Local, which the scheduler's DefaultTimeZone (#4146) cannot reach: it is applied when the trigger is stored. Left as it is and documented on the builder and in the default time zone section. Computing it at store time would move it out of the builder for a difference that exists only on a build day the zone changes its clocks, and EndingDailyAfterCountComputesAgainstTheTriggerBuildersClock pins that day-dependent check as intended. The scheduler options table in configuration/reference.md gains DefaultMisfireHandling (4.6, #4131); DefaultTimeZone was already there. StdAdoConstantsTest.SelectedColumns matches SELECT and FROM as whole words, so a column with FROM in its name no longer ends the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 26, 2026
This was referenced Nov 6, 2026
This was referenced Nov 15, 2026
This was referenced Nov 23, 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 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 #4142
Under
UseTriggerGroupWhenUnset, an ungrouped firing is limited under its trigger's group. A recovery trigger's group isRECOVERING_JOBS, so a replayed firing was limited under that group. It ran beside the firings its own group's limit held back, and was missing from that group's in-flight count until it ended. #4084 recorded this as a known limitation inStoreRecoveryTrigger's remarks. This PR closes it.What changed
All three paths that build a recovery trigger (cluster recovery, a shutdown hand-back, startup recovery) already write the original trigger's group into its data map as
FailedJobOriginalTriggerGroup. Each place that resolves a limit key now reads it for an ungrouped trigger in the recovery group:ExecutionLimitsLimitTriggerGroup(TriggerKey, JobDataMap)/(ITrigger),ResolveGroupKeyOf(ITrigger, bool),NeedsOriginalTriggerGroup(…), all internal. TheITriggerform reads the data map only for a trigger in the recovery group, because a trigger's map is allocated on first readQuartzSchedulerThreadResolveGroupKeyOf(trigger, …)RAMJobStoreGroupsAtLimit; the cluster in-flight tally counts reservations and running firings under itStdAdoDelegate.SelectTriggersToAcquireJOB_DATA. Only an ungrouped candidate in the recovery group, under the derivation, costs that read. The binding and the read are split out into two private methodsTriggerAcquireResult.LimitTriggerGroupinit: the group the delegate resolved, whichAdoJobStoreBasenames inGroupsAtLimitAdoJobStoreBaseacquisition(null, RECOVERING_JOBS)pair in the cluster in-flight count is replaced by the recovered firings' own groups. They are read withSelectFireInstancesfiltered to the recovery group, and oneSelectTriggerJobDataMapper ungrouped firingStoreRecoveryTriggerremarksexecution-groups.md; a behaviour row in the 4.6 → 4.7 migration sectionNothing else about
RECOVERING_JOBSchanges: the trigger's key,context.Recovering,RecoveringTriggerKey, matchers and the execution group routing reads are untouched. No public API, schema or SQL statement changed.For the reviewer
UseTriggerGroupWhenUnset/ResolveGroupKeyderivation (checked onorigin/3.xat 31c81b1). An ungrouped firing there is always in the ungrouped bucket, so the gap does not exist. The issue's "3.x has the same gap" does not hold.RECOVERING_JOBS. It resolves fromFireInstanceDto, which carries no data map. That is display only, and left alone.SelectTriggersForRecoveringJobsoverwrites theFailedJobOriginal*markers with the intermediate recovery trigger's, whereStoreRecoveryTriggerkeeps them. Such a firing is still limited underRECOVERING_JOBS. Aligning the two would change what the job reads as its original trigger, so it is not done here.SelectTriggersToAcquireis unaffected; it just keeps keying recovery candidates by their own group.Tests
RecoveredLimitGroupSqliteTest(new, SQLite file, in the style of A recovered trigger keeps its job's execution group #4084'sRecoveredExecutionGroupSqliteTest). One test per path: cluster recovery, shutdown hand-back and startup recovery. With the tenant at 0 slots the replay is held back and the round namestenant-ainGroupsAtLimit; with 1 slot it is acquired. Two more tests:SchedulerLoopExecutionLimitWakeTest.ARecoveredFiringHoldsTheSlotOfTheTriggerGroupItReplays: on the frozen-clock loop harness, a running replay fillsbatch's one slot. The loop hands exactly one firing to the pool before it parks, and the replay's end wakes it for the waitingbatchtrigger.RAMJobStoreClusterLimitTest.ARecoveredFiringInFlightHoldsTheSlotOfTheTriggerGroupItReplays(reserved / started).ExecutionGroupsTest: the resolution itself, plus three cases. A marker on a non-recovery trigger is ignored, a recovery trigger with no marker keeps its own group, and an explicit execution group wins.Each part was disabled in turn and its tests failed:
LimitTriggerGroupoff: the 6 behaviour tests failed.GroupsAtLimitchange reverted and the ledger reverted:ARecoveredFiringInFlightHoldsItsTriggerGroupsClusterSlotfailed, the three per-path tests failed onGroupsAtLimit, and the loop test failed on the thread-pool count.Verification
dotnet fallout VerifyMigrations VerifySchema Compile UnitTest BenchmarkSmoke PublishTrimmed PublishAot VerifyDocsSnippets VerifyDocsLogEvents: every target succeeded. This ran before the rebase onto CronExpressionBuilder leaves an unset seconds field at 0, not * #4144, which touched only the cron builder and the migration guide.After the rebase:
dotnet fallout IntegrationTest --database sqlitegave 37 passed, 0 failed.IntegrationTest --database postgresgave 338 passed, 0 failed. The touched unit fixtures were re-run: 138 passed.markdownlint-cli2on the two changed pages: 0 errors.BenchmarkSmokepassed. The delegate's acquisition read is on the benchmarked path, and no timings were taken.🤖 Generated with Claude Code