summaryrefslogtreecommitdiff
path: root/src/backend/access/index
diff options
context:
space:
mode:
authorPeter Geoghegan2022-11-17 22:55:08 +0000
committerPeter Geoghegan2022-11-17 22:55:08 +0000
commit1489b1ce728248e04da72aa32f87e9a634ebf9b8 (patch)
tree4a95eb7c2ffc0424f8805056c36b3493019313be /src/backend/access/index
parent6ff5aa129933fbde034c0d21c28cf05e052511f9 (diff)
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 <[email protected]> Reviewed-By: Andres Freund <[email protected]> Discussion: https://postgr.es/m/CAH2-Wzm2CQUmViUq7Opgk=McVREHSOorYaAjR1ZpLYkRN7_dPw@mail.gmail.com
Diffstat (limited to 'src/backend/access/index')
-rw-r--r--src/backend/access/index/genam.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c
index 98af5347b9f..01d08960b48 100644
--- a/src/backend/access/index/genam.c
+++ b/src/backend/access/index/genam.c
@@ -275,14 +275,15 @@ BuildIndexValueDescription(Relation indexRelation,
}
/*
- * Get the latestRemovedXid from the table entries pointed at by the index
- * tuples being deleted using an AM-generic approach.
+ * Get the snapshotConflictHorizon from the table entries pointed to by the
+ * index tuples being deleted using an AM-generic approach.
*
- * This is a table_index_delete_tuples() shim used by index AMs that have
- * simple requirements. These callers only need to consult the tableam to get
- * a latestRemovedXid value, and only expect to delete tuples that are already
- * known deletable. When a latestRemovedXid value isn't needed in index AM's
- * deletion WAL record, it is safe for it to skip calling here entirely.
+ * This is a table_index_delete_tuples() shim used by index AMs that only need
+ * to consult the tableam to get a snapshotConflictHorizon value, and only
+ * expect to delete index tuples that are already known deletable (typically
+ * due to having LP_DEAD bits set). When a snapshotConflictHorizon value
+ * isn't needed in index AM's deletion WAL record, it is safe for it to skip
+ * calling here entirely.
*
* We assume that caller index AM uses the standard IndexTuple representation,
* with table TIDs stored in the t_tid field. We also expect (and assert)
@@ -297,7 +298,7 @@ index_compute_xid_horizon_for_tuples(Relation irel,
int nitems)
{
TM_IndexDeleteOp delstate;
- TransactionId latestRemovedXid = InvalidTransactionId;
+ TransactionId snapshotConflictHorizon = InvalidTransactionId;
Page ipage = BufferGetPage(ibuf);
IndexTuple itup;
@@ -333,7 +334,7 @@ index_compute_xid_horizon_for_tuples(Relation irel,
}
/* determine the actual xid horizon */
- latestRemovedXid = table_index_delete_tuples(hrel, &delstate);
+ snapshotConflictHorizon = table_index_delete_tuples(hrel, &delstate);
/* assert tableam agrees that all items are deletable */
Assert(delstate.ndeltids == nitems);
@@ -341,7 +342,7 @@ index_compute_xid_horizon_for_tuples(Relation irel,
pfree(delstate.deltids);
pfree(delstate.status);
- return latestRemovedXid;
+ return snapshotConflictHorizon;
}