Hi Melanie,
Sorry for the late note for the already committed patch, but I have a
question on the last part of the 'heap_xlog_prune_freeze' function
related to the FSM update (it was committed in add323d -'Eliminate
XLOG_HEAP2_VISIBLE from vacuum phase III').
Currently it contains the following logic:
...
Size freespace = 0;
...
if (BufferIsValid(buffer))
{
if ((xlrec.flags & (XLHP_HAS_REDIRECTIONS |
XLHP_HAS_DEAD_ITEMS |
XLHP_HAS_NOW_UNUSED_ITEMS)) ||
(vmflags & VISIBILITYMAP_VALID_BITS))
freespace = PageGetHeapFreeSpace(BufferGetPage(buffer));
...
UnlockReleaseBuffer(buffer);
}
...
if (freespace > 0)
XLogRecordPageWithFreeSpace(rlocator, blkno, freespace);
...
My question is about the last check ('freespace > 0') - do we really
want to call 'XLogRecordPageWithFreeSpace' only if 'freespace' is
greater than 0? As I understand, the zero value is a perfectly valid
output of the 'PageGetHeapFreeSpace' call (i.e. page has no space or no
free line items while we mark all rows as frozen/visible), but with the
current implementation we will skip FSM update in such case. Maybe we
need to use additional flag (i.e. 'need_fsm_update'), set it before
calling 'PageGetHeapFreeSpace' and then check before the
'XLogRecordPageWithFreeSpace' invocation?
Thanks,
Alexey