Fix that gap can be stuck "in-progress"#221473
Merged
nkhristinin merged 6 commits intoelastic:mainfrom Jun 17, 2025
Merged
Conversation
Contributor
Author
|
/ci |
1 similar comment
Contributor
Author
|
/ci |
Contributor
Author
|
@elasticmachine merge upstream |
Contributor
Author
|
/ci |
Contributor
Author
|
@elasticmachine merge upstream |
Contributor
Author
|
/ci |
Contributor
Author
|
@elasticmachine merge upstream |
Contributor
Author
|
@elasticmachine merge upstream |
Contributor
💚 Build Succeeded
Metrics [docs]
History
|
ymao1
approved these changes
Jun 16, 2025
Contributor
ymao1
left a comment
There was a problem hiding this comment.
Response Ops change LGTM. Code review only.
Contributor
|
Starting backport for target branches: 8.18, 8.19, 9.0 https://github.com/elastic/kibana/actions/runs/15700178150 |
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Jun 17, 2025
## 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)
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Jun 17, 2025
## 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)
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Jun 17, 2025
## 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)
This was referenced Jun 17, 2025
nkhristinin
added a commit
that referenced
this pull request
Jun 17, 2025
# Backport This will backport the following commits from `main` to `9.0`: - Fix that gap can be stuck "in-progress" (#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":"nikita.khristinin@elastic.co"},"sourceCommit":{"committedDate":"2025-06-17T06:47:01Z","message":"Fix that gap can be stuck \"in-progress\" (#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 <elasticmachine@users.noreply.github.com>","sha":"dfd783e12a4046758be75c05bbe36bc105710296"},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[]}] BACKPORT--> Co-authored-by: Khristinin Nikita <nikita.khristinin@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
nkhristinin
added a commit
that referenced
this pull request
Jun 17, 2025
# Backport This will backport the following commits from `main` to `8.18`: - Fix that gap can be stuck "in-progress" (#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":"nikita.khristinin@elastic.co"},"sourceCommit":{"committedDate":"2025-06-17T06:47:01Z","message":"Fix that gap can be stuck \"in-progress\" (#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 <elasticmachine@users.noreply.github.com>","sha":"dfd783e12a4046758be75c05bbe36bc105710296"},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[]}] BACKPORT--> Co-authored-by: Khristinin Nikita <nikita.khristinin@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
nkhristinin
added a commit
that referenced
this pull request
Jun 17, 2025
# Backport This will backport the following commits from `main` to `8.19`: - Fix that gap can be stuck "in-progress" (#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":"nikita.khristinin@elastic.co"},"sourceCommit":{"committedDate":"2025-06-17T06:47:01Z","message":"Fix that gap can be stuck \"in-progress\" (#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 <elasticmachine@users.noreply.github.com>","sha":"dfd783e12a4046758be75c05bbe36bc105710296"},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[]}] BACKPORT--> Co-authored-by: Khristinin Nikita <nikita.khristinin@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
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.
Summary
[Issue](#221111)
Gaps can get stuck in the
in-progressstate 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:
When a backfill starts, we set
in_progress_intervalsto the range that overlaps with the backfill. We also remove that range fromunfilled_intervals:After the backfill is successfully executed, we move the range to
filled_intervalsand clearin_progress_intervals:However, if the backfill fails, we want to remove the range from
in_progress_intervalsand move it back tounfilled_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 tofilled_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_intervalsto 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_intervalsreflect only the remaining active backfills.