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 1pFyjX-0003zT-NH for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Jan 2023 14:39:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pFyjW-0002Nl-LM for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Jan 2023 14:39:10 +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 1pFyjW-0002Nb-CO for pgsql-hackers@lists.postgresql.org; Thu, 12 Jan 2023 14:39:10 +0000 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pFyjU-0001Uo-3i for pgsql-hackers@postgresql.org; Thu, 12 Jan 2023 14:39:09 +0000 Received: by mail-pg1-x533.google.com with SMTP id r18so12885123pgr.12 for ; Thu, 12 Jan 2023 06:39:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=0yRsvyAzRDV/6NqOKZknSGntYw+o+7HCT4fJiO5bX4U=; b=NkEhQe2igATmaqF90l5PbBLSzTqOs1l3/XuP/6iw7nfLJjQuPOrhYLxtxTolJcwD5M ZJp9bIINcQ0JjB25h3K0hsKvoHVIG/vpeGDEAUeiwilBMU6C5/TF6GG4pFa1O4nIyXaT NETZQa6syK5M+8aeSMWZYgxVc85z2/YOGplMJ8oOVvuTA7Bhh7EZtZrPOok24qmdet+P WsjNXINQ1sQLfmt/k1bTxBKWwc9SlQRtoPRVAbZaXWnETgYpG+cQ25zVGS9TXQPdXtZ+ Kr6YFXxVcyfbVZq5VYk6ZEQzMqw5kzEeQ5BogxcLMuZ7gazEaesNGJrYZv2dXsN9UhIc qIng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0yRsvyAzRDV/6NqOKZknSGntYw+o+7HCT4fJiO5bX4U=; b=fXNniB6TUqm0H8hLiPZl6Bwnl9PwojH2DZ8OL42SLjGxRM3df5h/4fnmH6mi95TmwC MGISRBnxHPcm015xcD6wyIh7NEb+uYq4do9sqb1qiY3lERup5ANaUJQvOYWam6wgC8kl /Vv7QTFKZF7c0DCUj4c9WkPD7otpb5yoaLXTMLmbT1aPa7pjoYsP8SL4fH6UNhgYADzw cUSlSPVXVWX1POjJ3ZEuSY5Spo/yoXF/D38zhOLPzgPQAVgNFtAgEG2ohQYNQb7X5DeM 6IPhe9fQ6E9VoQy9zyxGsnUggSX703uC1tBSuCSb0RAwwPIcy5RmuT5f8BJTiGsEhaiy Iwug== X-Gm-Message-State: AFqh2kr5BOJsCzqqTyOzqpAG/+Cl+9KvJ2ogqxofySjiMJ3kAspeYYNa vLRhNTdvfaYntVg1HY/JXl4+nyoS1WxwP5Zt3X8= X-Google-Smtp-Source: AMrXdXs8m8LF5DxNtgVFsUZTnAHwKM7TqC5yLkik/djXj07++ZS9os8nqwO5x3yMOe/3/DrrLaYs7YVn0IXcRb+HU2I= X-Received: by 2002:a63:d80b:0:b0:478:e542:7d77 with SMTP id b11-20020a63d80b000000b00478e5427d77mr4772195pgh.101.1673534347065; Thu, 12 Jan 2023 06:39:07 -0800 (PST) MIME-Version: 1.0 References: <20221214173552.sshklqvwezeo52h3@alap3.anarazel.de> <1f2ad9fd-53ff-74cc-a602-72d45423bcab@gmail.com> <05c0c4f3-82eb-bc6d-c876-5a265c05927b@gmail.com> <20230106034036.2m4qnn7ep7b5ipet@awork3.anarazel.de> <805540ba-b132-30f2-563d-cf9acc527008@gmail.com> <2d62f212-fce6-d639-b9eb-2a5bc4bec3b4@gmail.com> In-Reply-To: <2d62f212-fce6-d639-b9eb-2a5bc4bec3b4@gmail.com> From: Ashutosh Sharma Date: Thu, 12 Jan 2023 20:08:55 +0530 Message-ID: Subject: Re: Minimal logical decoding on standbys To: "Drouvot, Bertrand" Cc: Andres Freund , Robert Haas , Thomas Munro , Alvaro Herrera , Ibrar Ahmed , Amit Khandekar , fabriziomello@gmail.com, tushar , Rahila Syed , pgsql-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, On Thu, Jan 12, 2023 at 5:29 PM Drouvot, Bertrand wrote: > > Hi, > > On 1/11/23 7:04 PM, Drouvot, Bertrand wrote: > > Hi, > > > > Please find V38 attached, I'll look at the other comments you've done in [1] on 0004 and 0006. > > > > Sorry for joining late. I totally missed it. AFAICU, with this patch users can now do LR from standby, previously they could only do it from the primary server. To start with, I have one small question: I previously participated in the discussion on "Synchronizing the logical replication slots from Primary to Standby" and one of the purposes of that project was to synchronize logical slots from primary to standby so that if failover occurs, it will not affect the logical subscribers of the old primary much. Can someone help me understand how we are going to solve this problem with this patch? Are we going to encourage users to do LR from standby instead of primary to get rid of such problems during failover? Also, one small observation: I just played around with the latest (v38) patch a bit and found that when a new logical subscriber of standby is created, it actually creates two logical replication slots for it on the standby server. May I know the reason for creating an extra replication slot other than the one created by create subscription command? See below: Subscriber: ========= create subscription t1_sub connection 'host=127.0.0.1 port=38500 dbname=postgres user=ashu' publication t1_pub; Standby: ======= postgres=# select * from pg_replication_slots; slot_name | plugin | slot_type | datoid | database | temporary | active | active_pid | xmin | catalog_xmin | restart_lsn | confirmed_flush_lsn | wal_status | safe_w al_size | two_phase -----------------------------------------+----------+-----------+--------+----------+-----------+--------+------------+------+--------------+-------------+---------------------+------------+------- --------+----------- pg_16399_sync_16392_7187728548042694423 | pgoutput | logical | 5 | postgres | f | t | 112595 | | 760 | 0/3082528 | | reserved | | f t1_sub | pgoutput | logical | 5 | postgres | f | t | 111940 | | 760 | 0/30824F0 | 0/3082528 | reserved | | f May I know the reason for creating pg_16399_sync_16392_7187728548042694423? -- With Regards, Ashutosh Sharma.