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

Commit0ae3b46

Browse files
committed
Improve handling of dropped partitioned indexes for REINDEX INDEX
A REINDEX INDEX done on a partitioned index builds a list of the indexesto work on before processing its partitions in individual transactions.When combined with a DROP of the partitioned index, there was a windowwhere it was possible to see some unexpected "could not open relationwith OID", synonym of relation lookup error. The code was robust enoughto handle the case where the parent relation is missing, but not thecase where an index would be gone missing.This is similar to1d65416.Support for REINDEX on partitioned relations has been introduced ina6642b3, so backpatch down to 14.Author: Fei ChanghongDiscussion:https://postgr.es/m/tencent_6A52106095ACDE55333E3AD33F304C0C3909@qq.comBackpatch-through: 14
1 parent8013850 commit0ae3b46

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

‎src/backend/catalog/index.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3634,7 +3634,24 @@ reindex_index(const ReindexStmt *stmt, Oid indexId,
36343634
* Open the target index relation and get an exclusive lock on it, to
36353635
* ensure that no one else is touching this particular index.
36363636
*/
3637-
iRel=index_open(indexId,AccessExclusiveLock);
3637+
if ((params->options&REINDEXOPT_MISSING_OK)!=0)
3638+
iRel=try_index_open(indexId,AccessExclusiveLock);
3639+
else
3640+
iRel=index_open(indexId,AccessExclusiveLock);
3641+
3642+
/* if index relation is gone, leave */
3643+
if (!iRel)
3644+
{
3645+
/* Roll back any GUC changes */
3646+
AtEOXact_GUC(false,save_nestlevel);
3647+
3648+
/* Restore userid and security context */
3649+
SetUserIdAndSecContext(save_userid,save_sec_context);
3650+
3651+
/* Close parent heap relation, but keep locks */
3652+
table_close(heapRelation,NoLock);
3653+
return;
3654+
}
36383655

36393656
if (progress)
36403657
pgstat_progress_update_param(PROGRESS_CREATEIDX_ACCESS_METHOD_OID,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp