aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/cluster.c
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
commit4433c6e8c0a5d0891c9bb52d14e73464086c0375 (patch)
tree81a54d9f8a2059f4539eb0e680a790870f3cfa6a /src/backend/commands/cluster.c
parent03e99a674979b6143e0917243fe9517fede278a2 (diff)
downloadpostgresql-4433c6e8c0a5d0891c9bb52d14e73464086c0375.tar.gz
postgresql-4433c6e8c0a5d0891c9bb52d14e73464086c0375.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/commands/cluster.c')
-rw-r--r--src/backend/commands/cluster.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 0112a872241..0a425e10186 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -1652,7 +1652,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
/* Get the associated valid index to be renamed */
toastidx = toast_get_valid_index(newrel->rd_rel->reltoastrelid,
- AccessShareLock);
+ NoLock);
/* rename the toast table ... */
snprintf(NewToastName, NAMEDATALEN, "pg_toast_%u",