Adding vacuum test case of setting the VM when heap page is unmodified
Melanie Plageman <melanieplageman@gmail.com>
From: Melanie Plageman <melanieplageman@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-12-10T17:51:01Z
Lists: pgsql-hackers
Attachments
- v1-0001-Test-vacuum-setting-VM-for-unmodified-heap-buffer.patch (text/x-patch) patch v1-0001
Hi, While working on a patch to set the VM in the same WAL record as pruning and freezing [1], I discovered we have no test coverage of the case where vacuum phase I sets the VM but no modifications are made to the heap buffer (not even setting PD_ALL_VISIBLE). This can only happen when the VM was somehow removed or destroyed. Currently, we require the heap buffer to be marked dirty even if it is unmodified because we add it to the WAL chain and do not pass REGBUF_NO_CHANGES. (And we require adding it to the WAL chain because we update the freespace map using the heap buffer in recovery). The VM being gone is an uncommon case, so I don't think it makes sense to add special logic to pass REGBUF_NO_CHANGES. However, I do think we should have a test for this case. I added the test to pg_visibility tests because I use pg_truncate_visibility_map(). That seemed better than adding a new test module or something. It doesn't test the extension functionality specifically, but it seems like other tests in pg_visibility.sql also exercise core code. Let me know if this interpretation is off-base. - Melanie [1] https://www.postgresql.org/message-id/CAAKRu_bvkCZ%2BxBzBjujJMkA5STU%2Bb6AtrUUTjcvAH%3DZnnpTtzA%40mail.gmail.com