Re: Adding vacuum test case of setting the VM when heap page is unmodified - Mailing list pgsql-hackers

From Melanie Plageman
Subject Re: Adding vacuum test case of setting the VM when heap page is unmodified
Date
Msg-id CAAKRu_Z7-1s=0iEs5VBB+2JwL8aNLUhe=o4dPXdh3FXrNw1Urw@mail.gmail.com
Whole thread Raw
In response to Re: Adding vacuum test case of setting the VM when heap page is unmodified  (Kirill Reshke <reshkekirill@gmail.com>)
List pgsql-hackers
On Wed, Dec 17, 2025 at 2:29 PM Kirill Reshke <reshkekirill@gmail.com> wrote:
>
> I did run a test and this indeed triggers assertion if somebody writes
> something like [0]. Code at [0] works (although never testes) only
> because is passed
> InvalidXLogRecPtr as recptr to visibilitymap_set. Maybe it is worth to
> add comment nearby  this
>
> /*
> * Avoid relying on all_visible_according_to_vm as a proxy for the
> * page-level PD_ALL_VISIBLE bit being set, since it might have become
> * stale -- even when all_visible is set
> */
>
> To explain why is it OK to make conditional MarkBufferDirty?

I actually propose we never do that (because the buffer should always
be dirty anyway, and it isn't too expensive to mark an already dirty
buffer dirty again). I've proposed a refactoring of this code, which
includes comments about this expectation in 0001 on this thread [1]
(which you are also participating in).

I proposed the test separately since it seems independently valuable
but 0001 in [1] contains the same test as the one in this thread
actually.

- Melanie

[1] https://www.postgresql.org/message-id/CAAKRu_Yt6EH5aFSJBm-k7PrNM4bTt56fTRbyU7gqYXe4cW%2BF9g%40mail.gmail.com



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Report oldest xmin source when autovacuum cannot remove tuples
Next
From: Chao Li
Date:
Subject: Re: Add sanity check for duplicate enum values in GUC definitions