pgsql: Correct predicate locking for DROP INDEX CONCURRENTLY. - Mailing list pgsql-committers

From Kevin Grittner
Subject pgsql: Correct predicate locking for DROP INDEX CONCURRENTLY.
Date
Msg-id E1TQ3j4-0004Fh-Dc@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Correct predicate locking for DROP INDEX CONCURRENTLY.

For the non-concurrent case there is an AccessExclusiveLock lock
on both the index and the heap at a time during which no other
process is using either, before which the index is maintained and
used for scans, and after which the index is no longer used or
maintained.  Predicate locks can safely be moved from the index to
the related heap relation under the protection of these locks.
This was done prior to the introductin of DROP INDEX CONCURRENTLY
and continues to be done for non-concurrent index drops.

For concurrent index drops, the predicate locks must be moved when
there are no index scans in progress on that index and no more can
subsequently start, and before heap inserts stop maintaining the
index.  As long as these conditions are guaranteed when the
TransferPredicateLocksToHeapRelation() function is called,
stronger locks are not needed for correctness.

Kevin Grittner based on questions by Tom Lane in reviewing the
DROP INDEX CONCURRENTLY patch and in cooperation with Andres
Freund and Simon Riggs.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/4c9d0901f135d724a9f3cfa4140a5afd44b10f08

Modified Files
--------------
src/backend/catalog/index.c |   28 ++++++++++++++++++++++------
1 files changed, 22 insertions(+), 6 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix pg_dump's handling of DROP DATABASE commands in --clean mode
Next
From: Kevin Grittner
Date:
Subject: pgsql: Correct predicate locking for DROP INDEX CONCURRENTLY.