aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gist/gistxlog.c
diff options
context:
space:
mode:
authorPeter Geoghegan <pg@bowt.ie>2022-11-17 14:55:08 -0800
committerPeter Geoghegan <pg@bowt.ie>2022-11-17 14:55:08 -0800
commit1489b1ce728248e04da72aa32f87e9a634ebf9b8 (patch)
tree4a95eb7c2ffc0424f8805056c36b3493019313be /src/backend/access/gist/gistxlog.c
parent6ff5aa129933fbde034c0d21c28cf05e052511f9 (diff)
downloadpostgresql-1489b1ce728248e04da72aa32f87e9a634ebf9b8.tar.gz
postgresql-1489b1ce728248e04da72aa32f87e9a634ebf9b8.zip
Standardize rmgrdesc recovery conflict XID output.
Standardize on the name snapshotConflictHorizon for all XID fields from WAL records that generate recovery conflicts when in hot standby mode. This supersedes the previous latestRemovedXid naming convention. The new naming convention places emphasis on how the values are actually used by REDO routines. How the values are generated during original execution (details of which vary by record type) is deemphasized. Users of tools like pg_waldump can now grep for snapshotConflictHorizon to see all potential sources of recovery conflicts in a standardized way, without necessarily having to consider which specific record types might be involved. Also bring a couple of WAL record types that didn't follow any kind of naming convention into line. These are heapam's VISIBLE record type and SP-GiST's VACUUM_REDIRECT record type. Now every WAL record whose REDO routine calls ResolveRecoveryConflictWithSnapshot() passes through the snapshotConflictHorizon field from its WAL record. This is follow-up work to the refactoring from commit 9e540599 that made FREEZE_PAGE WAL records use a standard snapshotConflictHorizon style XID cutoff. No bump in XLOG_PAGE_MAGIC, since the underlying format of affected WAL records doesn't change. Author: Peter Geoghegan <pg@bowt.ie> Reviewed-By: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/CAH2-Wzm2CQUmViUq7Opgk=McVREHSOorYaAjR1ZpLYkRN7_dPw@mail.gmail.com
Diffstat (limited to 'src/backend/access/gist/gistxlog.c')
-rw-r--r--src/backend/access/gist/gistxlog.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/backend/access/gist/gistxlog.c b/src/backend/access/gist/gistxlog.c
index 998befd2cbb..cb5affa3d27 100644
--- a/src/backend/access/gist/gistxlog.c
+++ b/src/backend/access/gist/gistxlog.c
@@ -195,7 +195,7 @@ gistRedoDeleteRecord(XLogReaderState *record)
XLogRecGetBlockTag(record, 0, &rlocator, NULL, NULL);
- ResolveRecoveryConflictWithSnapshot(xldata->latestRemovedXid,
+ ResolveRecoveryConflictWithSnapshot(xldata->snapshotConflictHorizon,
rlocator);
}
@@ -388,14 +388,14 @@ gistRedoPageReuse(XLogReaderState *record)
* PAGE_REUSE records exist to provide a conflict point when we reuse
* pages in the index via the FSM. That's all they do though.
*
- * latestRemovedXid was the page's deleteXid. The
+ * snapshotConflictHorizon was the page's deleteXid. The
* GlobalVisCheckRemovableFullXid(deleteXid) test in gistPageRecyclable()
* conceptually mirrors the PGPROC->xmin > limitXmin test in
* GetConflictingVirtualXIDs(). Consequently, one XID value achieves the
* same exclusion effect on primary and standby.
*/
if (InHotStandby)
- ResolveRecoveryConflictWithSnapshotFullXid(xlrec->latestRemovedFullXid,
+ ResolveRecoveryConflictWithSnapshotFullXid(xlrec->snapshotConflictHorizon,
xlrec->locator);
}
@@ -597,7 +597,7 @@ gistXLogAssignLSN(void)
* Write XLOG record about reuse of a deleted page.
*/
void
-gistXLogPageReuse(Relation rel, BlockNumber blkno, FullTransactionId latestRemovedXid)
+gistXLogPageReuse(Relation rel, BlockNumber blkno, FullTransactionId deleteXid)
{
gistxlogPageReuse xlrec_reuse;
@@ -610,7 +610,7 @@ gistXLogPageReuse(Relation rel, BlockNumber blkno, FullTransactionId latestRemov
/* XLOG stuff */
xlrec_reuse.locator = rel->rd_locator;
xlrec_reuse.block = blkno;
- xlrec_reuse.latestRemovedFullXid = latestRemovedXid;
+ xlrec_reuse.snapshotConflictHorizon = deleteXid;
XLogBeginInsert();
XLogRegisterData((char *) &xlrec_reuse, SizeOfGistxlogPageReuse);
@@ -672,12 +672,12 @@ gistXLogUpdate(Buffer buffer,
*/
XLogRecPtr
gistXLogDelete(Buffer buffer, OffsetNumber *todelete, int ntodelete,
- TransactionId latestRemovedXid)
+ TransactionId snapshotConflictHorizon)
{
gistxlogDelete xlrec;
XLogRecPtr recptr;
- xlrec.latestRemovedXid = latestRemovedXid;
+ xlrec.snapshotConflictHorizon = snapshotConflictHorizon;
xlrec.ntodelete = ntodelete;
XLogBeginInsert();
@@ -685,7 +685,8 @@ gistXLogDelete(Buffer buffer, OffsetNumber *todelete, int ntodelete,
/*
* We need the target-offsets array whether or not we store the whole
- * buffer, to allow us to find the latestRemovedXid on a standby server.
+ * buffer, to allow us to find the snapshotConflictHorizon on a standby
+ * server.
*/
XLogRegisterData((char *) todelete, ntodelete * sizeof(OffsetNumber));