Do get_indexdef calls while the table is already locked.
These calls can require an access share lock on the table, which might conflict with an existing or later acquires lock. So perform these calls while we already have an exclusive lock on the table. This unfortuantely means that we ave to remove the constness of the table parameter to repack_one_table, as it is not modifying the table object to set up the indexes.
This commit is contained in:
@ -117,16 +117,16 @@ SELECT * FROM tbl_with_dropped_toast;
|
||||
\! pg_repack --dbname=contrib_regression --table=tbl_cluster
|
||||
INFO: repacking table "tbl_cluster"
|
||||
\! pg_repack --dbname=contrib_regression --table=tbl_badindex
|
||||
WARNING: skipping invalid index: CREATE UNIQUE INDEX idx_badindex_n ON tbl_badindex USING btree (n)
|
||||
INFO: repacking table "tbl_badindex"
|
||||
WARNING: skipping invalid index: CREATE UNIQUE INDEX idx_badindex_n ON tbl_badindex USING btree (n)
|
||||
\! pg_repack --dbname=contrib_regression
|
||||
INFO: repacking table "tbl_cluster"
|
||||
INFO: repacking table "tbl_only_pkey"
|
||||
INFO: repacking table "tbl_gistkey"
|
||||
INFO: repacking table "tbl_with_dropped_column"
|
||||
INFO: repacking table "tbl_with_dropped_toast"
|
||||
WARNING: skipping invalid index: CREATE UNIQUE INDEX idx_badindex_n ON tbl_badindex USING btree (n)
|
||||
INFO: repacking table "tbl_badindex"
|
||||
WARNING: skipping invalid index: CREATE UNIQUE INDEX idx_badindex_n ON tbl_badindex USING btree (n)
|
||||
INFO: repacking table "tbl_idxopts"
|
||||
--
|
||||
-- after
|
||||
|
Reference in New Issue
Block a user