pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Acquire properly session-level lock on new index in REINDEX CONC
Date: Wed, 23 Oct 2019 06:06:01 +0000
Message-ID: <E1iN9mT-0005sr-4i@gemulon.postgresql.org> (raw)

Acquire properly session-level lock on new index in REINDEX CONCURRENTLY

In the first transaction run for REINDEX CONCURRENTLY, a thinko in the
existing logic caused two session locks to be taken on the old index,
causing the session lock on the newly-created index to be missed.  This
made possible concurrent DDL commands (like ALTER INDEX) on the new
index while REINDEX CONCURRENTLY was processing from the point where the
first internal transaction committed.

This issue has been discovered while digging into another bug.

Author: Michael Paquier
Discussion: https://postgr.es/m/20191021074323.GB1869@paquier.xyz
Backpatch-through: 12

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5d3500da72611018f2280d6a31e58ccdb4b16152

Modified Files
--------------
src/backend/commands/indexcmds.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1iN9mT-0005sr-4i@gemulon.postgresql.org>
Permalink:  ../E1iN9mT-0005sr-4i@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1iN9mT-0005sr-4i@gemulon.postgresql.org

 · 

reply

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: michael@paquier.xyz
  Subject: Re: pgsql: Acquire properly session-level lock on new index in REINDEX CONC
  In-Reply-To: <E1iN9mT-0005sr-4i@gemulon.postgresql.org>
  References: <E1iN9mT-0005sr-4i@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