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 1nR98x-0004pt-SP for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Mar 2022 08:55:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nR98w-00025B-Ka for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Mar 2022 08:55:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nR98w-000252-9c for pgsql-hackers@lists.postgresql.org; Mon, 07 Mar 2022 08:55:02 +0000 Received: from mail-yb1-xb2e.google.com ([2607:f8b0:4864:20::b2e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nR98p-0003Lt-Po for pgsql-hackers@lists.postgresql.org; Mon, 07 Mar 2022 08:55:01 +0000 Received: by mail-yb1-xb2e.google.com with SMTP id h126so29531517ybc.1 for ; Mon, 07 Mar 2022 00:54: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=gUt0VT3wwLecKiDqLdtVAYJaN5w7DaYaErpyldF2F4A=; b=Mbf3Uw+4lGg8b86H3ofnyZ1xfzlWqypkrXDrBN3BI/3bCjL6atsYmyrFWb3aG+2drt GN6HjQW0LcnmHykSZKGLya+i+D7IQNicjEUjVdrIAIGWjYigUgSaQW1PL2wOIgGDMTAu GvfDLscsJL4UITyCBZTgVeWrkuwgGl9AoIm5aHuDEO94y2mQXaKmx87SdeRFmduyBnzF cgxuKAlLH9v/Ls09WOkjDrNjKd+02X7fT2bNO20RwvM6/FQL8g0LP8TEMiL76kasob3F XX36B0Iw0A7i+9dznUMgUvDCVpDU3SsXsyS0JS7IIaCg5aiR5PNGxGtZ/HUxkYH0xEhH GUnA== 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=gUt0VT3wwLecKiDqLdtVAYJaN5w7DaYaErpyldF2F4A=; b=pQEQryJ927A+dPUW8nSw5XCjyqVX+XsUNaW6+md0t5jp1kXzn4s0Xspt14R/2ODQzS A2vnnnThuCTg1TA0AgI7UTYLTEq9yUOWlBqw6SPawPXqxAYR3fTxyU4H5hS3ayd9UaLs 2k573TZokSQHkFuwmvCVt7waNWGKyqQb9cxGufc7o24BKc9ikX07dzl0SQkYrzZBfPhp zUAbjFj3tCtK22ih6gbSsXHzFtK0weE1w4NkBnceJ+ODZeFu80KRO6jDFZoIS4F608wP 4gxUR/lYHx3ofoDg5zazsajjF5utWdAkUCO74hPXuXL+ZqwZTwES2TdnqTdN36T5ej+M VAJw== X-Gm-Message-State: AOAM532ea/tiP2VoOixC7Pvd5KG5cYjMfbIMc7AVJuJ/r/7UEVFOthFz MZJ4UQkvGQsx1Yl8Fws+2xxqoJhakiM9SnmvLHo= X-Google-Smtp-Source: ABdhPJxn5T+JWwx3/WNWEWOD2PRYwGA/0jdT4g0M4bNh5YtuWSe5v+SYIUGECIxH+BKESm8L1orztfxJbiQytAgS0W4= X-Received: by 2002:a25:d194:0:b0:629:1ac3:fed0 with SMTP id i142-20020a25d194000000b006291ac3fed0mr5908912ybg.495.1646643294743; Mon, 07 Mar 2022 00:54:54 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Mon, 7 Mar 2022 14:24:43 +0530 Message-ID: Subject: Re: Handle infinite recursion in logical replication setup To: vignesh C Cc: Peter Smith , "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 12:48 PM vignesh C wrote: > > 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? > Allowing multiple publications will lead to a lot of duplicate data in catalogs like pg_publication_rel, so, I don't see how option-2 can be beneficial? -- With Regards, Amit Kapila.