public inbox for [email protected]  
help / color / mirror / Atom feed
From: Chao Li <[email protected]>
To: Fujii Masao <[email protected]>
Cc: Xuneng Zhou <[email protected]>
Cc: Andreas Karlsson <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: Use proc_exit() in WalRcvWaitForStartPosition
Date: Mon, 13 Apr 2026 07:33:02 +0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAHGQGwHdqm5CCqiTR+Dpkr2maKCSVEPyoCOuB8WMHorDsGUeTw@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<CABPTF7V=y2rHC=gLTeC-42aRc+jcXueomUBjbNiy3pOfhJs3_A@mail.gmail.com>
	<CAHGQGwHHrDv8Z=D-UP+-RUR2yntv3Ab=yw4_uPWEMY0vLX_O6g@mail.gmail.com>
	<[email protected]>
	<CAHGQGwHdqm5CCqiTR+Dpkr2maKCSVEPyoCOuB8WMHorDsGUeTw@mail.gmail.com>



> On Apr 10, 2026, at 22:17, Fujii Masao <[email protected]> wrote:
> 
> On Fri, Apr 10, 2026 at 4:07 PM Chao Li <[email protected]> wrote:
>> PFA v2 - updated header comment of walreceive.c. I tried to avoid mentioning the exact exit value in the comment, so I just changed “exit(0)” to “terminate”.
> 
> Thanks for updating the patch!
> 
> "termination instructs XXX to terminate" sounds a bit redundant. How
> about saying
> "to ereport(FATAL)" instead of “to terminate”?
> 
> Regards,
> 
> 
> -- 
> Fujii Masao


Okay, yes, that was a bit redundant. I changed it to “to ereport(FATAL)” in v3.

After that change, the line went over 80 columns, so I also adjusted a few nearby lines to keep everything within the 80-column limit. There is no content change.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/






Attachments:

  [application/octet-stream] v3-0001-Use-proc_exit-in-WalRcvWaitForStartPosition.patch (1.7K, 2-v3-0001-Use-proc_exit-in-WalRcvWaitForStartPosition.patch)
  download | inline diff:
From 162eb0622f3f7ea436243aa2723737716a7c3e96 Mon Sep 17 00:00:00 2001
From: "Chao Li (Evan)" <[email protected]>
Date: Wed, 8 Apr 2026 17:02:28 +0800
Subject: [PATCH v3] Use proc_exit() in WalRcvWaitForStartPosition

Author: Chao Li <[email protected]>
Reviewed-by: Fujii Masao <[email protected]>
Reviewed-by: Andreas Karlsson <[email protected]>
Reviewed-by: Xuneng Zhou <[email protected]>
Discussion: https://postgr.es/m/[email protected]
---
 src/backend/replication/walreceiver.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index 09fde92bfd7..80743e6af29 100644
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -30,9 +30,9 @@
  * a new one.
  *
  * Normal termination is by SIGTERM, which instructs the walreceiver to
- * exit(0). Emergency termination is by SIGQUIT; like any postmaster child
- * process, the walreceiver will simply abort and exit on SIGQUIT. A close
- * of the connection and a FATAL error are treated not as a crash but as
+ * ereport(FATAL). Emergency termination is by SIGQUIT; like any postmaster
+ * child process, the walreceiver will simply abort and exit on SIGQUIT. A
+ * close of the connection and a FATAL error are treated not as a crash but as
  * normal operation.
  *
  * This file contains the server-facing parts of walreceiver. The libpq-
@@ -710,7 +710,7 @@ WalRcvWaitForStartPosition(XLogRecPtr *startpoint, TimeLineID *startpointTLI)
 			 * to die, but might as well check it here too.
 			 */
 			SpinLockRelease(&walrcv->mutex);
-			exit(1);
+			proc_exit(1);
 		}
 		SpinLockRelease(&walrcv->mutex);
 
-- 
2.50.1 (Apple Git-155)



view thread (9+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Use proc_exit() in WalRcvWaitForStartPosition
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox