Hi,

As I report in another thread[1], when the logical replication launcher 
is terminated by SIGTERM, it never been restarted and we need to restart
the server to enable logical replication again.

This is because the logical replication launcher exits with exitstatus 0,
so if it exits with status 1 it is restarted by the postmaster normally.
Attached is a simple patch to fix it in this way.

However, I'm not sure this is the best way. For example, in this way,
we get the following log when the process is terminated, which we don't
get when it exits with status 0.

 LOG:  worker process: logical replication launcher (PID 11526) exited with 
exit code 1

If we don't want to get this message, we need more fixes in 
CleanupBackgroundWorker()
or around it.

[1]
https://www.postgresql.org/message-id/20170621205657.61d90605.nagata%40sraoss.co.jp

-- 
Yugo Nagata <nag...@sraoss.co.jp>
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index f99dd0a..a833dc5 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -2855,7 +2855,7 @@ ProcessInterrupts(void)
 					(errmsg("logical replication launcher shutting down")));
 
 			/* The logical replication launcher can be stopped at any time. */
-			proc_exit(0);
+			proc_exit(1);
 		}
 		else if (RecoveryConflictPending && RecoveryConflictRetryable)
 		{
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to