On Wed, Dec 17, 2025 at 2:29 PM Kirill Reshke <[email protected]> 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


Reply via email to