* cannot get past a reader that is on, or due to visit, any page we are
* going to delete. New incoming readers will block behind our metapage
* lock and then see a fully updated page list.
+ *
+ * No full-page images are taken of the deleted pages. Instead, they are
+ * re-initialized as empty, deleted pages. Their right-links don't need to
+ * be preserved, because no new readers can see the pages, as explained
+ * above.
*/
for (i = 0; i < data->ndeleted; i++)
{
- Buffer buffer = XLogReadBuffer(data->node, data->toDelete[i], false);
+ Buffer buffer;
+ Page page;
- if (BufferIsValid(buffer))
- {
- Page page = BufferGetPage(buffer);
-
- if (!XLByteLE(lsn, PageGetLSN(page)))
- {
- GinPageGetOpaque(page)->flags = GIN_DELETED;
+ buffer = XLogReadBuffer(data->node, data->toDelete[i], true);
+ page = BufferGetPage(buffer);
+ GinInitBuffer(buffer, GIN_DELETED);
- PageSetLSN(page, lsn);
- PageSetTLI(page, ThisTimeLineID);
- MarkBufferDirty(buffer);
- }
+ PageSetLSN(page, lsn);
+ PageSetTLI(page, ThisTimeLineID);
+ MarkBufferDirty(buffer);
- UnlockReleaseBuffer(buffer);
- }
+ UnlockReleaseBuffer(buffer);
}
UnlockReleaseBuffer(metabuffer);
}