Stop the feed-heartbeat migration claiming a retention sweep that runs - #646
Merged
Conversation
The header said "Retention sweeps prune old ping rows". Nothing prunes this table, or any other entries_* table: the only pruner in the tree is idempotency_pruner.py, which prunes idempotency_keys. A reader sizing the table trusted a bound that does not exist, and rows accumulate without limit. Found while auditing why 2-BM wrote 6568 permit-probe rows during a nine-hour EPICS outage. The replacement also drops the old "BRIN-friendly" aside. This table has no BRIN index; its only index is a (run_id, recorded_at DESC) btree, so a time-range sweep would need its own index first. Comment-only. Editing an applied migration changes atlas.sum, and Atlas chains its hashes, so 17 downstream entries were re-hashed. Verified on a throwaway pg17 container holding the pre-edit hashes: status, apply (with a pending file present, not just the no-op path), and validate all pass. The tradeoff is that `atlas migrate down` now refuses across the 20260621040000..20260810120000 window, reporting the files as modified since applied. That path is a documented emergency escape hatch, not a workflow, and nothing automated calls it. Restore it when convenient with `atlas migrate set 20260621030000` then `atlas migrate set 20260810120000`, which rewrites the revision hashes and executes no SQL. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.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.
The header of
20260621040000_init_entries_run_feed_heartbeats.sqlsaid "Retention sweeps prune old ping rows". Nothing prunes this table, or any otherentries_*table. The only pruner in the tree isidempotency_pruner.py, which prunesidempotency_keys. Rows accumulate without limit, and a reader sizing the table trusted a bound that does not exist.Found while auditing why 2-BM wrote 6568 permit-probe rows during a nine-hour EPICS outage.
The replacement also drops the old "BRIN-friendly" aside. This table has no BRIN index; its only index is a
(run_id, recorded_at DESC)btree, so a time-range sweep would need its own index first.Comment-only, but it touches an applied migration
Atlas chains its hashes, so re-hashing this one file rewrote 17 downstream entries in
atlas.sum. Verified on a throwaway pg17 container holding the pre-edit hashes:atlas migrate statusatlas migrate apply(with a pending file present, not just the no-op path)atlas migrate validateThe tradeoff:
atlas migrate downnow refuses across the20260621040000..20260810120000window, reporting the files as modified since applied. That path is a documented emergency escape hatch rather than a workflow, and nothing automated calls it. It can be restored whenever convenient withatlas migrate set 20260621030000thenatlas migrate set 20260810120000, which rewrites the revision hashes and executes no SQL.No deploy required: no new migration, so
EXPECTED_SCHEMA_VERSIONis unchanged.🤖 Generated with Claude Code