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 1qIhhX-0005vG-4q for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Jul 2023 03:36:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qIhhW-0004cz-0A for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Jul 2023 03:36:38 +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 1qIhhV-0004cq-LL for pgsql-hackers@lists.postgresql.org; Mon, 10 Jul 2023 03:36:37 +0000 Received: from mail-oa1-x35.google.com ([2001:4860:4864:20::35]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qIhhT-00304V-7Q for pgsql-hackers@postgresql.org; Mon, 10 Jul 2023 03:36:36 +0000 Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-1b0249f1322so3344893fac.3 for ; Sun, 09 Jul 2023 20:36:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688960194; x=1691552194; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=6uE5D3gHVwUeirYKyOomb/3se+Z6Fi1hHecLlVpOUKM=; b=bzInKQz+sgGKtlVnnABFD7+/aTNp6gs+fI5xjMkT8Z4kY+aKKG9vh0R66wzx81mwPe ByoM9gVMLaPeFUsRny5uhwkaV5U+rZRWDxa+tBpGucq9prTstBx0SdFdtJ/Ys76MRa7c KCz3Qo/Zu58kUdLFxMWFAAbwyyU3ZsLH0Q0L2i0Ble86xH7aKBCzYmag5vnlzalhF2/c 9q6Bf9ZjTfG/gUm3Tp8UphYTo0HVBzV9f5hMImvSo0A3n2+X1Ss13EQUE4hj/u8HYyl0 UQwfppJs/E+ta5Mxa2paakn2UcrmvGXV+63qeICeQkUn3hjHE+YWWaO0/qYPloUrI2Uw gDdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688960194; x=1691552194; h=content-transfer-encoding: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=6uE5D3gHVwUeirYKyOomb/3se+Z6Fi1hHecLlVpOUKM=; b=IRLlYYcWnrleiJQT3wRbdPQd5lz+QKFgZ/IoeEvbSxSyFwDSu6/n1HtSennwmOOfRO RQvN9ves7hfyYQodBdDUgcl/B5ANkJRWxymeTNS4CsjBR3d4of/dS0GsyqMwJeFBzoaS zKIdEfVMEiGb6UZv9IqtlV6Z6pMdATSBFstekQhzad5lBkzAirycQcsf1fIyf0No3+Rh 95bayeuM/2tPfGXSdHOPY3gr1jSWMfpf0KNRQWHBhyQeb6gBJCa2sr910tvM1mpj8pqE Kef2lUOuegKJ6HzwU4jQ82Xr61UaAOhd2SoVLwZDo/HyTNay4LjF3GimFL6evVyfwV1H Xdzg== X-Gm-Message-State: ABy/qLZ75yrdwl0HLdZMFKcBIf2Mro+SsePl+ljGCKNFb6axOZmi15WD fYhFXn/2UwQpluuq2/KoGMcKc2zMHzlZvfx+dpA= X-Google-Smtp-Source: APBJJlHqY/LGB1EVzgDFQ/etwVWQe0zPQWmO52RCwmPeJTj7JfYVQW+zV4MTfnmOdjAlOLiQQlBn7XrtsjwhJnOEgfQ= X-Received: by 2002:a05:6870:c8a0:b0:1b0:67a9:3089 with SMTP id er32-20020a056870c8a000b001b067a93089mr10988114oab.57.1688960194247; Sun, 09 Jul 2023 20:36:34 -0700 (PDT) MIME-Version: 1.0 References: <514f6f2f-6833-4539-39f1-96cd1e011f23@enterprisedb.com> <18dbc929-a281-8552-4f1d-7e4d0e4eedba@enterprisedb.com> <646acd8d-9896-ed8d-2ab4-0bf11b3285d4@enterprisedb.com> <20220205195944.drwc3psrb5udt2cw@alap3.anarazel.de> <20220207203222.22aktwxrt3fcllru@alap3.anarazel.de> In-Reply-To: From: Amit Kapila Date: Mon, 10 Jul 2023 09:06:22 +0530 Message-ID: Subject: Re: Synchronizing slots from primary to standby To: Bharath Rupireddy Cc: "Drouvot, Bertrand" , Peter Eisentraut , Bruce Momjian , Ashutosh Sharma , Andres Freund , pgsql-hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Jul 9, 2023 at 1:01=E2=80=AFPM Bharath Rupireddy wrote: > > On Fri, Jun 16, 2023 at 3:26=E2=80=AFPM Amit Kapila wrote: > > > > > > 1. Can you please try to explain the functionality of the overall > > patch somewhere in the form of comments and or commit message? > > IIUC, there are 2 core ideas of the feature: > > 1) It will never let the logical replication subscribers go ahead of > physical replication standbys specified in standby_slot_names. It > implements this by delaying decoding of commit records on the > walsenders corresponding to logical replication subscribers on the > primary until all the specified standbys confirm receiving the commit > LSN. > > 2) The physical replication standbys will synchronize data of the > specified logical replication slots (in synchronize_slot_names) from > the primary, creating the logical replication slots if necessary. > Since the logical replication subscribers will never go out of > physical replication standbys, the standbys can safely synchronize the > slots and keep the data necessary for subscribers to connect to it and > work seamlessly even after a failover. > > If my understanding is right, > This matches my understanding as well. > I have few thoughts here: > > 1. All the logical walsenders are delayed on the primary - per > wait_for_standby_confirmation() despite the user being interested in > only a few of them via synchronize_slot_names. Shouldn't the delay be > for just the slots specified in synchronize_slot_names? > 2. I think we can split the patch like this - 0001 can be the logical > walsenders delaying decoding on the primary unless standbys confirm, > 0002 standby synchronizing the logical slots. > Agreed with the above two points. > 3. I think we need to change the GUC standby_slot_names to better > reflect what it is used for - wait_for_replication_slot_names or > wait_for_ > I feel at this stage we can focus on getting the design and implementation correct. We can improve GUC names later once we are confident that the functionality is correct. > 4. It allows specifying logical slots in standby_slot_names, meaning, > it can disallow logical slots getting ahead of other logical slots > specified in standby_slot_names. Should we allow this case with the > thinking that if there's anyone using logical replication for failover > (well, will anybody do that in production?). > I think on the contrary we should prohibit this case. We can always extend this functionality later. > 5. Similar to above, it allows specifying physical slots in > synchronize_slot_names. Should we disallow? > We should prohibit that as well. --=20 With Regards, Amit Kapila.