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 1mrXzd-0007En-A7 for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Nov 2021 04:10:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mrXzb-0002dm-6w for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Nov 2021 04:10: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 1mrXza-0002dc-R7 for pgsql-hackers@lists.postgresql.org; Mon, 29 Nov 2021 04:10:14 +0000 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mrXzY-0007hl-Fx for pgsql-hackers@postgresql.org; Mon, 29 Nov 2021 04:10:13 +0000 Received: by mail-pg1-x52a.google.com with SMTP id 71so14669143pgb.4 for ; Sun, 28 Nov 2021 20:10:12 -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:content-transfer-encoding; bh=6p6u3lOr1axV76Qs+oXxy5wX9SnqwDnDIXwIfwJI8HY=; b=kJHtTRXD3zTTARfuXtwkU0mafE7QJbjy4kbHpRX4pm2D0XaGmfRJUd8Bz7X2zzvIB5 Rj0yo02vJzdgKNyGvyZ6CuUemRVaxVOYSDITVvC76ns6/mBFq7/hzOhta8we3j1TFeFN RjOtU2k4gYXxeJ1UwseBPG5Oon2kwzpqpOwu5SuWoBNLP5kiuXo/CrveZZTBgitl5uDD k/JlSjKLwJLBNabIH4u/J0DJ2CkHyifErDfGRMHnSWf/K4eUYTboVjXqKY/rcCVLAgq0 4GmTv9dVn5kM0Kl65dU9DMKa+ND9oj7v5q98HamcV/gfVxcsvHx6a4ZN062SxIc+IZHw Lz3g== 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:content-transfer-encoding; bh=6p6u3lOr1axV76Qs+oXxy5wX9SnqwDnDIXwIfwJI8HY=; b=bMdPTd72ep+JtQVoU93Fpnhwzd9RRzuo3/f6OMeBFtW8zE9J+xg/xiUi/F9sIx4HHX Zzt377EgwvWSqmLbQsjtKznTBsYHDZfjYoYI5Z0V1f21HbOE5DwPm005NPI3CAweqIHI oIm3HuhktkxOwcZknD9DRRqtkNZm54a7Mzcn7of9k7PwIhzAGLLstoGk1DP0pbEwAGVO rGesOlXRrzEMYApl0mwQff0EXISQLKyyYw8XEs5t7HO26tiGgWY9pP0WlL8JYkXCgywO 4qRy9QoaRu54+Pb6jhLCmvWX3RWfWEc9blNLlLGdp2wvwzF9gAauessZF7YN1L+FHwGy a0aw== X-Gm-Message-State: AOAM530woNVWVfAlc61/YGrFBlytDMVirZD952daYT8OumOU4vFKmZ13 BeRH+dD1TK2SHipKnpt6RWdR1sOzdmMUjUfBEIk= X-Google-Smtp-Source: ABdhPJzpk3fWUAqYt9ZcquQ2wv2D9xxeLsWtwmHbqP63kFSJK88Kia8SMM2erLXG9P9anC8iFJ+pGs/SPVgszIhzc44= X-Received: by 2002:a63:cf06:: with SMTP id j6mr33497983pgg.100.1638159011219; Sun, 28 Nov 2021 20:10:11 -0800 (PST) MIME-Version: 1.0 References: <514f6f2f-6833-4539-39f1-96cd1e011f23@enterprisedb.com> In-Reply-To: From: Bharath Rupireddy Date: Mon, 29 Nov 2021 09:39:59 +0530 Message-ID: Subject: Re: Synchronizing slots from primary to standby To: SATYANARAYANA NARLAPURAM Cc: Peter Eisentraut , 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 Mon, Nov 29, 2021 at 1:48 AM SATYANARAYANA NARLAPURAM wrote: > >> 3) Instead of the subscriber pulling the slot info, why can't the >> publisher (via the walsender or a new bg worker maybe?) push the >> latest slot info? I'm not sure we want to add more functionality to >> the walsender, if yes, isn't it going to be much simpler? > > Standby pulling the information or at least making a first attempt to con= nect to the primary is a better design as primary doesn't need to spend it= s cycles repeatedly connecting to an unreachable standby. In fact, primary = wouldn't even need to know the followers, for example followers / log shipp= ing standbys My idea was to let the existing walsender from the primary/publisher to send the slot info (both logical and physical replication slots) to the standby/subscriber, probably by piggybacking the slot info with the WAL currently it sends. Having said that, I don't know the feasibility of it. Anyways, I'm not in favour of having a new bg worker to just ship the slot info. The standby/subscriber, while making connection to primary/publisher, can choose to get the replication slot info. As I said upthread, the problem I see with standby/subscriber pulling the info is that: how frequently the standby/subscriber is going to sync the slot info from primary/publisher? How can it ensure that the latest information exists say when the subscriber is down/crashed before it picks up the latest slot information? IIUC, the initial idea proposed in this patch deals with only logical replication slots not the physical replication slots, what I'm thinking is to have a generic way to deal with both of them. Note: In the above description, I used primary-standby and publisher-subscriber to represent the physical and logical replication slots respectively. Regards, Bharath Rupireddy.