Fix assertion failure in parallel vacuum with minimal maintenance_work_mem setting.
authorMasahiko Sawada <msawada@postgresql.org>
Tue, 18 Mar 2025 23:36:59 +0000 (16:36 -0700)
committerMasahiko Sawada <msawada@postgresql.org>
Tue, 18 Mar 2025 23:36:59 +0000 (16:36 -0700)
commita38dce3c4a90aa0facef350bc6a502f31b0cfa31
tree3da04cf108c6cf82067e2d3dc462eaae876e5c2d
parentee578921b60ef9a14eaea54b608549e4f8b14f26
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
src/backend/access/heap/vacuumlazy.c
src/test/regress/expected/vacuum.out
src/test/regress/sql/vacuum.sql