Re: CREATE INDEX CONCURRENTLY on partitioned index

Ilya Gladyshev <ilya.v.gladyshev@gmail.com>

From: Ilya Gladyshev <ilya.v.gladyshev@gmail.com>
To: Alexander Pyhalov <a.pyhalov@postgrespro.ru>, Justin Pryzby <pryzby@telsasoft.com>
Cc: pgsql-hackers@lists.postgresql.org, Masahiko Sawada <sawada.mshk@gmail.com>, Michael Paquier <michael@paquier.xyz>, 李杰(慎追) <adger.lj@alibaba-inc.com>, 曾文旌(义从) <wenjing.zwj@alibaba-inc.com>, Alvaro Herrera <alvherre@2ndquadrant.com>
Date: 2024-05-23T21:14:57Z
Lists: pgsql-hackers

Attachments

Hi,

I think it's well worth the effort to revive the patch, so I rebased it 
on master, updated it and will return it back to the commitfest. 
Alexander, Justin feel free to add yourselves as authors

On 29.01.2024 12:43, Alexander Pyhalov wrote:
> Hi.
>
> I've rebased patch on master and it'seems to me there's one more issue -
>
> when we call DefineIndexConcurrentInternal() in partitioned case, it 
> waits for transactions, locking tableId, not tabrelid - heaprelid 
> LockRelId is constructed for parent index relation, not for child 
> index relation.
>
> Attaching fixed version.
>
> Also I'm not sure what to do with locking of child relations. If we 
> don't do anything, you can drop one of the partitioned table childs 
> while CIC is in progress, and get error
>
> ERROR:  cache lookup failed for index 16399
I agree that we need to do something about it, in particular, I think we 
should lock all the partitions inside the transaction that builds the 
catalog entries. Fixed this in the new version.
> If you try to lock all child tables in CIC session, you'll get deadlocks.

Do you mean the deadlock between the transaction that drops a partition 
and the transaction doing CIC? I think this is unavoidable and can be 
reproduced even without partitioning.

Also not sure why a list of children relation was obtained with 
ShareLock that CIC is supposed to avoid not to block writes, changed 
that to ShareUpdateExclusive.

Regards,

Ilya

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix assertion failure with REINDEX and event triggers