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 1nRCMW-0007gh-MU for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Mar 2022 12:21:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nRCMV-0008Px-8G for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Mar 2022 12:21:15 +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 1nRCMU-0008Po-Sw for pgsql-hackers@lists.postgresql.org; Mon, 07 Mar 2022 12:21:14 +0000 Received: from mail-yb1-xb29.google.com ([2607:f8b0:4864:20::b29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nRCMQ-0004xO-Ha for pgsql-hackers@lists.postgresql.org; Mon, 07 Mar 2022 12:21:13 +0000 Received: by mail-yb1-xb29.google.com with SMTP id g26so30458201ybj.10 for ; Mon, 07 Mar 2022 04:21:10 -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=ibLVgkemvYZVHkOihszV4gkL8Xntrg+Q8TOBych6Fww=; b=Vy5NgNT2gPtlBgTTrLilITaC8f8s6a5diORxRRIN69fTvxBu90g6EEvdEB5V2bXwFt feahl/sOfQc5kvoJDeti1xhVSgEYdcTIaMQtescOiyw5N8Wkqjyiz9kRCy79i/SoPeoG TQy0ooa5/eHLVROd5HU262xtLEOi6VEdsiYZgNtNIy3cdTYuljgGMu0wW+SDdK73ME5/ o5r5cnLzYmha847UBX+XROuyugQH4dTVtdfGG+32cXUdPHxBHNIEsL44KHZCLWoydYYj UmTf1tQ0xC0+XV0m7QLAvewPWgWNnsR+4dnP04MKUSHN8jK6naLSOX4o3Bf3A+IL8/rS YTLw== 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=ibLVgkemvYZVHkOihszV4gkL8Xntrg+Q8TOBych6Fww=; b=YCPyDpBIjyNWWTltTGqpnX9ih8ybP7894ZLrhHn8aSReBdQwdkPKpGiXqeqbBuhjf9 3+jPY+qehaFxr2nTkTp3OEL6olKj9s2gGvDhVLDr9M+jNroertgYGsvyWfPrCIGjt58d +Xy26uUdApi/beA4H0Jn3QDm/ZCaChQdh9SXqQCor9926qmlnfGrG/Bkw4AXxStsrnbX fMLaG5lKWWKCP8OT3SghDStV2oVkJue+YpgCgPgLSnMBXBfvt/Ebx8SGzkoYDcO6y7pq CypWxrT2gGE7z+358uWvgRqYG5OJ0vv3an2uq9ykZcu8afuTmHBFaHhm12kx2u4RKcNi P5nQ== X-Gm-Message-State: AOAM533BtZTYGxwXeqoTljhwH1ewW2I4hqP/oSNgdhA24Mdz/EgZyIui 1+ZunMm5LjSVbvBo9T/JXq1l06PrggoQpw91/WY= X-Google-Smtp-Source: ABdhPJwFUix+2Q/Dbyu4+7U2C0kFiBfe+nyPHs5ptG1wK/e26/mtRyIpoV7u/R6Lx6XBOiPxJdvj+lTwpXQpaoyz49U= X-Received: by 2002:a25:2d0a:0:b0:629:3290:2d02 with SMTP id t10-20020a252d0a000000b0062932902d02mr4107056ybt.317.1646655669481; Mon, 07 Mar 2022 04:21:09 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Mon, 7 Mar 2022 17:50:59 +0530 Message-ID: Subject: Re: Handle infinite recursion in logical replication setup To: Ashutosh Bapat Cc: vignesh C , 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 5:01 PM Ashutosh Bapat wrote: > > Hi Vignesh, > I agree with Peter's comment that the changes to > FilterRemoteOriginData() should be part of FilterByOrigin() > > Further, I wonder why "onlylocal_data" is a replication slot's > property. A replication slot tracks the progress of replication and it > may be used by different receivers with different options. I could > start one receiver which wants only local data, say using > "pg_logical_slot_get_changes" and later start another receiver which > fetches all the data starting from where the first receiver left. This > option prevents such flexibility. > > As discussed earlier in the thread, local_only can be property of > publication or subscription, depending upon the use case, but I can't > see any reason that it should be tied to a replication slot. > I thought it should be similar to 'streaming' option of subscription but may be Vignesh has some other reason which makes it different. > I have a similar question for "two_phase" but the ship has sailed and > probably it makes some sense there which I don't know. > two_phase is different from some of the other subscription options like 'streaming' such that it can be enabled only at the time of slot and subscription creation, we can't change/specify it via pg_logical_slot_get_changes. This is to avoid the case where we won't know at the time of the commit prepared whether the prepare for the transaction has already been sent. For the same reason, we need to also know the 'two_phase_at' information. > As for publication vs subscription, I think both are useful cases. > 1. It will be a publication's property, if we want the node to not > publish any data that it receives from other nodes for a given set of > tables. > 2. It will be the subscription's property, if we want the subscription > to decide whether it wants to fetch the data changed on only upstream > or other nodes as well. > I think it could be useful to allow it via both publication and subscription but I guess it is better to provide it via one way initially just to keep things simple and give users some way to deal with such cases. I would prefer to allow it via subscription initially for the reasons specified by Vignesh in his previous email [1]. Now, if we think those all are ignorable things and it is more important to allow this option first by publication or we must allow it via both publication and subscription then it makes sense to change it. [1] - https://www.postgresql.org/message-id/CALDaNm3jkotRhKfCqu5CXOf36_yiiW_cYE5%3DbG%3Dj6N3gOWJkqw%40mail.gmail.com -- With Regards, Amit Kapila.