pgsql: Better fix for deadlock hazard in CREATE INDEX CONCURRENTLY.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Better fix for deadlock hazard in CREATE INDEX CONCURRENTLY.
Date: 2018-04-18 16:07:55
Message-ID: E1f8pch-0004pk-H5@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Better fix for deadlock hazard in CREATE INDEX CONCURRENTLY.

Commit 54eff5311 did not account for the possibility that we'd have
a transaction snapshot due to default_transaction_isolation being
set high enough to require one. The transaction snapshot is enough
to hold back our advertised xmin and thus risk deadlock anyway.
The only way to get rid of that snap is to start a new transaction,
so let's do that instead. Also throw in an assert checking that we
really have gotten to a state where no xmin is being advertised.

Back-patch to 9.4, like the previous commit.

Discussion: https://postgr.es/m/CAMkU=1ztk3TpQdcUNbxq93pc80FrXUjpDWLGMeVBDx71GHNwZQ@mail.gmail.com

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/94a898f69c8399314c322bb560ea7ddbf877ccba

Modified Files
--------------
src/backend/commands/indexcmds.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2018-04-18 18:12:28 Re: pgsql: Skip full index scan during cleanup of B-tree indexes when possi
Previous Message Heikki Linnakangas 2018-04-18 09:51:47 pgsql: Improve docs for the new INCLUDE directive in CREATE/ALTER TABLE