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 1nRUgT-0006n8-C6 for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Mar 2022 07:55:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nRUgS-0002Z7-6h for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Mar 2022 07:55:04 +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 1nRUgR-0002Yy-Tu for pgsql-hackers@lists.postgresql.org; Tue, 08 Mar 2022 07:55:03 +0000 Received: from mail-yw1-x1129.google.com ([2607:f8b0:4864:20::1129]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nRUgP-0002nA-Rx for pgsql-hackers@lists.postgresql.org; Tue, 08 Mar 2022 07:55:03 +0000 Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-2dbd8777564so192387287b3.0 for ; Mon, 07 Mar 2022 23:55:01 -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=A+2U+ab3Zd2L2sqFhGLFXYhJhIDNmGfkqUeHZ7luI8I=; b=VN1xWY2tpUPPGhuMdde7ItRm9K60mm1VwcvsflFpQOKh+qzTr1wZY0sZ4pgdoQO0mc ZO4zfOYwjPOlXmw8XdqUpXhamJ4Iqb4YusMEY4PWehusrQj0d72CEBtO0s2VApuiAN33 uzMeWkfeYzKOlZoJcsn+iJFKTZM6P7mfOQmpdDnwbUsQtWCZJgeI8fdj6rJoMNwHR82r QE6NpCgMDCZetLDDsi5ZnjdS+llwJxjkShvoz14KdSdIp1CBe5lzTZWMK0wldLtAmXRK jYHDMx79/vuTRomrqIU8L0ON0rcaZnbGpSgiPtEdUNQvrRUxQHvsf1olHb3rOpRdL4ot Ynsw== 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=A+2U+ab3Zd2L2sqFhGLFXYhJhIDNmGfkqUeHZ7luI8I=; b=D4i7qtYx1FWsuJmLcgrQFjGmfzKK1qkLYG+Z/IQxFNEmjnbl2MKH7UDgmlh1Sy6CoV 3cwoZK8hXlQIQfu2XxFhQvVKOakd972MXLw9RqEm9aJwAYr9/v2WpFX6ZcPv/XGDKs3a Wf03RtipcIwjPnDirfOTNkL3gzCD809qfYxr2K8ED2JK0aKEWTRkxgI/wV8OMf7t9o4/ 9h1N3mjCr3K+zE1cIYTDfGaHHAO4KZjBjezdV5kvcXlisRHTNFnobLe0Lslq7/pE8JW1 kWpFbX/1YubN2iUz33VujdycQzO/sAxxTX8x33gZoJTbPJYKxMtELmU7jMjzMtEhK7LW SHyw== X-Gm-Message-State: AOAM5320nbPesXqLqco7hZH2RKektcLX/oGlKrtPEkS+YH12wUB10OLi xcuQz2sQJD9kxTMfbuOyUMmLP/768K8XP7Yi93+PoTTD7Ensag== X-Google-Smtp-Source: ABdhPJyiqF/eggjoJC+Xryr8ys1Bw/gvxq/vgN3UKrzmX6jHec3hRGI8X6mJvBCuct/tkhNCbd77OqCWna+V331p2II= X-Received: by 2002:a81:194d:0:b0:2dc:51c:ea26 with SMTP id 74-20020a81194d000000b002dc051cea26mr11894515ywz.223.1646726099260; Mon, 07 Mar 2022 23:54:59 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Tue, 8 Mar 2022 13:24:47 +0530 Message-ID: Subject: Re: Handle infinite recursion in logical replication setup To: Peter Smith Cc: vignesh C , Ashutosh Bapat , "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 Tue, Mar 8, 2022 at 12:17 PM Peter Smith wrote: > > On Tue, Mar 8, 2022 at 4:21 PM Amit Kapila wrote: > > > > On Tue, Mar 8, 2022 at 10:31 AM Peter Smith wrote: > > > > > > IIUC the new option may be implemented subscriber-side and/or > > > publisher-side and/or both, and the subscriber-side option may be > > > "enhanced" in future to prevent cycles. And probably there are more > > > features I don't know about or that have not yet been thought of. > > > > > > ~~ > > > > > > Even if the plan is only to implement just one part now and then add > > > more later, I think there still should be some consideration for what > > > you expect all possible future options to look like, because that may > > > affect current implementation choices. > > > > > > The point is: > > > > > > - we should take care so don't accidentally end up with an option that > > > turned out to be inconsistent looking on the subscriber-side / > > > publisher-side. > > > > > > - we should try to avoid accidentally painting ourselves into a corner > > > (e.g. stuck with a boolean option that cannot be enhanced later on) > > > > > > > Agreed. I think it is important to see we shouldn't do something which > > is not extendable in future or paint us in the corner. But, as of now, > > with the current proposal, the main thing we should consider is > > whether exposing the boolean option is okay or shall we do something > > different so that we can extend it later to specific origin ids? > > > > I was wondering, assuming later there is an enhancement to detect and > prevent cycles using origin ids, then what really is the purpose of > the option? > We can't use origin ids during the initial sync as we can't differentiate between data from local or remote node. Also, how will we distinguish between different origins? AFAIU, all the changes applied on any particular node use the same origin. > I can imagine if a cycle happens should probably log some one-time > WARNING (just to bring it to the user's attention in case it was > caused by some accidental misconfiguration) but apart from that why > would this need to be an option at all - i.e. is there a use-case > where a user would NOT want to prevent a recursive error? > I think there will be plenty of such setups where there won't be a need for any such option like where users won't need bi-directional replication for the same table. -- With Regards, Amit Kapila.