Re: Avoiding deadlock errors in CREATE INDEX CONCURRENTLY - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Avoiding deadlock errors in CREATE INDEX CONCURRENTLY
Date
Msg-id 8370.1560094597@sss.pgh.pa.us
Whole thread Raw
In response to Re: Avoiding deadlock errors in CREATE INDEX CONCURRENTLY  ("Goel, Dhruv" <goeldhru@amazon.com>)
Responses Re: Avoiding deadlock errors in CREATE INDEX CONCURRENTLY
List pgsql-hackers
"Goel, Dhruv" <goeldhru@amazon.com> writes:
> Yes, you are correct. The test case here was that if a tuple is inserted after the reference snapshot is taken in
Phase2 and before the index is marked ready. If this tuple is deleted before the reference snapshot of Phase 3, it will
nevermake it to the index. I have fixed this problem by making pg_index tuple updates transactional (I believe there is
noreason why it has to be in place now) so that the xmin of the pg_index tuple is same the xmin of the snapshot in
Phase3. 

I think you are mistaken that doing transactional updates in pg_index
is OK.  If memory serves, we rely on xmin of the pg_index row for purposes
such as detecting whether a concurrently-created index is safe to use yet.
So a transactional update would restart that clock and result in temporary
denial of service.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Use of reloptions by EXTENSIONs
Next
From: Andres Freund
Date:
Subject: Re: Avoiding deadlock errors in CREATE INDEX CONCURRENTLY