From 72aebc7854d24fb8466b45536e41cc3d768cd445 Mon Sep 17 00:00:00 2001 From: Peter Geoghegan Date: Tue, 15 Mar 2022 14:24:12 -0700 Subject: [PATCH v1] Perform final failsafe check before truncation. --- src/backend/access/heap/vacuumlazy.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index 87ab7775a..73336560b 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -2822,7 +2822,13 @@ should_attempt_truncation(LVRelState *vacrel) if (possibly_freeable > 0 && (possibly_freeable >= REL_TRUNCATE_MINIMUM || possibly_freeable >= vacrel->rel_pages / REL_TRUNCATE_FRACTION)) + { + /* Perform a final failsafe check out of an abundance of caution */ + if (lazy_check_wraparound_failsafe(vacrel)) + return false; + return true; + } return false; } -- 2.30.2