From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix CREATE INDEX CONCURRENTLY for the newest prepared transactio
Date: Sun, 24 Oct 2021 01:40:12 +0000
Message-ID: <E1meSUe-0004Ws-LA@gemulon.postgresql.org> (raw)
Fix CREATE INDEX CONCURRENTLY for the newest prepared transactions.
The purpose of commit 8a54e12a38d1545d249f1402f66c8cde2837d97c was to
fix this, and it sufficed when the PREPARE TRANSACTION completed before
the CIC looked for lock conflicts. Otherwise, things still broke. As
before, in a cluster having used CIC while having enabled prepared
transactions, queries that use the resulting index can silently fail to
find rows. It may be necessary to reindex to recover from past
occurrences; REINDEX CONCURRENTLY suffices. Fix this for future index
builds by making CIC wait for arbitrarily-recent prepared transactions
and for ordinary transactions that may yet PREPARE TRANSACTION. As part
of that, have PREPARE TRANSACTION transfer locks to its dummy PGPROC
before it calls ProcArrayClearTransaction(). Back-patch to 9.6 (all
supported versions).
Andrey Borodin, reviewed (in earlier versions) by Andres Freund.
Discussion: https://postgr.es/m/01824242-AA92-4FE9-9BA7-AEBAFFEA3D0C@yandex-team.ru
Branch
------
REL_12_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/fe5d44a1d38fc6c2a1adddf2eaf28726f93d2399
Modified Files
--------------
contrib/amcheck/t/003_cic_2pc.pl | 188 ++++++++++++++++++++++++++++++++++
src/backend/access/transam/twophase.c | 63 +++++++++++-
src/backend/access/transam/xact.c | 8 +-
src/backend/storage/lmgr/lmgr.c | 7 +-
src/backend/storage/lmgr/lock.c | 105 ++++++++++++++-----
src/backend/utils/cache/inval.c | 14 +++
src/include/access/twophase.h | 2 +
src/include/storage/lock.h | 11 +-
src/test/perl/PostgresNode.pm | 90 ++++++++++++++++
9 files changed, 452 insertions(+), 36 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: noah@leadboat.com
Subject: Re: pgsql: Fix CREATE INDEX CONCURRENTLY for the newest prepared transactio
In-Reply-To: <E1meSUe-0004Ws-LA@gemulon.postgresql.org>
References: <E1meSUe-0004Ws-LA@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox