Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nR7d1-0007xm-Bx for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Mar 2022 07:17:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nR7d0-0000tj-Ap for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Mar 2022 07:17:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nR7cz-0000tU-Vx for pgsql-hackers@lists.postgresql.org; Mon, 07 Mar 2022 07:17:58 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nR7cx-0006YY-Jo for pgsql-hackers@lists.postgresql.org; Mon, 07 Mar 2022 07:17:57 +0000 Received: by mail-ej1-x635.google.com with SMTP id bg10so29815658ejb.4 for ; Sun, 06 Mar 2022 23:17:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Aw+vDFDyGqMooNQy5qeP1paJIXtJkRvl2is3+6D7/zE=; b=ZsJY+kJe1wD0OQqWagDRRi8jRE550YsUjOtgSy+H6jquO5hpQwzEXlLNQTI/eDKGht uGgfIKfKv2I5GVkhmyLtUVLTY+J/6lTliHeZWpMDLPWy8NAaGx5S+DBt5syoeVSkIjWG 6pxKCEQBi6AW+MGfhTPPmqTdT3uoRr8qc//FkmGxxei8NnEGXKWVIvzn72ZDaH4Ccf8d kyXmg8Fot4Bi5XQmrPWR7g64Cm0lAdZV4jCj7+heu9Y8P3QuSmtxd4Alk1BdU1AGf27S 6dlhSu70S71v+GeaANmR9C3X3RXtNAhWIo3ja5owqWaOSjpjqX1m6s17HqOJEgD0eiD6 JpJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Aw+vDFDyGqMooNQy5qeP1paJIXtJkRvl2is3+6D7/zE=; b=AE0IzOcWN3CUQgj4FrnGGItvg+u0ta23sYadB/Osk+bc5UFEv1cbPCx53XJ1354gUC rV/MH4Xvdwp+fA++0+weGBIuhMHTTZ6ECy4rIrHtx64OnKR+uoLDVKfq5lvGGcwzLjnX vjuM7b7BNcy8njX00FiuejBCRwK1PXIE1hEQwEiRyQANIaNsvQDhsNcYQ5Kilw4YJnqu 5W3cl5eZw4Jepor/SVRgMPMmHjiuXCQs+hSqxUeSaqdgt3UWnnSBxG+xibVGSAbPlD3g yPamgiQDeoYyDeuHdyoSlxttyC02NYvelgrszL5bIfsiHq//lvDFNm9GT2CZY0kW4rMj NpPg== X-Gm-Message-State: AOAM5304+S1mr8uNMyZc9y48i5Q95Rh0Y/4hhs7MzOb/8uG6jgulKE6A Tbcmas3q8Nz5EJo0Rm9pMAE4m/G+NqqrQDonXXk= X-Google-Smtp-Source: ABdhPJzj13QZpdetfARlUQrE0tevAPG0INZcedMpIk11TvdpFOqceNoJEOZv8mrvH8JFrZVTA/7q7VJskwQTOBdfB78= X-Received: by 2002:a17:906:c113:b0:6d7:7b53:9cb with SMTP id do19-20020a170906c11300b006d77b5309cbmr8446124ejc.197.1646637474548; Sun, 06 Mar 2022 23:17:54 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: vignesh C Date: Mon, 7 Mar 2022 12:47:43 +0530 Message-ID: Subject: Re: Handle infinite recursion in logical replication setup To: Peter Smith Cc: "kuroda.hayato@fujitsu.com" , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Mar 7, 2022 at 11:45 AM Peter Smith wrote: > > On Mon, Mar 7, 2022 at 4:20 PM vignesh C wrote: > > > > On Mon, Mar 7, 2022 at 10:26 AM Peter Smith wrote: > > > > > > Hi Vignesh, I also have not looked at the patch yet, but I have what > > > seems like a very fundamental (and possibly dumb) question... > > > > > > Basically, I do not understand the choice of syntax for setting things up. > > > > > > IMO that "only-local" option sounds very similar to the other > > > PUBLICATION ("publish") options which decide the kinds of things that > > > will be published. So it feels more natural for me to think of the > > > publisher as being the one to decide what will be published. > > > > > > e.g. > > > > > > option 1: > > > CREATE PUBLICATION p1 FOR TABLE t1; > > > CREATE SUBSCRITION s1 ... FOR PUBLICATION p1 WITH (only_local = true); > > > > > > option 2: > > > CREATE PUBLICATION p1 FOR TABLE t1 WEHRE (publish = 'only_local'); > > > CREATE SUBSCRITION s1 ... FOR PUBLICATION p1; > > > > > > ~~ > > > > > > IIUC the patch is using option 1. My first impression was it feels > > > back-to-front for the SUBSCRIPTION telling the PUBLICATION what to > > > publish. > > > > > > So, why does the patch use syntax option 1? > > > > I felt the advantage with keeping it at the subscription side is that, > > the subscriber from one node can subscribe with only_local option on > > and a different subscriber from a different node can subscribe with > > only_local option as off. This might not be possible with having the > > option at publisher side. Having it at the subscriber side might give > > more flexibility for the user. > > > > OK. Option 2 needs two publications for that scenario. IMO it's more > intuitive this way, but maybe you wanted to avoid the extra > publications? Yes, I wanted to avoid the extra publication creation that you pointed out. Option 1 can handle this scenario without creating the extra publications: node0: CREATE PUBLICATION p1 FOR TABLE t1; node1: CREATE SUBSCRIPTION s1 ... FOR PUBLICATION p1 with (only_local = on); node2: CREATE SUBSCRIPTION s1 ... FOR PUBLICATION p1 with (only_local = off); I'm ok with both the approaches, now that this scenario can be handled by using both the options. i.e providing only_local option as an option while creating publication or providing only_local option as an option while creating subscription as Peter has pointed out at [1]. option 1: CREATE PUBLICATION p1 FOR TABLE t1; CREATE SUBSCRITION s1 ... FOR PUBLICATION p1 WITH (only_local = true); option 2: CREATE PUBLICATION p1 FOR TABLE t1 WITH (publish = 'only_local'); CREATE SUBSCRITION s1 ... FOR PUBLICATION p1; Shall we get a few opinions on this and take it in that direction? [1] - https://www.postgresql.org/message-id/CAHut%2BPsAWaETh9VMymbBfMrqiE1KuqMq%2BwpBg0s7eMzwLATr%2Bw%40mail.gmail.com Regards, Vignesh