Robert Haas <robertmhaas@gmail.com> writes:
> As far as I can tell, there are basically two viable solutions on the
> table here.
> 1. Every time we observe a page as all-visible, (a) set the
> PD_ALL_VISIBLE bit on the page, without bumping the LSN; (b) set the
> bit in the visibility map page, bumping the LSN as usual, and (c) emit
> a WAL record indicating the relation and block number. On redo of
> this record, set both the page-level bit and the visibility map bit.
> The heap page may hit the disk before the WAL record, but that's OK;
Um, no it isn't. Suppose the heap page gets to disk but we crash before
the WAL record does. Now we have a persistent state where the heap page
is marked PD_ALL_VISIBLE but the corresponding VM bit is not set. The
VM bit will never become set, either, because operations on the heap
page will see PD_ALL_VISIBLE and assume it already is set. This state
of affairs might be acceptable from a correctness standpoint, but not
from a performance standpoint.
regards, tom lane