ptr += sizeof(spgxlogVacuumRedirect);
itemToPlaceholder = (OffsetNumber *) ptr;
- /*
- * If any redirection tuples are being removed, make sure there are no
- * live Hot Standby transactions that might need to see them. This code
- * behaves similarly to btree's XLOG_BTREE_REUSE_PAGE case.
- */
- if (InHotStandby && TransactionIdIsValid(xldata->newestRedirectXid))
- ResolveRecoveryConflictWithSnapshot(xldata->newestRedirectXid,
- xldata->node);
-
if (!(record->xl_info & XLR_BKP_BLOCK_1))
{
buffer = XLogReadBuffer(xldata->node, xldata->blkno, false);
MemoryContext oldCxt;
/*
- * SP-GiST indexes do not require any conflict processing. NB: If we ever
- * implement a similar optimization as we have in b-tree, and remove
- * killed tuples outside VACUUM, we'll need to handle that here.
+ * If we have any conflict processing to do, it must happen before we
+ * update the page.
*/
+ if (InHotStandby)
+ {
+ switch (info)
+ {
+ case XLOG_SPGIST_VACUUM_REDIRECT:
+ {
+ spgxlogVacuumRedirect *xldata =
+ (spgxlogVacuumRedirect *) XLogRecGetData(record);
+
+ /*
+ * If any redirection tuples are being removed, make sure
+ * there are no live Hot Standby transactions that might
+ * need to see them.
+ */
+ if (TransactionIdIsValid(xldata->newestRedirectXid))
+ ResolveRecoveryConflictWithSnapshot(xldata->newestRedirectXid,
+ xldata->node);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
RestoreBkpBlocks(lsn, record, false);
oldCxt = MemoryContextSwitchTo(opCtx);
out_target(buf, ((spgxlogVacuumRedirect *) rec)->node);
appendStringInfo(buf, "vacuum redirect tuples on page %u, newest XID %u",
((spgxlogVacuumRedirect *) rec)->blkno,
- ((spgxlogVacuumRedirect *) rec)->newestRedirectXid);
+ ((spgxlogVacuumRedirect *) rec)->newestRedirectXid);
break;
default:
appendStringInfo(buf, "unknown spgist op code %u", info);