]> git.ipfire.org Git - thirdparty/postgresql.git/commit
During heap rebuild, lock any TOAST index until end of transaction.
authorNoah Misch <noah@leadboat.com>
Sat, 21 Mar 2020 16:38:26 +0000 (09:38 -0700)
committerNoah Misch <noah@leadboat.com>
Sat, 21 Mar 2020 16:38:34 +0000 (09:38 -0700)
commit78a34c68920a544292d54f60af561c267b95f64d
treeda395b1a4819610e9ee1f96c50e16fadfad867fb
parent40348680003d637e2068fd4981216f51bff8762b
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
src/backend/access/heap/tuptoaster.c
src/backend/commands/cluster.c