pgsql: During heap rebuild, lock any TOAST index until end of transacti

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: During heap rebuild, lock any TOAST index until end of transacti
Date: 2020-03-21 16:45:57
Message-ID: E1jFhG1-0000Uq-Co@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

During heap rebuild, lock any TOAST index until end of transaction.

swap_relation_files() calls toast_get_valid_index() to find and lock
this index, just before swapping with the rebuilt TOAST index. The
latter function releases the lock before returning. Potential for
mischief is low; a concurrent session can issue ALTER INDEX ... SET
(fillfactor = ...), which is not alarming. Nonetheless, changing
pg_class.relfilenode without a lock is unconventional. Back-patch to
9.5 (all supported versions), because another fix needs this.

Discussion: https://postgr.es/m/20191226001521.GA1772687@rfd.leadboat.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/88b3a6cd262344f5de64eab31804a0f39a7c6337

Modified Files
--------------
src/backend/access/heap/tuptoaster.c | 4 ++--
src/backend/commands/cluster.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2020-03-21 19:04:51 Re: pgsql: Skip WAL for new relfilenodes, under wal_level=minimal.
Previous Message Amit Kapila 2020-03-21 03:27:07 pgsql: Allow page lock to conflict among parallel group members.