* As noted at the beginning of _bt_binsrch(), an internal page must have
* children, since there must always be a negative infinity downlink
* (there may also be a highkey). In the case of non-rightmost leaf
- * pages, there must be at least a highkey. Deleted pages on replica
- * might contain no items, because page unlink re-initializes
- * page-to-be-deleted. Deleted pages with no items might be on primary
- * too due to preceding recovery, but on primary new deletions can't
- * happen concurrently to amcheck.
+ * pages, there must be at least a highkey. The exceptions are deleted
+ * pages, which contain no items.
*
* This is correct when pages are half-dead, since internal pages are
* never half-dead, and leaf pages must have a high key when half-dead
BTMetaPageData *metad = NULL;
ItemId itemid;
Page page;
+ PageHeader header;
BTPageOpaque opaque;
bool rightsib_is_rightmost;
int targetlevel;
opaque->btpo_flags |= BTP_DELETED;
opaque->btpo.xact = ReadNewTransactionId();
+ /*
+ * Remove the remaining tuples on the page. This keeps things simple for
+ * WAL consistency checking.
+ */
+ header = (PageHeader) page;
+ header->pd_lower = SizeOfPageHeaderData;
+ header->pd_upper = header->pd_special;
+
/* And update the metapage, if needed */
if (BufferIsValid(metabuf))
{
maskopaq = (BTPageOpaque) PageGetSpecialPointer(page);
- if (P_ISDELETED(maskopaq))
- {
- /*
- * Mask page content on a DELETED page since it will be re-initialized
- * during replay. See btree_xlog_unlink_page() for details.
- */
- mask_page_content(page);
- }
- else if (P_ISLEAF(maskopaq))
+ if (P_ISLEAF(maskopaq))
{
/*
* In btree leaf pages, it is possible to modify the LP_FLAGS without