Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r0i1d-007Ild-BW for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Nov 2023 12:51:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r0i1b-003Iv7-Hw for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Nov 2023 12:51:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r0i1a-003Ius-NE for pgsql-hackers@lists.postgresql.org; Wed, 08 Nov 2023 12:51:15 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r0i1X-005LkM-Ct for pgsql-hackers@lists.postgresql.org; Wed, 08 Nov 2023 12:51:13 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 94ECD5C0124; Wed, 8 Nov 2023 07:51:08 -0500 (EST) Received: from imap49 ([10.202.2.99]) by compute2.internal (MEProxy); Wed, 08 Nov 2023 07:51:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerto.com; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1699447868; x=1699534268; bh=Lx 3uqulsZuefvB1lt2UdN1UVFISTj2uLAlFWvPeE9cY=; b=D/azWTOl6N1QJtRNv4 /qRPK5vHiAYC2jHFB2Ab04PQO0h16KtQQYEDmUshi1NcZv4DvRMB5Tos3T0khj14 3KZX3MEwVKw3CuZ1Ebh33ViOjrY2NbeNfRY+ywwJoBYgj99bhUBDgITDCKxwUwNx SQau3YUGi1TcUWHUgNUB2S9bI4kZLL0xjOsweE6xe6ea41PiFOgMk+nk48+u2ZsI z5orZyJx3V997Cr+KpuQkYHIJiURp77vdbJYVLEqBwLnG2IjfFjAwjBrDoejj+cv DSV58bT4cPR+57T9VbY3Xek5TJqwctb5JtzHDe5LkfQWvL2tS3mXxcsPlYRbio38 26Yg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1699447868; x=1699534268; bh=Lx3uqulsZuefv B1lt2UdN1UVFISTj2uLAlFWvPeE9cY=; b=p1DJuFNVUMiGxB0HXzGFiQTgPcCEI lOtbiNgL4JXJyjd/5pYr8k2SAGI2aP4mcJrMe9gRKRRZa6JjsKccvI80zbxAZTTr mGOaLUK6QpXP/5dB8+4C5/OHCq+xPax2113QWLLnHNYQo63KNV130M/GgDSuKks5 sImClXAoixtgRocuOy3Hx+4yICc6hZ0cyURu1RlhApOm1s+hQOb/OQaA3eM6/5bk qNSI85c5hFsVzAGneiUpzmAcP4owm/zZnoDoAh1mPuqOCINqgTFg0TnyBHCOGGes PbGih+SbLPwkdkd5MTQdWmgmpVhMx9fWl65OkYX7pMKsDTkrKU1sTtLew== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudduledggeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsegrtderreerredtnecuhfhrohhmpedfgfhu lhgvrhcuvfgrvhgvihhrrgdfuceovghulhgvrhesvghulhgvrhhtohdrtghomheqnecugg ftrfgrthhtvghrnhepgfffjedviedvkedviedvteduieekudeivedthffhuddvteegleet ieffkeeghfdvnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegvuhhlvghrsegv uhhlvghrthhordgtohhm X-ME-Proxy: Feedback-ID: i0c21471d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id D104C15A0091; Wed, 8 Nov 2023 07:51:07 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1108-g3a29173c6d-fm-20231031.005-g3a29173c MIME-Version: 1.0 Message-Id: In-Reply-To: References: <5ac50071-f2ed-4ace-a8fd-b892cffd33eb@www.fastmail.com> <4710d895-689a-4ae6-b8e3-344286dbf970@app.fastmail.com> Date: Wed, 08 Nov 2023 09:50:47 -0300 From: "Euler Taveira" To: "Michael Paquier" , "Peter Eisentraut" Cc: pgsql-hackers@lists.postgresql.org, "Amit Kapila" , "Andres Freund" Subject: Re: speed up a logical replica setup Content-Type: multipart/alternative; boundary=24687dd2a16d4f86912e2f0920b889ae List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --24687dd2a16d4f86912e2f0920b889ae Content-Type: text/plain 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/ --24687dd2a16d4f86912e2f0920b889ae Content-Type: text/html Content-Transfer-Encoding: quoted-printable
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 m= ake sense to put this tool (whatever the name)
> into t= he pg_basebackup directory?  It's sort of related, and it also shar= es
> some code.

I used the CreateReplicationSlot() from streamutil.h but decided to u= se the
CREATE_REPLICATION_SLOT command directly because it= needs the LSN as output. As
you noticed at that time I wo= uldn't like a dependency in the pg_basebackup
header files= ; if we move this binary to base backup directory, it seems natural
<= /div>
to refactor the referred function and use it.
I've read th= e 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?

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

- And if it would be be= tter to refactor some of the code generic to
all these str= eaming tools to fe_utils.  What makes streamutil.h a bit
<= div>less pluggable are all its extern variables to control the connectio= n,
but perhaps that can be an advantage, as well, in some = cases.

I like it. There are co= mmon functions such as GetConnection(),
CreateReplicationS= lot(), DropReplicationSlot() and RunIdentifySystem() that is
used by all of these replication tools. We can move the extern variab= les into
parameters to have a pluggable streamutil.h.
<= /div>


--
Euler Taveira
=

--24687dd2a16d4f86912e2f0920b889ae--