On 17.02.2025 21:00, Álvaro Herrera wrote:
On 2025-Feb-17, Andrey Borodin wrote:
BootStrapSlruPage() always calls zerofunc(pageno, false) with second argument
false.
In case of every possible argument (ZeroCLOGPage, ZeroCommitTsPage,
ZeroMultiXactOffsetPage, ZeroMultiXactMemberPage, ZeroSUBTRANSPage) it
means just a call to SimpleLruZeroPage().
I think we can safely replace
+ slotno = (*zerofunc)(pageno, false);
with
+ slotno = SimpleLruZeroPage(pageno);
Thus we will not need zerofunc argument at all.
Good observation. This also suggests another change: because this new
function is used not only for bootstrapping but also during WAL replay,
we can call the new function SimpleLruUnloggedZeroPage() and place it
immediately after SimpleLruZeroPage, instead of at the end of the file.
Created functions BootStrapSlruPage,SimpleLruZeroAndLogPage,
WriteSlruZeroPageXlogRec. Using of these functions allows to delete
ZeroXYZPage functions, WriteXYZZeroPageXlogRec functions and eliminate
code repetitions.
The conception is:
/*
* BootStrapSlruPage,
* SimpleLruZeroAndLogPage,
* SimpleLruZeroPage
* - functions nullifying SLRU pages.
*
* BootStrapSlruPage is the most holistic. It performs:
* 1. locking,
* 2. nullifying,
* 3. logging (when writeXlog is true),
* 4. writing out,
* 5. releasing the lock.
*
* SimpleLruZeroAndLogPage performs:
* 2. nullifying,
* 3. logging (when writeXlog is true),
* 4. writing out.
*
* If the writeXlog is true, BootStrapSlruPage and SimpleLruZeroAndLogPage
* emit an XLOG record saying we did this.
* If the writeXlog is false, the rmid and info parameters are unused.
*
* SimpleLruZeroPage performs:
* 2. nullifying.
*/
From de4621460b1b63fb3cbc78095af31e1e6b565dd2 Mon Sep 17 00:00:00 2001
From: Evgeny Voropaev <evo...@gmail.com>
Date: Tue, 18 Feb 2025 15:48:12 +0800
Subject: [PATCH v3] Elimination of the repetitive code at the SLRU
bootstrapping and nullifying functions.
The functions bootstrapping and nullifying SLRU pages used to have a lot of
repetitive code. New functions realized by this commit (BootStrapSlruPage,
SimpleLruZeroAndLogPage, WriteSlruZeroPageXlogRec) have moved duplicating code
into the single place and eliminated code repetitions.
Author: Evgeny Voropaev <evgeny.vorop...@tantorlabs.com> <evo...@gmail.com>
---
src/backend/access/transam/clog.c | 65 +-------------
src/backend/access/transam/commit_ts.c | 65 ++------------
src/backend/access/transam/multixact.c | 117 +++----------------------
src/backend/access/transam/slru.c | 73 ++++++++++++++-
src/backend/access/transam/subtrans.c | 35 +-------
src/include/access/slru.h | 5 ++
6 files changed, 105 insertions(+), 255 deletions(-)
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index 48f10bec91e..a78b8bde628 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -110,9 +110,7 @@ static SlruCtlData XactCtlData;
#define XactCtl (&XactCtlData)
-static int ZeroCLOGPage(int64 pageno, bool writeXlog);
static bool CLOGPagePrecedes(int64 page1, int64 page2);
-static void WriteZeroPageXlogRec(int64 pageno);
static void WriteTruncateXlogRec(int64 pageno, TransactionId oldestXact,
Oid oldestXactDb);
static void TransactionIdSetPageStatus(TransactionId xid, int nsubxids,
@@ -832,41 +830,7 @@ check_transaction_buffers(int *newval, void **extra, GucSource source)
void
BootStrapCLOG(void)
{
- int slotno;
- LWLock *lock = SimpleLruGetBankLock(XactCtl, 0);
-
- LWLockAcquire(lock, LW_EXCLUSIVE);
-
- /* Create and zero the first page of the commit log */
- slotno = ZeroCLOGPage(0, false);
-
- /* Make sure it's written out */
- SimpleLruWritePage(XactCtl, slotno);
- Assert(!XactCtl->shared->page_dirty[slotno]);
-
- LWLockRelease(lock);
-}
-
-/*
- * Initialize (or reinitialize) a page of CLOG to zeroes.
- * If writeXlog is true, also emit an XLOG record saying we did this.
- *
- * The page is not actually written, just set up in shared memory.
- * The slot number of the new page is returned.
- *
- * Control lock must be held at entry, and will be held at exit.
- */
-static int
-ZeroCLOGPage(int64 pageno, bool writeXlog)
-{
- int slotno;
-
- slotno = SimpleLruZeroPage(XactCtl, pageno);
-
- if (writeXlog)
- WriteZeroPageXlogRec(pageno);
-
- return slotno;
+ BootStrapSlruPage(XactCtl, 0, false, RM_CLOG_ID, CLOG_ZEROPAGE);
}
/*
@@ -975,8 +939,7 @@ ExtendCLOG(TransactionId newestXact)
LWLockAcquire(lock, LW_EXCLUSIVE);
/* Zero the page and make an XLOG entry about it */
- ZeroCLOGPage(pageno, true);
-
+ SimpleLruZeroAndLogPage(XactCtl, pageno, true, RM_CLOG_ID, CLOG_ZEROPAGE);
LWLockRelease(lock);
}
@@ -1067,17 +1030,6 @@ CLOGPagePrecedes(int64 page1, int64 page2)
}
-/*
- * Write a ZEROPAGE xlog record
- */
-static void
-WriteZeroPageXlogRec(int64 pageno)
-{
- XLogBeginInsert();
- XLogRegisterData(&pageno, sizeof(pageno));
- (void) XLogInsert(RM_CLOG_ID, CLOG_ZEROPAGE);
-}
-
/*
* Write a TRUNCATE xlog record
*
@@ -1114,19 +1066,8 @@ clog_redo(XLogReaderState *record)
if (info == CLOG_ZEROPAGE)
{
int64 pageno;
- int slotno;
- LWLock *lock;
-
memcpy(&pageno, XLogRecGetData(record), sizeof(pageno));
-
- lock = SimpleLruGetBankLock(XactCtl, pageno);
- LWLockAcquire(lock, LW_EXCLUSIVE);
-
- slotno = ZeroCLOGPage(pageno, false);
- SimpleLruWritePage(XactCtl, slotno);
- Assert(!XactCtl->shared->page_dirty[slotno]);
-
- LWLockRelease(lock);
+ BootStrapSlruPage(XactCtl, pageno, false, RM_CLOG_ID, CLOG_ZEROPAGE);
}
else if (info == CLOG_TRUNCATE)
{
diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c
index 113fae1437a..766e8b7bf0a 100644
--- a/src/backend/access/transam/commit_ts.c
+++ b/src/backend/access/transam/commit_ts.c
@@ -114,11 +114,9 @@ static void SetXidCommitTsInPage(TransactionId xid, int nsubxids,
static void TransactionIdSetCommitTs(TransactionId xid, TimestampTz ts,
RepOriginId nodeid, int slotno);
static void error_commit_ts_disabled(void);
-static int ZeroCommitTsPage(int64 pageno, bool writeXlog);
static bool CommitTsPagePrecedes(int64 page1, int64 page2);
static void ActivateCommitTs(void);
static void DeactivateCommitTs(void);
-static void WriteZeroPageXlogRec(int64 pageno);
static void WriteTruncateXlogRec(int64 pageno, TransactionId oldestXid);
/*
@@ -602,28 +600,6 @@ BootStrapCommitTs(void)
*/
}
-/*
- * Initialize (or reinitialize) a page of CommitTs to zeroes.
- * If writeXlog is true, also emit an XLOG record saying we did this.
- *
- * The page is not actually written, just set up in shared memory.
- * The slot number of the new page is returned.
- *
- * Control lock must be held at entry, and will be held at exit.
- */
-static int
-ZeroCommitTsPage(int64 pageno, bool writeXlog)
-{
- int slotno;
-
- slotno = SimpleLruZeroPage(CommitTsCtl, pageno);
-
- if (writeXlog)
- WriteZeroPageXlogRec(pageno);
-
- return slotno;
-}
-
/*
* This must be called ONCE during postmaster or standalone-backend startup,
* after StartupXLOG has initialized TransamVariables->nextXid.
@@ -747,16 +723,8 @@ ActivateCommitTs(void)
/* Create the current segment file, if necessary */
if (!SimpleLruDoesPhysicalPageExist(CommitTsCtl, pageno))
- {
- LWLock *lock = SimpleLruGetBankLock(CommitTsCtl, pageno);
- int slotno;
-
- LWLockAcquire(lock, LW_EXCLUSIVE);
- slotno = ZeroCommitTsPage(pageno, false);
- SimpleLruWritePage(CommitTsCtl, slotno);
- Assert(!CommitTsCtl->shared->page_dirty[slotno]);
- LWLockRelease(lock);
- }
+ BootStrapSlruPage(CommitTsCtl, pageno,
+ false, RM_COMMIT_TS_ID, COMMIT_TS_ZEROPAGE);
/* Change the activation status in shared memory. */
LWLockAcquire(CommitTsLock, LW_EXCLUSIVE);
@@ -868,7 +836,8 @@ ExtendCommitTs(TransactionId newestXact)
LWLockAcquire(lock, LW_EXCLUSIVE);
/* Zero the page and make an XLOG entry about it */
- ZeroCommitTsPage(pageno, !InRecovery);
+ SimpleLruZeroAndLogPage(CommitTsCtl, pageno,
+ !InRecovery, RM_COMMIT_TS_ID, COMMIT_TS_ZEROPAGE);
LWLockRelease(lock);
}
@@ -982,17 +951,6 @@ CommitTsPagePrecedes(int64 page1, int64 page2)
}
-/*
- * Write a ZEROPAGE xlog record
- */
-static void
-WriteZeroPageXlogRec(int64 pageno)
-{
- XLogBeginInsert();
- XLogRegisterData(&pageno, sizeof(pageno));
- (void) XLogInsert(RM_COMMIT_TS_ID, COMMIT_TS_ZEROPAGE);
-}
-
/*
* Write a TRUNCATE xlog record
*/
@@ -1023,19 +981,10 @@ commit_ts_redo(XLogReaderState *record)
if (info == COMMIT_TS_ZEROPAGE)
{
int64 pageno;
- int slotno;
- LWLock *lock;
-
memcpy(&pageno, XLogRecGetData(record), sizeof(pageno));
-
- lock = SimpleLruGetBankLock(CommitTsCtl, pageno);
- LWLockAcquire(lock, LW_EXCLUSIVE);
-
- slotno = ZeroCommitTsPage(pageno, false);
- SimpleLruWritePage(CommitTsCtl, slotno);
- Assert(!CommitTsCtl->shared->page_dirty[slotno]);
-
- LWLockRelease(lock);
+
+ BootStrapSlruPage(CommitTsCtl, pageno,
+ false, RM_COMMIT_TS_ID, COMMIT_TS_ZEROPAGE);
}
else if (info == COMMIT_TS_TRUNCATE)
{
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index c1e2c42e1bb..6961c354306 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -401,8 +401,6 @@ static void mXactCachePut(MultiXactId multi, int nmembers,
static char *mxstatus_to_string(MultiXactStatus status);
/* management of SLRU infrastructure */
-static int ZeroMultiXactOffsetPage(int64 pageno, bool writeXlog);
-static int ZeroMultiXactMemberPage(int64 pageno, bool writeXlog);
static bool MultiXactOffsetPagePrecedes(int64 page1, int64 page2);
static bool MultiXactMemberPagePrecedes(int64 page1, int64 page2);
static bool MultiXactOffsetPrecedes(MultiXactOffset offset1,
@@ -413,7 +411,6 @@ static bool MultiXactOffsetWouldWrap(MultiXactOffset boundary,
MultiXactOffset start, uint32 distance);
static bool SetOffsetVacuumLimit(bool is_startup);
static bool find_multixact_start(MultiXactId multi, MultiXactOffset *result);
-static void WriteMZeroPageXlogRec(int64 pageno, uint8 info);
static void WriteMTruncateXlogRec(Oid oldestMultiDB,
MultiXactId startTruncOff,
MultiXactId endTruncOff,
@@ -2033,70 +2030,11 @@ check_multixact_member_buffers(int *newval, void **extra, GucSource source)
void
BootStrapMultiXact(void)
{
- int slotno;
- LWLock *lock;
-
- lock = SimpleLruGetBankLock(MultiXactOffsetCtl, 0);
- LWLockAcquire(lock, LW_EXCLUSIVE);
-
- /* Create and zero the first page of the offsets log */
- slotno = ZeroMultiXactOffsetPage(0, false);
-
- /* Make sure it's written out */
- SimpleLruWritePage(MultiXactOffsetCtl, slotno);
- Assert(!MultiXactOffsetCtl->shared->page_dirty[slotno]);
-
- LWLockRelease(lock);
-
- lock = SimpleLruGetBankLock(MultiXactMemberCtl, 0);
- LWLockAcquire(lock, LW_EXCLUSIVE);
-
- /* Create and zero the first page of the members log */
- slotno = ZeroMultiXactMemberPage(0, false);
-
- /* Make sure it's written out */
- SimpleLruWritePage(MultiXactMemberCtl, slotno);
- Assert(!MultiXactMemberCtl->shared->page_dirty[slotno]);
-
- LWLockRelease(lock);
-}
-
-/*
- * Initialize (or reinitialize) a page of MultiXactOffset to zeroes.
- * If writeXlog is true, also emit an XLOG record saying we did this.
- *
- * The page is not actually written, just set up in shared memory.
- * The slot number of the new page is returned.
- *
- * Control lock must be held at entry, and will be held at exit.
- */
-static int
-ZeroMultiXactOffsetPage(int64 pageno, bool writeXlog)
-{
- int slotno;
-
- slotno = SimpleLruZeroPage(MultiXactOffsetCtl, pageno);
-
- if (writeXlog)
- WriteMZeroPageXlogRec(pageno, XLOG_MULTIXACT_ZERO_OFF_PAGE);
-
- return slotno;
-}
-
-/*
- * Ditto, for MultiXactMember
- */
-static int
-ZeroMultiXactMemberPage(int64 pageno, bool writeXlog)
-{
- int slotno;
-
- slotno = SimpleLruZeroPage(MultiXactMemberCtl, pageno);
-
- if (writeXlog)
- WriteMZeroPageXlogRec(pageno, XLOG_MULTIXACT_ZERO_MEM_PAGE);
+ BootStrapSlruPage(MultiXactOffsetCtl, 0,
+ false, RM_MULTIXACT_ID, XLOG_MULTIXACT_ZERO_OFF_PAGE);
- return slotno;
+ BootStrapSlruPage(MultiXactMemberCtl, 0,
+ false, RM_MULTIXACT_ID, XLOG_MULTIXACT_ZERO_MEM_PAGE);
}
/*
@@ -2134,7 +2072,7 @@ MaybeExtendOffsetSlru(void)
* with creating a new segment file even if the page we're writing is
* not the first in it, so this is enough.
*/
- slotno = ZeroMultiXactOffsetPage(pageno, false);
+ slotno = SimpleLruZeroPage(MultiXactOffsetCtl, pageno);
SimpleLruWritePage(MultiXactOffsetCtl, slotno);
}
@@ -2569,7 +2507,8 @@ ExtendMultiXactOffset(MultiXactId multi)
LWLockAcquire(lock, LW_EXCLUSIVE);
/* Zero the page and make an XLOG entry about it */
- ZeroMultiXactOffsetPage(pageno, true);
+ SimpleLruZeroAndLogPage(MultiXactOffsetCtl, pageno,
+ true, RM_MULTIXACT_ID, XLOG_MULTIXACT_ZERO_OFF_PAGE);
LWLockRelease(lock);
}
@@ -2612,7 +2551,9 @@ ExtendMultiXactMember(MultiXactOffset offset, int nmembers)
LWLockAcquire(lock, LW_EXCLUSIVE);
/* Zero the page and make an XLOG entry about it */
- ZeroMultiXactMemberPage(pageno, true);
+ SimpleLruZeroAndLogPage(MultiXactMemberCtl, pageno,
+ true, RM_MULTIXACT_ID, XLOG_MULTIXACT_ZERO_MEM_PAGE);
+
LWLockRelease(lock);
}
@@ -3347,18 +3288,6 @@ MultiXactOffsetPrecedes(MultiXactOffset offset1, MultiXactOffset offset2)
return (diff < 0);
}
-/*
- * Write an xlog record reflecting the zeroing of either a MEMBERs or
- * OFFSETs page (info shows which)
- */
-static void
-WriteMZeroPageXlogRec(int64 pageno, uint8 info)
-{
- XLogBeginInsert();
- XLogRegisterData(&pageno, sizeof(pageno));
- (void) XLogInsert(RM_MULTIXACT_ID, info);
-}
-
/*
* Write a TRUNCATE xlog record
*
@@ -3401,36 +3330,18 @@ multixact_redo(XLogReaderState *record)
if (info == XLOG_MULTIXACT_ZERO_OFF_PAGE)
{
int64 pageno;
- int slotno;
- LWLock *lock;
-
memcpy(&pageno, XLogRecGetData(record), sizeof(pageno));
- lock = SimpleLruGetBankLock(MultiXactOffsetCtl, pageno);
- LWLockAcquire(lock, LW_EXCLUSIVE);
-
- slotno = ZeroMultiXactOffsetPage(pageno, false);
- SimpleLruWritePage(MultiXactOffsetCtl, slotno);
- Assert(!MultiXactOffsetCtl->shared->page_dirty[slotno]);
-
- LWLockRelease(lock);
+ BootStrapSlruPage(MultiXactOffsetCtl, pageno,
+ false, RM_MULTIXACT_ID, XLOG_MULTIXACT_ZERO_OFF_PAGE);
}
else if (info == XLOG_MULTIXACT_ZERO_MEM_PAGE)
{
int64 pageno;
- int slotno;
- LWLock *lock;
-
memcpy(&pageno, XLogRecGetData(record), sizeof(pageno));
- lock = SimpleLruGetBankLock(MultiXactMemberCtl, pageno);
- LWLockAcquire(lock, LW_EXCLUSIVE);
-
- slotno = ZeroMultiXactMemberPage(pageno, false);
- SimpleLruWritePage(MultiXactMemberCtl, slotno);
- Assert(!MultiXactMemberCtl->shared->page_dirty[slotno]);
-
- LWLockRelease(lock);
+ BootStrapSlruPage(MultiXactMemberCtl, pageno,
+ false, RM_MULTIXACT_ID, XLOG_MULTIXACT_ZERO_MEM_PAGE);
}
else if (info == XLOG_MULTIXACT_CREATE_ID)
{
diff --git a/src/backend/access/transam/slru.c b/src/backend/access/transam/slru.c
index 9ce628e62a5..cc069da19c6 100644
--- a/src/backend/access/transam/slru.c
+++ b/src/backend/access/transam/slru.c
@@ -65,6 +65,7 @@
#include "access/slru.h"
#include "access/transam.h"
#include "access/xlog.h"
+#include "access/xloginsert.h"
#include "access/xlogutils.h"
#include "miscadmin.h"
#include "pgstat.h"
@@ -189,7 +190,7 @@ static bool SlruScanDirCbDeleteCutoff(SlruCtl ctl, char *filename,
int64 segpage, void *data);
static void SlruInternalDeleteSegment(SlruCtl ctl, int64 segno);
static inline void SlruRecentlyUsed(SlruShared shared, int slotno);
-
+static inline void WriteSlruZeroPageXlogRec(int64 pageno, RmgrId rmid, uint8 info);
/*
* Initialization of shared memory
@@ -363,6 +364,65 @@ check_slru_buffers(const char *name, int *newval)
return false;
}
+/*
+ * BootStrapSlruPage,
+ * SimpleLruZeroAndLogPage,
+ * SimpleLruZeroPage
+ * - functions nullifying SLRU pages.
+ *
+ * BootStrapSlruPage is the most holistic. It performs:
+ * 1. locking,
+ * 2. nullifying,
+ * 3. logging (when writeXlog is true),
+ * 4. writing out,
+ * 5. releasing the lock.
+ *
+ * SimpleLruZeroAndLogPage performs:
+ * 2. nullifying,
+ * 3. logging (when writeXlog is true),
+ * 4. writing out.
+ *
+ * If the writeXlog is true, BootStrapSlruPage and SimpleLruZeroAndLogPage
+ * emit an XLOG record saying we did this.
+ * If the writeXlog is false, the rmid and info parameters are unused.
+ *
+ * SimpleLruZeroPage performs:
+ * 2. nullifying.
+ */
+void
+BootStrapSlruPage(SlruCtl ctl, int64 pageno,
+ bool writeXlog, RmgrId rmid, uint8 info)
+{
+ int slotno;
+ LWLock *lock;
+
+ lock = SimpleLruGetBankLock(ctl, pageno);
+ LWLockAcquire(lock, LW_EXCLUSIVE);
+
+ /* Create and zero the page*/
+ slotno = SimpleLruZeroAndLogPage(ctl, pageno, writeXlog, rmid, info);
+
+ /* Make sure it's written out */
+ SimpleLruWritePage(ctl, slotno);
+ Assert(!ctl->shared->page_dirty[slotno]);
+
+ LWLockRelease(lock);
+}
+
+int
+SimpleLruZeroAndLogPage(SlruCtl ctl, int64 pageno,
+ bool writeXlog, RmgrId rmid, uint8 info)
+{
+ int slotno;
+
+ slotno = SimpleLruZeroPage(ctl, pageno);
+
+ if (writeXlog)
+ WriteSlruZeroPageXlogRec(pageno, rmid, info);
+
+ return slotno;
+}
+
/*
* Initialize (or reinitialize) a page to zeroes.
*
@@ -1850,3 +1910,14 @@ SlruSyncFileTag(SlruCtl ctl, const FileTag *ftag, char *path)
errno = save_errno;
return result;
}
+
+/*
+ * Write a SLRU ZEROPAGE xlog record
+ */
+static inline void
+WriteSlruZeroPageXlogRec(int64 pageno, RmgrId rmid, uint8 info)
+{
+ XLogBeginInsert();
+ XLogRegisterData(&pageno, sizeof(pageno));
+ (void) XLogInsert(rmid, info);
+}
diff --git a/src/backend/access/transam/subtrans.c b/src/backend/access/transam/subtrans.c
index 15153618fad..6b013801825 100644
--- a/src/backend/access/transam/subtrans.c
+++ b/src/backend/access/transam/subtrans.c
@@ -74,7 +74,6 @@ static SlruCtlData SubTransCtlData;
#define SubTransCtl (&SubTransCtlData)
-static int ZeroSUBTRANSPage(int64 pageno);
static bool SubTransPagePrecedes(int64 page1, int64 page2);
@@ -269,33 +268,7 @@ check_subtrans_buffers(int *newval, void **extra, GucSource source)
void
BootStrapSUBTRANS(void)
{
- int slotno;
- LWLock *lock = SimpleLruGetBankLock(SubTransCtl, 0);
-
- LWLockAcquire(lock, LW_EXCLUSIVE);
-
- /* Create and zero the first page of the subtrans log */
- slotno = ZeroSUBTRANSPage(0);
-
- /* Make sure it's written out */
- SimpleLruWritePage(SubTransCtl, slotno);
- Assert(!SubTransCtl->shared->page_dirty[slotno]);
-
- LWLockRelease(lock);
-}
-
-/*
- * Initialize (or reinitialize) a page of SUBTRANS to zeroes.
- *
- * The page is not actually written, just set up in shared memory.
- * The slot number of the new page is returned.
- *
- * Control lock must be held at entry, and will be held at exit.
- */
-static int
-ZeroSUBTRANSPage(int64 pageno)
-{
- return SimpleLruZeroPage(SubTransCtl, pageno);
+ BootStrapSlruPage(SubTransCtl, 0, false, 0, 0);
}
/*
@@ -334,8 +307,8 @@ StartupSUBTRANS(TransactionId oldestActiveXID)
LWLockAcquire(lock, LW_EXCLUSIVE);
prevlock = lock;
}
-
- (void) ZeroSUBTRANSPage(startPage);
+
+ (void) SimpleLruZeroPage(SubTransCtl, startPage);
if (startPage == endPage)
break;
@@ -395,7 +368,7 @@ ExtendSUBTRANS(TransactionId newestXact)
LWLockAcquire(lock, LW_EXCLUSIVE);
/* Zero the page */
- ZeroSUBTRANSPage(pageno);
+ SimpleLruZeroPage(SubTransCtl, pageno);
LWLockRelease(lock);
}
diff --git a/src/include/access/slru.h b/src/include/access/slru.h
index e142800aab2..3826ab5088c 100644
--- a/src/include/access/slru.h
+++ b/src/include/access/slru.h
@@ -13,6 +13,7 @@
#ifndef SLRU_H
#define SLRU_H
+#include "access/rmgr.h"
#include "access/xlogdefs.h"
#include "storage/lwlock.h"
#include "storage/sync.h"
@@ -186,6 +187,10 @@ extern void SimpleLruInit(SlruCtl ctl, const char *name, int nslots, int nlsns,
const char *subdir, int buffer_tranche_id,
int bank_tranche_id, SyncRequestHandler sync_handler,
bool long_segment_names);
+extern void BootStrapSlruPage(SlruCtl ctl, int64 pageno,
+ bool writeXlog, RmgrId rmid, uint8 info);
+extern int SimpleLruZeroAndLogPage(SlruCtl ctl, int64 pageno,
+ bool writeXlog, RmgrId rmid, uint8 info);
extern int SimpleLruZeroPage(SlruCtl ctl, int64 pageno);
extern int SimpleLruReadPage(SlruCtl ctl, int64 pageno, bool write_ok,
TransactionId xid);
--
2.47.1