aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/heap
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2020-03-21 09:38:26 -0700
committerNoah Misch <noah@leadboat.com>2020-03-21 09:38:30 -0700
commit88b3a6cd262344f5de64eab31804a0f39a7c6337 (patch)
treece7bbd85fc067a8ac04fab7e7323e1b1e6bebf1f /src/backend/access/heap
parentb35017549ce1253de0580ec618cdc9020f4b5e05 (diff)
downloadpostgresql-88b3a6cd262344f5de64eab31804a0f39a7c6337.tar.gz
postgresql-88b3a6cd262344f5de64eab31804a0f39a7c6337.zip
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
Diffstat (limited to 'src/backend/access/heap')
-rw-r--r--src/backend/access/heap/tuptoaster.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/access/heap/tuptoaster.c b/src/backend/access/heap/tuptoaster.c
index 55d6e91d1c3..3a9d2ff38ed 100644
--- a/src/backend/access/heap/tuptoaster.c
+++ b/src/backend/access/heap/tuptoaster.c
@@ -1436,8 +1436,8 @@ toast_get_valid_index(Oid toastoid, LOCKMODE lock)
validIndexOid = RelationGetRelid(toastidxs[validIndex]);
/* Close the toast relation and all its indexes */
- toast_close_indexes(toastidxs, num_indexes, lock);
- table_close(toastrel, lock);
+ toast_close_indexes(toastidxs, num_indexes, NoLock);
+ table_close(toastrel, NoLock);
return validIndexOid;
}