From f8ce16694ac4324113d948482818047f5457f924 Mon Sep 17 00:00:00 2001
From: Vignesh C <vignesh21@gmail.com>
Date: Tue, 19 Sep 2023 17:41:07 +0530
Subject: [PATCH v1] Don't start launcher process to be started while
 upgrading.

We don't want launcher to run while upgrading because launcher might start
apply worker which will start receiving changes from the publisher and
update the old cluster before the upgradation is completed.
---
 src/bin/pg_upgrade/server.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/bin/pg_upgrade/server.c b/src/bin/pg_upgrade/server.c
index 0bc3d2806b..fa728d2b79 100644
--- a/src/bin/pg_upgrade/server.c
+++ b/src/bin/pg_upgrade/server.c
@@ -233,15 +233,16 @@ start_postmaster(ClusterInfo *cluster, bool report_and_exit_on_error)
 	 * Turn off durability requirements to improve object creation speed, and
 	 * we only modify the new cluster, so only use it there.  If there is a
 	 * crash, the new cluster has to be recreated anyway.  fsync=off is a big
-	 * win on ext4.
+	 * win on ext4. max_logical_replication_workers=0 to disable launcher.
 	 */
 	snprintf(cmd, sizeof(cmd),
-			 "\"%s/pg_ctl\" -w -l \"%s/%s\" -D \"%s\" -o \"-p %d -b%s %s%s\" start",
+			 "\"%s/pg_ctl\" -w -l \"%s/%s\" -D \"%s\" -o \"-p %d -b%s %s%s%s\" start",
 			 cluster->bindir,
 			 log_opts.logdir,
 			 SERVER_LOG_FILE, cluster->pgconfig, cluster->port,
 			 (cluster == &new_cluster) ?
 			 " -c synchronous_commit=off -c fsync=off -c full_page_writes=off" : "",
+			 " -c max_logical_replication_workers=0",
 			 cluster->pgopts ? cluster->pgopts : "", socket_string);
 
 	/*
-- 
2.34.1

