Remove redundant HandleWalWriterInterrupts()
Hi,
Because of commit 1bdd54e662, the code of HandleWalWriterInterrupts()
became the same as HandleMainLoopInterrupts(). So I'd like to propose to
remove HandleWalWriterInterrupts() and make walwriter use
HandleMainLoopInterrupts() instead for improved code simplicity. Thought?
Patch attached.
Regards,
--
Fujii Masao
Attachments:
v1-0001-Remove-redundant-HandleWalWriterInterrupts.patchapplication/octet-stream; name=v1-0001-Remove-redundant-HandleWalWriterInterrupts.patchDownload
From 24fa91a2d0cc6953d3b1a26ad8648b6047a9f673 Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@postgresql.org>
Date: Wed, 24 Jan 2024 20:42:49 +0900
Subject: [PATCH v1] Remove redundant HandleWalWriterInterrupts().
Because of commit 1bdd54e662, the code of HandleWalWriterInterrupts()
became the same as HandleMainLoopInterrupts(). So this commit removes
HandleWalWriterInterrupts() and makes walwriter use
HandleMainLoopInterrupts() for improved code simplicity.
---
src/backend/postmaster/walwriter.c | 28 +---------------------------
1 file changed, 1 insertion(+), 27 deletions(-)
diff --git a/src/backend/postmaster/walwriter.c b/src/backend/postmaster/walwriter.c
index 177b1837c2..75c9f8707b 100644
--- a/src/backend/postmaster/walwriter.c
+++ b/src/backend/postmaster/walwriter.c
@@ -78,9 +78,6 @@ int WalWriterFlushAfter = DEFAULT_WAL_WRITER_FLUSH_AFTER;
#define LOOPS_UNTIL_HIBERNATE 50
#define HIBERNATE_FACTOR 25
-/* Prototypes for private functions */
-static void HandleWalWriterInterrupts(void);
-
/*
* Main entry point for walwriter process
*
@@ -245,7 +242,7 @@ WalWriterMain(void)
ResetLatch(MyLatch);
/* Process any signals received recently */
- HandleWalWriterInterrupts();
+ HandleMainLoopInterrupts();
/*
* Do what we're here for; then, if XLogBackgroundFlush() found useful
@@ -275,26 +272,3 @@ WalWriterMain(void)
WAIT_EVENT_WAL_WRITER_MAIN);
}
}
-
-/*
- * Interrupt handler for main loops of WAL writer process.
- */
-static void
-HandleWalWriterInterrupts(void)
-{
- if (ProcSignalBarrierPending)
- ProcessProcSignalBarrier();
-
- if (ConfigReloadPending)
- {
- ConfigReloadPending = false;
- ProcessConfigFile(PGC_SIGHUP);
- }
-
- if (ShutdownRequestPending)
- proc_exit(0);
-
- /* Perform logging of memory contexts of this process */
- if (LogMemoryContextPending)
- ProcessLogMemoryContextInterrupt();
-}
--
2.41.0
On Wed, Jan 24, 2024 at 5:50 PM Fujii Masao <masao.fujii@gmail.com> wrote:
Hi,
Because of commit 1bdd54e662, the code of HandleWalWriterInterrupts()
became the same as HandleMainLoopInterrupts(). So I'd like to propose to
remove HandleWalWriterInterrupts() and make walwriter use
HandleMainLoopInterrupts() instead for improved code simplicity. Thought?Patch attached.
Nice catch. Indeed they both are the same after commit 1bdd54e662. The
patch LGTM.
--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
On Wed, Jan 24, 2024 at 07:30:17PM +0530, Bharath Rupireddy wrote:
On Wed, Jan 24, 2024 at 5:50 PM Fujii Masao <masao.fujii@gmail.com> wrote:
Because of commit 1bdd54e662, the code of HandleWalWriterInterrupts()
became the same as HandleMainLoopInterrupts(). So I'd like to propose to
remove HandleWalWriterInterrupts() and make walwriter use
HandleMainLoopInterrupts() instead for improved code simplicity. Thought?Patch attached.
Nice catch. Indeed they both are the same after commit 1bdd54e662. The
patch LGTM.
LGTM, too.
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
On Thu, Jan 25, 2024 at 4:40 AM Nathan Bossart <nathandbossart@gmail.com> wrote:
On Wed, Jan 24, 2024 at 07:30:17PM +0530, Bharath Rupireddy wrote:
On Wed, Jan 24, 2024 at 5:50 PM Fujii Masao <masao.fujii@gmail.com> wrote:
Because of commit 1bdd54e662, the code of HandleWalWriterInterrupts()
became the same as HandleMainLoopInterrupts(). So I'd like to propose to
remove HandleWalWriterInterrupts() and make walwriter use
HandleMainLoopInterrupts() instead for improved code simplicity. Thought?Patch attached.
Nice catch. Indeed they both are the same after commit 1bdd54e662. The
patch LGTM.LGTM, too.
Thank you both for reviewing! I've pushed the patch.
Regards,
--
Fujii Masao