Re: speed up a logical replica setup

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: "Michael Paquier" <michael(at)paquier(dot)xyz>, "Peter Eisentraut" <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, "Amit Kapila" <amit(dot)kapila16(at)gmail(dot)com>, "Andres Freund" <andres(at)anarazel(dot)de>
Subject: Re: speed up a logical replica setup
Date: 2023-11-08 12:50:47
Message-ID: a24899ab-858d-4497-a447-c02852fe21e9@app.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 7, 2023, at 8:12 PM, Michael Paquier wrote:
> On Tue, Nov 07, 2023 at 10:00:39PM +0100, Peter Eisentraut wrote:
> > Speaking of which, would it make sense to put this tool (whatever the name)
> > into the pg_basebackup directory? It's sort of related, and it also shares
> > some code.

I used the CreateReplicationSlot() from streamutil.h but decided to use the
CREATE_REPLICATION_SLOT command directly because it needs the LSN as output. As
you noticed at that time I wouldn't like a dependency in the pg_basebackup
header files; if we move this binary to base backup directory, it seems natural
to refactor the referred function and use it.

> I've read the patch, and the additions to streamutil.h and
> streamutil.c make it kind of natural to have it sit in pg_basebackup/.
> There's pg_recvlogical already there. I am wondering about two
> things, though:
> - Should the subdirectory pg_basebackup be renamed into something more
> generic at this point? All these things are frontend tools that deal
> in some way with the replication protocol to do their work. Say
> a replication_tools?

It is a good fit for this tool since it is another replication tool. I also
agree with the directory renaming; it seems confusing that the directory has
the same name as one binary but also contains other related binaries in it.

> - And if it would be better to refactor some of the code generic to
> all these streaming tools to fe_utils. What makes streamutil.h a bit
> less pluggable are all its extern variables to control the connection,
> but perhaps that can be an advantage, as well, in some cases.

I like it. There are common functions such as GetConnection(),
CreateReplicationSlot(), DropReplicationSlot() and RunIdentifySystem() that is
used by all of these replication tools. We can move the extern variables into
parameters to have a pluggable streamutil.h.

--
Euler Taveira
EDB https://www.enterprisedb.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2023-11-08 12:55:02 Re: meson documentation build open issues
Previous Message Zakhlystov, Daniil (Nebius) 2023-11-08 12:44:09 Re: Force the old transactions logs cleanup even if checkpoint is skipped