[8.19] Fix that gap can be stuck "in-progress" (#221473)#224177
Merged
nkhristinin merged 1 commit intoelastic:8.19from Jun 17, 2025
Merged
[8.19] Fix that gap can be stuck "in-progress" (#221473)#224177nkhristinin merged 1 commit intoelastic:8.19from
nkhristinin merged 1 commit intoelastic:8.19from
Conversation
## Summary [[Issue](https://github.com/elastic/kibana/issues/221111)](https://github.com/elastic/kibana/issues/221111) Gaps can get stuck in the `in-progress` state if a rule is backfill-executed with failures. ### Current behavior: Let's say we have a gap from `12:00–13:00`. When the gap is initially detected, it has the following state: ``` filled_intervals: [] unfilled_intervals: [12:00–13:00] in_progress_intervals: [] ``` When a backfill starts, we set `in_progress_intervals` to the range that overlaps with the backfill. We also remove that range from `unfilled_intervals`: ``` filled_intervals: [] unfilled_intervals: [] in_progress_intervals: [12:00–13:00] ``` After the backfill is successfully executed, we move the range to `filled_intervals` and clear `in_progress_intervals`: ``` filled_intervals: [12:00–13:00] unfilled_intervals: [] in_progress_intervals: [] ``` However, if the backfill fails, we want to remove the range from `in_progress_intervals` and move it back to `unfilled_intervals`. The problem is that we cannot simply do this because there might be other overlapping backfills still in progress for the same gap. In the case of a successful execution, this isn’t an issue, as the range is moved to `filled_intervals`. When a backfill fails, we refetch all overlapping backfills for the gap to recalculate the `in_progress_intervals`. ### Problem In the current implementation, we're updating the gaps **before** deleting the failed backfill. This causes the recalculated `in_progress_intervals` to still include the failed backfill’s range, resulting in a stale state. ### Fix We should **first delete** the failed backfill, and **then** update the gap. This ensures that the recalculated `in_progress_intervals` reflect only the remaining active backfills. --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit dfd783e)
Contributor
💚 Build Succeeded
Metrics [docs]
cc @nkhristinin |
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.
Backport
This will backport the following commits from
mainto8.19:Questions ?
Please refer to the Backport tool documentation