Repository navigation
[-] keep TimescaleDB hypertables in sink migration 01409, fixes #1614 - #1616
Open
pashagolub wants to merge 2 commits into
Open
pashagolub wants to merge 2 commits into
pashagolub wants to merge 2 commits into
Conversation
Coverage Report for CI Build 40083355021Coverage decreased (-0.2%) to 87.643%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
馃挍 - Coveralls |
This branch has not been deployed
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
On TimescaleDB sinks, migration 01409 converted every hypertable into a native partitioned table and dropped its data. Sinks created by pgwatch v4 then failed with
table "X" is already partitioned, because they still used the v4admin.ensure_partition_timescale. Fixes #1614.01409 is an applied migration, and this PR edits its body. That breaks the "never edit migrations" rule on purpose: a later migration can't protect sinks that haven't upgraded yet, because 01409 runs first and drops the data. The name and order stay the same, so sinks that already applied 01409 don't run it again.
Sinks that already ran the broken 01409 are not repaired. Their old data is gone, and recreating the sink is safer.
Evidence
config upgradefrom 6.0.0 on a TimescaleDB sink, the 35 hypertables became 0, all metric tables became native partitioned tables, andwalwent from 1 row to 0.TestMigration_TimescaleHypertablesSurvivewith the guard disabled:ensure_partition_timescale('ts_metric_new')creates a hypertable.go test ./internal/sinks/... ./cmd/...passes, and golangci-lint reports 0 issues.Merge Danger
Door: two-way
Revert the commit to undo it. The only schema change is a
CREATE OR REPLACE FUNCTIONwith the current function body.Blast Radius: TimescaleDB sinks
PostgreSQL sinks run 01409 as before. Sinks on schema 01529 get one new migration, so they need
pgwatch config upgradebefore 6.1.0 starts.