Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd80be6f

Browse files
committed
Fix handling of pg_class.relispartition at swap phase in REINDEX CONCURRENTLY
When cancelling REINDEX CONCURRENTLY after swapping the old and newindexes (for example interruption at step 5), the old index remainsaround and is marked as invalid. The old index should also be manuallydroppable to clean up the parent relation from any invalid indexes stillremaining. For a partition index reindexed, pg_class.relispartition wasnot getting updated, causing the index to not be droppable as DROP INDEXwould look for dependencies in a partition tree, which do not existanymore after the swap phase is done.The fix here is simple: when swapping the old and new indexes, make surethat pg_class.relispartition is correctly switched, similarly to what isdone for the index name.Reported-by: Justin PryzbyAuthor: Michael PaquierDiscussion:https://postgr.es/m/20191015164047.GA22729@telsasoft.comBackpatch-through: 12
1 parent8b7a0f1 commitd80be6f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎src/backend/catalog/index.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1462,6 +1462,7 @@ index_concurrently_swap(Oid newIndexId, Oid oldIndexId, const char *oldName)
14621462
newIndexTuple;
14631463
Form_pg_indexoldIndexForm,
14641464
newIndexForm;
1465+
boolisPartition;
14651466
OidindexConstraintOid;
14661467
List*constraintOids=NIL;
14671468
ListCell*lc;
@@ -1491,8 +1492,10 @@ index_concurrently_swap(Oid newIndexId, Oid oldIndexId, const char *oldName)
14911492
namestrcpy(&newClassForm->relname,NameStr(oldClassForm->relname));
14921493
namestrcpy(&oldClassForm->relname,oldName);
14931494

1494-
/* Copy partition flag to track inheritance properly */
1495+
/* Swap the partition flags to track inheritance properly */
1496+
isPartition=newClassForm->relispartition;
14951497
newClassForm->relispartition=oldClassForm->relispartition;
1498+
oldClassForm->relispartition=isPartition;
14961499

14971500
CatalogTupleUpdate(pg_class,&oldClassTuple->t_self,oldClassTuple);
14981501
CatalogTupleUpdate(pg_class,&newClassTuple->t_self,newClassTuple);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp