From 34679d1e27e928fcd013c10772d56feb9c299bcc Mon Sep 17 00:00:00 2001
From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Date: Mon, 26 Dec 2022 12:36:20 +0000
Subject: [PATCH v1] Make IsInstallXLogFileSegmentActive() an assert-only
 function

---
 src/backend/access/transam/xlog.c | 2 ++
 src/include/access/xlog.h         | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 91473b00d9..9ac33534ba 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8904,6 +8904,7 @@ SetInstallXLogFileSegmentActive(void)
 	LWLockRelease(ControlFileLock);
 }
 
+#ifdef USE_ASSERT_CHECKING
 bool
 IsInstallXLogFileSegmentActive(void)
 {
@@ -8915,6 +8916,7 @@ IsInstallXLogFileSegmentActive(void)
 
 	return result;
 }
+#endif
 
 /*
  * Update the WalWriterSleeping flag.
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h
index 1fbd48fbda..2a1e44631c 100644
--- a/src/include/access/xlog.h
+++ b/src/include/access/xlog.h
@@ -255,7 +255,11 @@ extern bool XLogCheckpointNeeded(XLogSegNo new_segno);
 extern void SwitchIntoArchiveRecovery(XLogRecPtr EndRecPtr, TimeLineID replayTLI);
 extern void ReachedEndOfBackup(XLogRecPtr EndRecPtr, TimeLineID tli);
 extern void SetInstallXLogFileSegmentActive(void);
+
+#ifdef USE_ASSERT_CHECKING
 extern bool IsInstallXLogFileSegmentActive(void);
+#endif
+
 extern void XLogShutdownWalRcv(void);
 
 /*
-- 
2.34.1

