Subject: pgsql: Fix assertion failure in parallel vacuum with minimal maintenanc

From: Masahiko Sawada <[email-masked]>
Date: Tue, 18 Mar 2025 23:38:59 +0000

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 <[email-masked]>
Discussion: https://postgr.es/m/[email-masked]
Backpatch-through: 17

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f4290f20dd4d6f75e01fbb87304c3b8f31d1cfea

Modified Files
--------------
src/backend/access/heap/vacuumlazy.c |  7 +++++--
src/test/regress/expected/vacuum.out | 12 ++++++++++++
src/test/regress/sql/vacuum.sql      | 13 +++++++++++++
3 files changed, 30 insertions(+), 2 deletions(-)