forked from timescale/timescaledb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a backport to fix issue timescale#2824. The commit fixes two bugs in the repair scripts that could prevent an update in rare circumstances. For the 1.7.1--1.7.2 repair script: if there were several missing dimension slices in different hypertables with the same column name, the repair script would be confused on what constraint had what type and generate an error. This commit also creates an update repair test that breaks a few tables for pre-1.7.2 versions to ensure that the repair script actually fixes them. This commit adds an extra dimension in the workflow to test updates with repair and run that separately. It also changes the update test scripts to by default run without repair tests and add the additional option `-r` for running repair tests in addition to the normal tests.
- Loading branch information
Showing
9 changed files
with
300 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- This file and its contents are licensed under the Apache License 2.0. | ||
-- Please see the included NOTICE for copyright information and | ||
-- LICENSE-APACHE for a copy of the license. | ||
|
||
-- Re-add the dropped foreign key constraint that was dropped for | ||
-- repair testing. | ||
ALTER TABLE _timescaledb_catalog.chunk_constraint | ||
ADD CONSTRAINT chunk_constraint_dimension_slice_id_fkey | ||
FOREIGN KEY (dimension_slice_id) REFERENCES _timescaledb_catalog.dimension_slice (id); | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
-- This file and its contents are licensed under the Apache License 2.0. | ||
-- Please see the included NOTICE for copyright information and | ||
-- LICENSE-APACHE for a copy of the license. | ||
|
||
\echo **** Missing dimension slices **** | ||
SELECT hypertable_id, | ||
( | ||
SELECT format('%I.%I', schema_name, table_name)::regclass | ||
FROM _timescaledb_catalog.hypertable ht | ||
WHERE ht.id = ch.hypertable_id | ||
) AS hypertable, | ||
chunk_id, | ||
dimension_slice_id, | ||
constraint_name, | ||
attname AS column_name, | ||
pg_get_expr(conbin, conrelid) AS constraint_expr | ||
FROM _timescaledb_catalog.chunk_constraint cc | ||
JOIN _timescaledb_catalog.chunk ch ON cc.chunk_id = ch.id | ||
JOIN pg_constraint ON conname = constraint_name | ||
JOIN pg_namespace ns ON connamespace = ns.oid AND ns.nspname = ch.schema_name | ||
JOIN pg_attribute ON attnum = conkey[1] AND attrelid = conrelid | ||
WHERE dimension_slice_id NOT IN (SELECT id FROM _timescaledb_catalog.dimension_slice); |
Oops, something went wrong.