You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Backport
This will backport the following commits from `main` to `8.18`:
- Fix that gap can be stuck "in-progress" (elastic#221473) (dfd783e)
<!--- Backport version: 9.6.6 -->
### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)
<!--BACKPORT [{"author":{"name":"Khristinin
Nikita","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-06-17T06:47:01Z","message":"Fix
that gap can be stuck \"in-progress\" (elastic#221473)\n\n##
Summary\n\n\n[[Issue](https://github.com/elastic/kibana/issues/221111)](https://github.com/elastic/kibana/issues/221111)\n\nGaps
can get stuck in the `in-progress` state if a rule is\nbackfill-executed
with failures.\n\n### Current behavior:\n\nLet's say we have a gap from
`12:00–13:00`.\n\nWhen the gap is initially detected, it has the
following state:\n\n```\nfilled_intervals: []\nunfilled_intervals:
[12:00–13:00]\nin_progress_intervals: []\n```\n\nWhen a backfill starts,
we set `in_progress_intervals` to the range that\noverlaps with the
backfill. We also remove that range
from\n`unfilled_intervals`:\n\n```\nfilled_intervals:
[]\nunfilled_intervals: []\nin_progress_intervals:
[12:00–13:00]\n```\n\nAfter the backfill is successfully executed, we
move the range to\n`filled_intervals` and clear
`in_progress_intervals`:\n\n```\nfilled_intervals:
[12:00–13:00]\nunfilled_intervals: []\nin_progress_intervals:
[]\n```\n\nHowever, if the backfill fails, we want to remove the range
from\n`in_progress_intervals` and move it back to `unfilled_intervals`.
The\nproblem is that we cannot simply do this because there might be
other\noverlapping backfills still in progress for the same gap. In the
case of\na successful execution, this isn’t an issue, as the range is
moved to\n`filled_intervals`.\n\nWhen a backfill fails, we refetch all
overlapping backfills for the gap\nto recalculate the
`in_progress_intervals`.\n\n### Problem\n\nIn the current
implementation, we're updating the gaps **before**\ndeleting the failed
backfill. This causes the recalculated\n`in_progress_intervals` to still
include the failed backfill’s range,\nresulting in a stale state.\n\n###
Fix\n\nWe should **first delete** the failed backfill, and **then**
update the\ngap. This ensures that the recalculated
`in_progress_intervals` reflect\nonly the remaining active
backfills.\n\n---------\n\nCo-authored-by: Elastic Machine
<[email protected]>","sha":"dfd783e12a4046758be75c05bbe36bc105710296"},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[]}]
BACKPORT-->
Co-authored-by: Khristinin Nikita <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
0 commit comments