feat(cloud-backups): support rotating a non-audit table (metrics_audit)#9
Open
logicflakes wants to merge 1 commit into
Open
feat(cloud-backups): support rotating a non-audit table (metrics_audit)#9logicflakes wants to merge 1 commit into
logicflakes wants to merge 1 commit into
Conversation
Make the entity_name='instances' preflight conditional on the table actually having an entity_name column (columnExistsSQL). It's specific to the generic audit table's frozen-instances semantics; another rotated table -- metrics_audit -- has no such column, so the guard is skipped there instead of erroring on the missing column. audit-table behavior is unchanged (the column exists -> the guard runs as before). Live-verified: rotate+backup of a metrics_audit-shaped table (uuid PK, no entity_name) now passes preflight without --drop-instance-rows. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> ReARM-Agent: 1420896f-adf5-4843-896f-d863cfcc6528 ReARM-Agentic-Session: 7fa98c2d-b192-4b4a-b1a8-ac64349a89b2
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.
What
Lets
pg audit-rotaterotate a table without anentity_namecolumn (e.g.metrics_audit), by making theentity_name='instances'preflight conditional on that column existing (columnExistsSQL).Why
The instances guard is specific to the generic
audittable's frozen-instances semantics (rows still read byInstanceService). Run unconditionally, itsSELECT count(*) … WHERE entity_name='instances'errors on any table lacking the column — blocking rotation ofmetrics_audit. Now: column present → the guard runs + refuses exactly as before; column absent → skipped (there are no such rows to protect).Safety
audit-table behavior is byte-for-byte unchanged (column exists → original count-and-refuse block runs).AUDIT_TABLEis still caught — the upstream ownership/sequence preflights query the table via::regclassand hard-error first.columnis a hardcoded literal).Test
TestColumnExistsSQL; full suite green, gofmt clean.metrics_audit-shaped table (uuid PK, noentity_name) rotates + backs up without--drop-instance-rowsand with no instances error.metrics_audittable → rotate → backup → verify-restore → complete.Pairs with the helm side (rearm-saas: cover metrics_audit with a 2nd cronjob key). Rollout: merge this + build the image before the helm knob is useful.
🤖 Generated with Claude Code