fix(db): audit partition catalog before creation - #6515
Open
Areson wants to merge 2 commits into
Open
Conversation
Co-authored-by: Ian Oberst <ioberst@squareup.com> Signed-off-by: Ian Oberst <ioberst@squareup.com> Co-authored-by: Codex <noreply@openai.com> Ai-assisted: true
Audit child-only row triggers on every routable descendant leaf, qualifying nested leaves the same way missing triggers are qualified. Add a Postgres regression test that fails when extra-trigger parity only looks at the immediate root child. Co-authored-by: coder 0 <d97ebdbb198c7237c94f84ea8bb8a73583ea067407eebd0062abbb3962527fb1@buzz.block.builderlab.xyz> Signed-off-by: coder 0 <d97ebdbb198c7237c94f84ea8bb8a73583ea067407eebd0062abbb3962527fb1@buzz.block.builderlab.xyz>
bradseiler
approved these changes
Aug 22, 2026
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.
Why
The partition manager checks partition existence by name only and treats Postgres 42P17 "would overlap partition" errors as success. On databases where a catch-all partition (
events_p_future/delivery_log_p_future) covers future months, the monthly creation path silently does nothing while real coverage erodes toward a write outage. There is currently no visibility into partition catalog health and no signal before writes start failing.What
buzz-db(partition.rs): classifies the live partition catalog foreventsanddelivery_logviapg_inheritsand bound parsing — coverage bounds, catch-all detection, anomalous children, and trigger parity checked recursively down to routable leaf partitions.BUZZ_PARTITION_MANAGER_CREATE_ENABLEDkill switch (defaulttrue).buzz_partition_serving_safe,buzz_partition_uncovered_months(audit window is now through +3 months),buzz_partition_catch_all_covered_months,buzz_partition_anomalous_children,buzz_partition_trigger_parity_missing/_extra,buzz_partition_audit_duration_seconds,buzz_partition_audit_runs_total{outcome},buzz_partition_audit_failures_total,buzz_partition_create_attempts_total, andbuzz_partition_audit_last_success_timestamp_secondsfor staleness alerting./_readinessnow includes partition serving-safety. It serves from the last successful audit and fails only when no partition covers the current time (or before the first successful audit completes at boot). An audit-path failure alone never fails readiness — that is surfaced through the failure counter and the last-success timestamp instead, so a monitoring-path outage cannot take serving pods out of rotation while coverage is provably fine.Behavior changes & risk
BUZZ_PARTITION_MANAGER_CREATE_ENABLED=falseto disable the creation path while keeping the audit and metrics.Validation
ENABLE ALWAYSparent, disabled nested leaf clone in a multi-level layout, healthy-catalog zero-parity checks). Each new regression was verified to fail against the previous logic before the fix.buzz-dbandbuzz-relaytest suites green at this head;cargo clippy --all-targets -- -D warningsclean.Follow-up work (separate PRs): bounded catch-all advance (empty-only golden path; non-empty reattach only behind an explicit operator flag, default off), fresh-install convergence, and a proactive coverage-runway readiness threshold.
Update — 2026-08-21
{leaf}:{trigger}under the owning root child.