[*] migrate to time-only partitioning in pg sink#1408
Conversation
d75322a to
5064859
Compare
Coverage Report for CI Build 26195756891Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage decreased (-0.06%) to 85.64%Details
Uncovered Changes
Coverage Regressions7 previously-covered lines in 2 files lost coverage.
Coverage Stats
💛 - Coveralls |
…meTime to EnsureMetricTimePartsExist
…tric_time and simplify to 2-level partitioning
Metrics tables created by older versions used LIST partitioning on the dbname column. Since we now only use RANGE partitioning by time, we need to detect and drop any LIST-partitioned table so the standard logic can recreate it with the new partitioning strategy.
7754158 to
6a7c490
Compare
|
|
What is drop on write? |
97437cf to
84b41b8
Compare
instead of the old drop-on-write behaviour
| EXECUTE format('COMMENT ON TABLE public.%I IS $$pgwatch-generated-metric-lvl$$', metric); | ||
| END IF; | ||
|
|
||
| -- 2. level |
There was a problem hiding this comment.
should we remove this comment?
| &migrator.Migration{ | ||
| Name: "01409 Switch to time-only partitioning", | ||
| Func: func(ctx context.Context, tx pgx.Tx) error { | ||
| _, err := tx.Exec(ctx, `SELECT admin.drop_all_metric_tables()`) |
There was a problem hiding this comment.
Thinking out loud.. What if we make a copy of current measurements with ALTER SCHEMA public RENAME TO backup, then create all new tables with new partitioning and then INSERT INTO public.<new-table> SELECT * FROM backup.<old-table>? Then we keep the data and users are happy
drop_source_partitionsfunction--partition-interval's default to1 dayCloses: #1409
Closes: #1392