Skip to content

Report nothing pending for a disabled alert - #38279

Merged
manerow merged 5 commits into
mainfrom
fix/disabled-alert-position
Nov 24, 2026
Merged

manerow merged 5 commits into
mainfrom
fix/disabled-alert-position

Conversation

@manerow

@manerow manerow commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #38280

Problem. A disabled alert has no job, so its saved position never moves. When it is enabled again the backlog is skipped (skipBacklog), so events from the time it was off are never sent. But while it stayed off, every reader of "what is unread" counted from the saved position: "500+" pending on its page, unprocessed events in its diagnostics, a growing lag, and processedEvents false. None of it would ever be sent.

A disabled alert gets such a row in two ways:

  • it ran, then was disabled, and the row stayed where it stopped;
  • it was created disabled and never ran, but 2.0.2 to 2.0.x saved a row the first time its page was read, and an upgrade carries that row over.

One customer alert of the second kind was 78k events behind; opening its page ran the server out of memory before the 500 cap.

Fix. A disabled alert is now reported as not running. Every one of these readers goes through AlertProgress.of, which for a disabled alert reports nothing pending or unread and "processed all events" true, since enabling it starts from the latest event. Diagnostics still show the real stored currentOffset and startingOffset, because support needs them. What it delivered or failed before is still counted. The row is not touched, and enabling still calls skipBacklog, so only new events are sent.

So that a disabled alert does not look like a healthy idle one, eventsRecord and diagnosticInfo now return enabled, the same field the alert and /scheduling already carry. The change is additive: counts stay numbers, and no new status value is added. The schema descriptions now say pending means events the alert will still process.

Why this design.

  • Moving the row when the alert is disabled is not enough, because events keep arriving while it is off.
  • The rule checks the alert's own enabled flag on every read. Alerts already disabled today are fixed with no migration, whichever way their row was written.
  • It reads only database rows and keeps nothing in memory, so it holds on every replica. That is why PR #24866 moved the position into the database.
  • On main, reading never writes a position. Only scheduling an enabled alert, its ticks and skipBacklog write one.

The rule is recorded in docs/decisions/2026-11-19-a-disabled-alert-has-nothing-pending.md.

Known gap. Between the save that enables an alert and its skipBacklog, a reader can briefly see the old backlog. The 500 cap bounds the cost.

Type of change:

  • Bug fix

High-level design:

N/A, small change.

Tests:

Use cases covered

  • A disabled alert, whether it ran before or was created disabled with a row an older release wrote, reports enabled: false and nothing pending on eventsRecord, diagnosticInfo, scheduling and processedEvents, and its stored offsets in diagnostics.
  • An enabled alert reports enabled: true and its stored offsets.
  • Once enabled, it delivers only what happens from then on.
  • Reading an alert created disabled writes no position.

Unit tests

  • AlertProgressTest (new): a disabled alert has nothing pending, never counts or lists change events, reports where it stopped and keeps what it handled. An enabled alert still reads from its position.

Backend integration tests

  • AlertDeliveryIT: both shapes above, end to end over REST, then enabling and delivering.

Local Java test run: PASSED

  • Commit: 376aaa1ef254 (base origin/main)
  • Finished: 2026-11-20 09:00 UTC · 4.7 min
  • Scope: focused; merge readiness is not established. Broader steps deferred: 3 (run --scope full).
Step Scope Classes Tests Failed Skipped Min Result
unit openmetadata-service (2 classes) 2 6 0 0 1.1 passed
integration mysql-elasticsearch · parallel 3 22 0 0 3.6 passed

Playwright (UI) tests

Not applicable, no UI change.

Manual testing performed

None beyond the tests above.

UI screen recording:

Not applicable, backend only.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: I reviewed the final diff against REVIEW.md.
  • Decision check: the rule is recorded under docs/decisions/.
  • I have added a test that covers the exact scenario we are fixing.

RetriggerView in GreptileConfidence Score: 5/5

The reviewed changes appear safe to merge.

Summary

Disabled alerts report nothing pending while diagnostics keep their stored offsets.

  • Disabled alerts show no events waiting to be sent.
  • Alert progress responses show whether each alert is enabled.

Reviews (9) · Last reviewed commit: "Say a disabled alert is not running and ..." · Reviewed by Greptile

@manerow
manerow requested a review from a team as a code owner November 20, 2026 07:39
@manerow
manerow requested a review from yan-3005 November 20, 2026 07:39
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@manerow manerow added the safe to test Add this label to run secure Github workflows on PRs label Nov 20, 2026
@gitar-bot

gitar-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Treating disabled alerts as having no pending events changes diagnostics and counts, so clients may stop seeing backlog while alerts are off.

Disabled alerts now report as not running, with nothing pending or unread and their stored offsets still visible in diagnostics, so enabling them later sends only new events. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@manerow
manerow merged commit de855e5 into main Nov 24, 2026
63 of 67 checks passed
@manerow
manerow deleted the fix/disabled-alert-position branch November 24, 2026 08:31
manerow added a commit that referenced this pull request Nov 24, 2026
…port 2.1 #38279) (#38555)

* Report nothing pending for a disabled alert

* Cover alerts created disabled with a position an older release wrote

* Share the read-nothing progress and test the no-row read

* Keep the raw alert offset getter Collate tests read

* Say a disabled alert is not running and report its stored offsets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A disabled alert reports and loads a backlog of events it will never send

2 participants