v1-0003-In-TrimCLOG-don-t-reset-XactCtl-shared-latest_pag.patch

application/octet-stream

Filename: v1-0003-In-TrimCLOG-don-t-reset-XactCtl-shared-latest_pag.patch
Type: application/octet-stream
Part: 0
Message: cleaning up a few CLOG-related things

Patch

Format: format-patch
Series: patch v1-0003
Subject: In TrimCLOG(), don't reset XactCtl->shared->latest_page_number.
File+
src/backend/access/transam/clog.c 0 5
From aebab6ae8726b968b63e2079f84d751e5341fb4f Mon Sep 17 00:00:00 2001
From: Robert Haas <rhaas@postgresql.org>
Date: Mon, 25 Jan 2021 11:18:44 -0500
Subject: [PATCH v1 3/4] In TrimCLOG(), don't reset
 XactCtl->shared->latest_page_number.

Since the CLOG page number is not recorded directly in the checkpoint
record, we have to use ShmemVariableCache->nextXid to figure out the
latest CLOG page number at the start of recovery. However, as recovery
progresses, replay of CLOG/EXTEND records will update our notion of
the latest page number, and we should rely on that being accurate
rather than recomputing the value based on an updated notion of
nextXid. ShmemVariableCache->nextXid is only an approximation
during recovery anyway, whereas CLOG/EXTEND records are an
authoritative representation of how the SLRU has been updated.

Commit [ INSERT COMMIT ID FOR 0002 HERE ] makes this
simplification possible, as before that change clog_redo() might
have injected a bogus value here, and we'd want to get rid of
that before entering normal running.
---
 src/backend/access/transam/clog.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index 5ae962b86e..6fa4713fb4 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -773,11 +773,6 @@ TrimCLOG(void)
 
 	LWLockAcquire(XactSLRULock, LW_EXCLUSIVE);
 
-	/*
-	 * Re-Initialize our idea of the latest page number.
-	 */
-	XactCtl->shared->latest_page_number = pageno;
-
 	/*
 	 * Zero out the remainder of the current clog page.  Under normal
 	 * circumstances it should be zeroes already, but it seems at least
-- 
2.24.3 (Apple Git-128)