summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gustafsson <dgustafsson@postgresql.org>2023-04-28 10:30:05 +0200
committerDaniel Gustafsson <dgustafsson@postgresql.org>2023-04-28 10:30:05 +0200
commit4a6603cd4650a335ee38d894d7bbb452b1bf822f (patch)
tree31317110031eea7f044132c8e7d0fae6be99b4c6
parentb72f564d87d10b5e5a91aedec605e48f80cb74ee (diff)
downloadpostgresql-4a6603cd4650a335ee38d894d7bbb452b1bf822f.tar.gz
Fix assertion failure in heap_vacuum_rel
Commit 7d71d3dd08 changed resetting the VacuumFailsafeActive flag to an assertion since the flag is reset before starting vacuuming a relation. This however failed to take recursive calls of vacuum_rel() and vacuum of TOAST tables into consideration. Fix by reverting back to resettting the flag. Author: Masahiko Sawada <sawada.mshk@gmail.com> Reviewed-by: Melanie Plageman <melanieplageman@gmail.com> Reported-by: John Naylor <john.naylor@enterprisedb.com> Discussion: https://postgr.es/m/CAFBsxsFz=GqaG5Ens5aNgVYoV2Y+pfMUijX0ku+CCkWfALwiqg@mail.gmail.com
-rw-r--r--src/backend/access/heap/vacuumlazy.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 0a9ebd22bd..442db3551b 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -389,7 +389,11 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
Assert(params->index_cleanup != VACOPTVALUE_UNSPECIFIED);
Assert(params->truncate != VACOPTVALUE_UNSPECIFIED &&
params->truncate != VACOPTVALUE_AUTO);
- Assert(!VacuumFailsafeActive);
+ /*
+ * While VacuumFailSafeActive is reset to false before calling this, we
+ * still need to reset it here due to recursive calls.
+ */
+ VacuumFailsafeActive = false;
vacrel->consider_bypass_optimization = true;
vacrel->do_index_vacuuming = true;
vacrel->do_index_cleanup = true;