Repository navigation
[CRE-7138] Bound timeout-based shard failover executions by execution concurrency - #24259
Merged
Merged
Conversation
Contributor
|
👋 dmitriytymosh, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
product-security-plaid-production
Bot
requested review from
fernandofederico1984,
justinkaseman and
patrickhuie19
November 23, 2026 16:45
Contributor
|
✅ No conflicts with other open PRs targeting |
Contributor
|
few items dropped via dm, mainly:
|
…ecution concurrency
mchain0
previously approved these changes
Nov 24, 2026
mchain0
approved these changes
Nov 24, 2026
mchain0
enabled auto-merge
November 24, 2026 12:43
chudilka1
approved these changes
Nov 24, 2026
bolekk
approved these changes
Nov 24, 2026
| TimeoutBasedFailoverGate: h.engineLimiters.TimeoutBasedFailover, | ||
| TimeoutBasedFailoverWindow: h.engineLimiters.TimeoutBasedFailoverWindow, | ||
| Communicator: h.getShardFailoverComm(), | ||
| ExecutionConcurrency: h.engineLimiters.ExecutionConcurrency, |
Contributor
There was a problem hiding this comment.
We need to be careful to not reuse the same limiter more than once, otherwise we will double-count.
IIUC it's fine here because ShardFailoverManager calls ExecuteTrigger directly. But that might change in the future when we start putting failover events on the trigger queue. Maybe worth leaving a comment here.
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.
CRE-7138
Timeout-based failover on the secondary shard started every due cached event at once.
ExecuteTriggergoes straight tostartExecution, so it skips the trigger event queue andExecutionConcurrency. The number of in-flight executions per tick was unbounded.Changes:
FailoverConfig.ExecutionConcurrency: the manager gets the sameExecutionConcurrencylimiter that the legacy engine and the coordinator use. A nil limiter leaves executions unbounded.executeDueTimeoutBasedFailoverscalls non-blockingUsebefore popping an event. With no free slot, the tick stops and the remaining events stay cached for a later tick. The slot is freed whenExecuteTriggerreturns.Usefails for a reason other than the limit (missing tenant,stopped), the error is logged. The due events stay cached in both cases.platform_shard_failover_deferred_events, labeloutcome:concurrency_limitorlimiter_error. It shows how many due events wait for a slot right now, node-wide, likeplatform_shard_failover_cached_events. The limiter's ownresource.*.deniedis shared with the engine and the coordinator, so it can't tell failover apart.ExecuteTriggerfails, when the event left the cache before the pop, and when the context is cancelled;deferred_eventsfollows the waiting events and drops to 0 on close.Out of scope: SYSTEM_ERROR replay (
replay) is still unbounded.Requires
Supports
Deployment Validation Steps
ExecutionConcurrencylimit, and events over the limit run on later ticks.platform_shard_failover_deferred_events{outcome="concurrency_limit"}is above 0 while the limit is reached and returns to 0 once the events run;limiter_errorshould stay at 0.