On Tue, 19 Sept 2023 at 11:49, Michael Paquier <mich...@paquier.xyz> wrote: > > On Fri, Sep 15, 2023 at 04:51:57PM +0530, vignesh C wrote: > > Another approach to solve this as suggested by one of my colleague > > Hou-san would be to set max_logical_replication_workers = 0 while > > upgrading. I will evaluate this and update the next version of patch > > accordingly. > > In the context of an upgrade, any node started is isolated with its > own port and a custom unix domain directory with connections allowed > only through this one. > > Saying that, I don't see why forcing max_logical_replication_workers > to be 0 would be necessarily a bad thing to prevent unnecessary > activity on the backend. This should be a separate patch built on > top of the main one, IMO.
Here is a patch to set max_logical_replication_workers as 0 while the server is started to prevent the launcher from being started. Since this configuration is present from v10, no need for any version check. I have done upgrade tests for v10-master, v11-master, ... v16-master and found it to be working fine. Regards, Vignesh
From f8ce16694ac4324113d948482818047f5457f924 Mon Sep 17 00:00:00 2001 From: Vignesh C <vignes...@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