Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rLau9-008siU-8q for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jan 2024 03:29:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rLau4-00HIBL-RW for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jan 2024 03:29:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rLau4-00HIBD-Eg for pgsql-hackers@lists.postgresql.org; Fri, 05 Jan 2024 03:29:48 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rLau1-00DnKD-Rg for pgsql-hackers@postgresql.org; Fri, 05 Jan 2024 03:29:47 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3367601a301so920520f8f.2 for ; Thu, 04 Jan 2024 19:29:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704425383; x=1705030183; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=h5qJbDilLvELdrvRcOSb/Gt16bGygr0Rt9ENfMK/mNU=; b=F4LCn/qgOfDwyloSshKepuY5NyxRKs0hFlH8T/4K5k80pv7HIpuX1JEEQ2TAcckU+3 qyDRNA0DCpQY6ObrvQut1iaSG4d/e1HgVvSJP7Md3V2up/1twKkn1g8plTPdiOEbY+1O AZFlqNiluUkkEhXmPipyQI/xlYwO+Uz+C5DGnnP7BaZTYpIah3IgGdQVBcgPMZNftt+5 bJdWdUn27leUkIQy0JK0w07bxacvuZZuJFj5Y25nrIu5sdQHjPuXMhAUvu3iyTLClvVS H17cD8l08pIddyLTCLcf8m/4h3ZY0q3lC/MPHrzg6NB3+6ySMdkkD3+reqS8GwDb7QOR 091A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704425383; x=1705030183; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h5qJbDilLvELdrvRcOSb/Gt16bGygr0Rt9ENfMK/mNU=; b=nXsw+xEcp5fsb7V4YawjmYXQvdXbXsilP9bjYDKYIe4D9ds1V+IyufxXM87zuUOztw /42o/6MH6vlbVCUwWuOejwzxt/6j3DyjDOxCKZxfJ+DWjbGlNQde3jgxp6GWOJQ4dymd CK3qEb5CSlASDLuZLv4tApnMVcrQGp6HLbCalkcmS8/lXQmQWUkIx7T70MM7kgfEUVer 68IJJFonX6+Ft6VmgQDCDEHtA783odslW/I5QTYmdBrdhNfiap2L88A6AgfnP8Ae3o+N sVcA9Y8VWHFz1/eThHJ+lYu0TYSP3sQTNLhMxS/14eHBfz+HgLhbvbxlJzHktFBQuohY Lmxw== X-Gm-Message-State: AOJu0Yx6lTSu2O/GBIEo+37XYRNtr0+M79W6TwLehNIWE84zbU8eitQt iY36U/yLfgUqrDCV6BpC+kdDeIStoQ3RTMeNStM= X-Google-Smtp-Source: AGHT+IGSkp/0OPqc24+HU4C5vk+RqJvQFwl6uK6Zb2l+7IOdFJqdwENTBXWlOXd89VfH8JxwuLb9aCWTmujD8HTrllQ= X-Received: by 2002:a05:600c:2253:b0:40d:7ace:9d47 with SMTP id a19-20020a05600c225300b0040d7ace9d47mr573638wmm.175.1704425383395; Thu, 04 Jan 2024 19:29:43 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: shveta malik Date: Fri, 5 Jan 2024 08:59:31 +0530 Message-ID: Subject: Re: Synchronizing slots from primary to standby To: Bertrand Drouvot Cc: "Zhijie Hou (Fujitsu)" , Amit Kapila , Masahiko Sawada , Peter Smith , Nisha Moond , "Hayato Kuroda (Fujitsu)" , Bharath Rupireddy , Peter Eisentraut , Bruce Momjian , Ashutosh Sharma , Andres Freund , pgsql-hackers , Ajin Cherian , Alvaro Herrera , shveta malik Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Jan 4, 2024 at 7:24=E2=80=AFPM Bertrand Drouvot wrote: > > Hi, > > On Thu, Jan 04, 2024 at 10:27:31AM +0530, shveta malik wrote: > > On Thu, Jan 4, 2024 at 9:18=E2=80=AFAM shveta malik wrote: > > > > > > On Wed, Jan 3, 2024 at 6:33=E2=80=AFPM Zhijie Hou (Fujitsu) > > > wrote: > > > > > > > > On Tuesday, January 2, 2024 6:32 PM shveta malik wrote: > > > > > On Fri, Dec 29, 2023 at 10:25=E2=80=AFAM Amit Kapila > > > > > > > > > > The topup patch has also changed app_name to > > > > > {cluster_name}_slotsyncworker so that we do not confuse between w= alreceiver > > > > > and slotsyncworker entry. > > > > > > > > > > Please note that there is no change in rest of the patches, chang= es are in > > > > > additional 0004 patch alone. > > > > > > > > Attach the V56 patch set which supports ALTER SUBSCRIPTION SET (fai= lover). > > > > This is useful when user want to refresh the publication tables, th= ey can now alter the > > > > failover option to false and then execute the refresh command. > > > > > > > > Best Regards, > > > > Hou zj > > > > > > The patches no longer apply to HEAD due to a recent commit 007693f. I > > > am working on rebasing and will post the new patches soon > > > > > > thanks > > > Shveta > > > > Commit 007693f has changed 'conflicting' to 'conflict_reason', so > > adjusted the code around that in the slotsync worker. > > > > Also removed function 'pg_get_slot_invalidation_cause' as now > > conflict_reason tells the same. > > > > PFA rebased patches with above changes. > > > > Thanks! > > Looking at 0004: > > 1 =3D=3D=3D=3D > > -libpqrcv_connect(const char *conninfo, bool logical, bool must_use_passw= ord, > - const char *appname, char **err) > +libpqrcv_connect(const char *conninfo, bool replication, bool logical, > + bool must_use_password, const char *appn= ame, char **err) > > What about adjusting the preceding comment a bit to describe what the new= replication > parameter is for? > > 2 =3D=3D=3D=3D > > + /* We can not have logical w/o replication */ > > what about replacing w/o by without? > > 3 =3D=3D=3D > > + if(!replication) > + Assert(!logical); > + > + if (replication) > { > > what about using "if () else" instead (to avoid unnecessary test)? > > > Having said that the patch seems a reasonable way to implement non-replic= ation > connection in slotsync worker. > > 4 =3D=3D=3D > > Looking closer, the only place where walrcv_connect() is called with repl= ication > set to false and logical set to false is in ReplSlotSyncWorkerMain(). > > That does make sense, but what do you think about creating dedicated libp= qslotsyncwrkr_connect > and slotsyncwrkr_connect (instead of using the libpqrcv_connect / walrcv_= connect ones)? > > That way we could make use of slotsyncwrkr_connect() in ReplSlotSyncWorke= rMain() > as I think it's confusing to use "rcv" functions while the process using = them is > not of backend type walreceiver. > > I'm not sure that worth the extra complexity though, what do you think? I gave it a thought earlier, but then I was not sure even if I create a new function w/o "rcv" in it then where should it be placed as the existing file name itself is libpq'walreceiver'.c. Shall we be creating a new file then? But it does not seem good to create a new setup (new file, function pointers other stuff) around 1 function. And thus reusing the same function with 'replication' (new arg) felt like a better choice than other options. If in future, there is any other module trying to do the same, then it can use current walrcv_connect() with rep=3Dfalse. If I make it specific to slot-sync worker, then it will not be reusable by other modules (if needed). thanks Shveta