Re: REPACK (CONCURRENTLY) fails during parallel build of exclusion constraint indexes

From: Zhijie Hou <houzhijie22(at)gmail(dot)com>
To: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Subject: Re: REPACK (CONCURRENTLY) fails during parallel build of exclusion constraint indexes
Date: 2026-12-01 12:35:43
Message-ID: 4780dd45-e68c-4c7b-8063-9c3335079984@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Tue, Dec 1, 2026 at 09:06 AM Chao Li wrote:
>
> I noticed that there are two call sites of index_create_copy(), and after
> this patch, both use INDEX_CREATE_SKIP_BUILD. So I'm thinking that maybe
> index_create_copy() should always skip index building, which may help
> prevent similar bugs in the future. WDYT? For this point, I just wonder
> your opinion, rather than asking you to make this change as part of this
> patch.

Thanks for the comments!

Personally, I'm not in favor of doing that. index_create_copy() is an
exported function, and removing its ability to build the index right
away would restrict the API when future callers or extensions might
still find that useful for cases that don't need extra catalog setup
between creation and build. That said, I wouldn't mind if someone
wants to pursue it separately in case others feel differently.

>
> 3 ```
> + newindex = index_create_copy(NewHeap,
> + INDEX_CREATE_SKIP_BUILD |
> + INDEX_CREATE_SUPPRESS_PROGRESS,
> oldindex, ind->rd_rel->reltablespace,
> newName);
> ```
>
> I think INDEX_CREATE_SUPPRESS_PROGRESS only affects index_build(), so when
> INDEX_CREATE_SKIP_BUILD is specified, INDEX_CREATE_SUPPRESS_PROGRESS becomes
> redundant and can be removed.
That's possible, but for now I prefer to keep the flag to stay
consistent with ReindexRelationConcurrently(), which also passes both
flags to make clear that index_create_copy() should not touch progress
reporting when called under another command.

Other comments have been addressed in the V2 patch.

--
Best Regards,
Zhijie Hou

Attachment Content-Type Size
v2-0001-Fix-parallel-build-of-exclusion-constraint-indexe.patch text/plain 5.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rui Zhao 2026-12-01 12:46:21 Re: improvements / reworks for FDW insert batching
Previous Message Dilip Kumar 2026-12-01 12:07:50 Re: Preserve conflict log table during upgrade