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 1nRBa8-00055k-5b for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Mar 2022 11:31: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 1nRBa5-0003CS-Hp for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Mar 2022 11:31:13 +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 1nRBa5-0003CJ-6z for pgsql-hackers@lists.postgresql.org; Mon, 07 Mar 2022 11:31:13 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nRBa2-0004T9-S9 for pgsql-hackers@lists.postgresql.org; Mon, 07 Mar 2022 11:31:12 +0000 Received: by mail-wr1-x435.google.com with SMTP id n15so8608561wra.6 for ; Mon, 07 Mar 2022 03:31: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=f7MA+E0rQ0JsU9pETEs7pzeMAaT885tF29vJJk+3ZvY=; b=KPP6/7nX9ffXICNIWyD20sBgcSm65/1z9yBcxT7IXazBXF0iE/5Ks3hn2tlhFsIOno MMpMtzSJ6RodSXJ1boI6A+gfmf7G3HbqHE2X1/BQjH7IFU/yXxmn+3BqLYK9wZP2tHvR PrXxPce13F+fjHoVjWzSDpdABR/1Xl95d/YSZeZxTAXw2bLLXjj4vngCslxLSC9rFYoi BZd7YpQ4FlWbBJmfeUnvRJkZtrrBcj4pOFfDs7WxFEmdW+e7FaGOr1NPuH45opasO7ff 9quGeDyPta4SMWvKcssTfZZnDjQbc23fFcI9db6J2xZh3Wj9ns+NQhwr0a7AKmakL7uB 951g== 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=f7MA+E0rQ0JsU9pETEs7pzeMAaT885tF29vJJk+3ZvY=; b=rJ8Ofk/5kPjUoMN8e1ci63Yg2/aXiJfjUFqIOP1Yx4aPz4/oFEiMe88xERxsIUj6jv E5SNVG0swA8hmIE0LwycQiCGh/iAly13Uy+OF52XeUsIc91L8bDECDJtBye4R1IlhIlE y8DyaoAwD2xP9d2SsFApfZTT4kzM/s8GV9UCV6rOemh6Sxh903PXy7vjhf9vDLd2hxDJ YtaKsofiLebmDKa5xubowdu2WyI2Y12DosnSJDTTInC6F42JgUlYKo287Pk5t4BYSPY1 hTQ6/XshpSJSlv1e9Eii/DPN5HY1LDw7k6H3VCxVT7v5guX60PSrNBQEtDH3NHSzvg91 PP2w== X-Gm-Message-State: AOAM533J4/UYXNyDAKhInHDmJdD9l+NuhEwePHdVNR6OOrKLUVCNLZQf qT0yhNAA2YlchzwB8EPf8nGO18BWXA1CSwggsb4= X-Google-Smtp-Source: ABdhPJyO/LJWFumeMHYfQIrzlmiYIKUf/NFeGgnGDeYy83EvGH5TFMX836w/DVlAqNhL0Xj3RJvbggyBh44wL6wSQAQ= X-Received: by 2002:a05:6000:508:b0:1e4:a027:d147 with SMTP id a8-20020a056000050800b001e4a027d147mr7903663wrf.315.1646652669294; Mon, 07 Mar 2022 03:31:09 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ashutosh Bapat Date: Mon, 7 Mar 2022 17:00:56 +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 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 have a similar question for "two_phase" but the ship has sailed and probably it makes some sense there which I don't know. 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. Maybe we want to add it to both and use the stricter of both. If a publication has local_only, it publishes only local changes. If the subscription has local only then WAL sender sends only local changes. -- Best Wishes, Ashutosh