mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
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
This commit is contained in:
@@ -1000,7 +1000,8 @@ hash_xlog_vacuum_one_page(XLogReaderState *record)
|
||||
RelFileLocator rlocator;
|
||||
|
||||
XLogRecGetBlockTag(record, 0, &rlocator, NULL, NULL);
|
||||
ResolveRecoveryConflictWithSnapshot(xldata->latestRemovedXid, rlocator);
|
||||
ResolveRecoveryConflictWithSnapshot(xldata->snapshotConflictHorizon,
|
||||
rlocator);
|
||||
}
|
||||
|
||||
action = XLogReadBufferForRedoExtended(record, 0, RBM_NORMAL, true, &buffer);
|
||||
|
||||
@@ -360,9 +360,9 @@ _hash_vacuum_one_page(Relation rel, Relation hrel, Buffer metabuf, Buffer buf)
|
||||
|
||||
if (ndeletable > 0)
|
||||
{
|
||||
TransactionId latestRemovedXid;
|
||||
TransactionId snapshotConflictHorizon;
|
||||
|
||||
latestRemovedXid =
|
||||
snapshotConflictHorizon =
|
||||
index_compute_xid_horizon_for_tuples(rel, hrel, buf,
|
||||
deletable, ndeletable);
|
||||
|
||||
@@ -399,7 +399,7 @@ _hash_vacuum_one_page(Relation rel, Relation hrel, Buffer metabuf, Buffer buf)
|
||||
xl_hash_vacuum_one_page xlrec;
|
||||
XLogRecPtr recptr;
|
||||
|
||||
xlrec.latestRemovedXid = latestRemovedXid;
|
||||
xlrec.snapshotConflictHorizon = snapshotConflictHorizon;
|
||||
xlrec.ntuples = ndeletable;
|
||||
|
||||
XLogBeginInsert();
|
||||
@@ -408,8 +408,8 @@ _hash_vacuum_one_page(Relation rel, Relation hrel, Buffer metabuf, Buffer buf)
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* whole buffer, to allow us to find the snapshotConflictHorizon
|
||||
* on a standby server.
|
||||
*/
|
||||
XLogRegisterData((char *) deletable,
|
||||
ndeletable * sizeof(OffsetNumber));
|
||||
|
||||
Reference in New Issue
Block a user