-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flag for stopping repack when invalid index is found (#336)
* Added a CLI flag for failing immediately on incorrect index By default, we treat incorrect index as a warning. It may lead to index corruption. Corruption happens when repacking is interrupted, then some data written, and then repack is done fully. When --error-on-incorrect-index flag is used, second repack will fail, so no indexes will be corrupted. * Added regression test for --error-on-invalid-index flag * Added --error-on-invalid-index flag info to README
- Loading branch information
Showing
7 changed files
with
106 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-- | ||
-- do repack | ||
-- | ||
\! pg_repack --dbname=contrib_regression --table=tbl_cluster --error-on-invalid-index | ||
INFO: repacking table "public.tbl_cluster" | ||
\! pg_repack --dbname=contrib_regression --table=tbl_badindex --error-on-invalid-index | ||
INFO: repacking table "public.tbl_badindex" | ||
WARNING: Invalid index: CREATE UNIQUE INDEX idx_badindex_n ON public.tbl_badindex USING btree (n) | ||
\! pg_repack --dbname=contrib_regression --error-on-invalid-index | ||
INFO: repacking table "public.tbl_badindex" | ||
WARNING: Invalid index: CREATE UNIQUE INDEX idx_badindex_n ON public.tbl_badindex USING btree (n) | ||
INFO: repacking table "public.tbl_cluster" | ||
INFO: repacking table "public.tbl_gistkey" | ||
INFO: repacking table "public.tbl_idxopts" | ||
INFO: repacking table "public.tbl_only_pkey" | ||
INFO: repacking table "public.tbl_order" | ||
INFO: repacking table "public.tbl_storage_plain" | ||
INFO: repacking table "public.tbl_with_dropped_column" | ||
INFO: repacking table "public.tbl_with_dropped_toast" | ||
INFO: repacking table "public.tbl_with_mod_column_storage" | ||
INFO: repacking table "public.tbl_with_toast" |
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,11 @@ | ||
-- | ||
-- do repack | ||
-- | ||
\! pg_repack --dbname=contrib_regression --table=tbl_cluster --error-on-invalid-index | ||
INFO: repacking table "public.tbl_cluster" | ||
\! pg_repack --dbname=contrib_regression --table=tbl_badindex --error-on-invalid-index | ||
INFO: repacking table "public.tbl_badindex" | ||
WARNING: Invalid index: CREATE UNIQUE INDEX idx_badindex_n ON public.tbl_badindex USING btree (n) | ||
\! pg_repack --dbname=contrib_regression --error-on-invalid-index | ||
INFO: repacking table "public.tbl_badindex" | ||
WARNING: Invalid index: CREATE UNIQUE INDEX idx_badindex_n ON public.tbl_badindex USING btree (n) |
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,7 @@ | ||
-- | ||
-- do repack | ||
-- | ||
|
||
\! pg_repack --dbname=contrib_regression --table=tbl_cluster --error-on-invalid-index | ||
\! pg_repack --dbname=contrib_regression --table=tbl_badindex --error-on-invalid-index | ||
\! pg_repack --dbname=contrib_regression --error-on-invalid-index |