On Mon, Apr 8, 2019 at 12:49 PM Andres Freund <and...@anarazel.de> wrote: > > Hi, > > lazy_scan_heap() contains the following block: > > /* > * If the all-visible page is turned out to be all-frozen but > not > * marked, we should so mark it. Note that all_frozen is > only valid > * if all_visible is true, so we must check both. > */ > else if (all_visible_according_to_vm && all_visible && > all_frozen && > !VM_ALL_FROZEN(onerel, blkno, &vmbuffer)) > { > /* > * We can pass InvalidTransactionId as the cutoff XID > here, > * because setting the all-frozen bit doesn't cause > recovery > * conflicts. > */ > visibilitymap_set(onerel, blkno, buf, > InvalidXLogRecPtr, > vmbuffer, > InvalidTransactionId, > > VISIBILITYMAP_ALL_FROZEN); > } > > but I'm afraid that's not quite enough. As an earlier comment explains: > > > * NB: If the heap page is all-visible but the VM bit > is not set, > * we don't need to dirty the heap page. However, if > checksums > * are enabled, we do need to make sure that the heap > page is > * dirtied before passing it to visibilitymap_set(), > because it > * may be logged. Given that this situation should > only happen in > * rare cases after a crash, it is not worth > optimizing. > */ > PageSetAllVisible(page); > MarkBufferDirty(buf); > visibilitymap_set(onerel, blkno, buf, > InvalidXLogRecPtr, > vmbuffer, > visibility_cutoff_xid, flags); > > don't we need to do that here too?
Thank you for pointing out. I think that the same things are necessary here. Otherwise does it lead the case that the visibility map page is set while the heap page bit is cleared? Regards, -- Masahiko Sawada NIPPON TELEGRAPH AND TELEPHONE CORPORATION NTT Open Source Software Center