aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorMasahiko Sawada <msawada@postgresql.org>2025-03-18 16:37:02 -0700
committerMasahiko Sawada <msawada@postgresql.org>2025-03-18 16:37:02 -0700
commitf4290f20dd4d6f75e01fbb87304c3b8f31d1cfea (patch)
treed931cecf2880b3035ec2d504ab23da383380bcfd /src/backend
parent6d3ea48ff1aea5fb1ccfed69424bf93a8643b4a4 (diff)
downloadpostgresql-f4290f20dd4d6f75e01fbb87304c3b8f31d1cfea.tar.gz
postgresql-f4290f20dd4d6f75e01fbb87304c3b8f31d1cfea.zip
Fix assertion failure in parallel vacuum with minimal maintenance_work_mem setting.
bbf668d66fbf lowered the minimum value of maintenance_work_mem to 64kB. However, in parallel vacuum cases, since the initial underlying DSA size is 256kB, it attempts to perform a cycle of index vacuuming and table vacuuming with an empty TID store, resulting in an assertion failure. This commit ensures that at least one page is processed before index vacuuming and table vacuuming begins. Backpatch to 17, where the minimum maintenance_work_mem value was lowered. Reviewed-by: David Rowley <dgrowleyml@gmail.com> Discussion: https://postgr.es/m/CAD21AoCEAmbkkXSKbj4dB+5pJDRL4ZHxrCiLBgES_g_g8mVi1Q@mail.gmail.com Backpatch-through: 17
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/access/heap/vacuumlazy.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index b1fbfca087e..2cbcf5e5db2 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -1263,9 +1263,12 @@ lazy_scan_heap(LVRelState *vacrel)
* Consider if we definitely have enough space to process TIDs on page
* already. If we are close to overrunning the available space for
* dead_items TIDs, pause and do a cycle of vacuuming before we tackle
- * this page.
+ * this page. However, let's force at least one page-worth of tuples
+ * to be stored as to ensure we do at least some work when the memory
+ * configured is so low that we run out before storing anything.
*/
- if (TidStoreMemoryUsage(vacrel->dead_items) > vacrel->dead_items_info->max_bytes)
+ if (vacrel->dead_items_info->num_items > 0 &&
+ TidStoreMemoryUsage(vacrel->dead_items) > vacrel->dead_items_info->max_bytes)
{
/*
* Before beginning index vacuuming, we release any pin we may