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 1rYCm2-00EqrY-W5 for pgsql-admin@arkaria.postgresql.org; Thu, 08 Feb 2024 22:21:39 +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 1rYCm2-003s7z-2z for pgsql-admin@arkaria.postgresql.org; Thu, 08 Feb 2024 22:21:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rYCm1-003rwu-B2 for pgsql-admin@lists.postgresql.org; Thu, 08 Feb 2024 22:21:37 +0000 Received: from tamriel.snowman.net ([70.109.60.50]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rYCly-005mcS-4v for pgsql-admin@lists.postgresql.org; Thu, 08 Feb 2024 22:21:36 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 16A0D5F7B7; Thu, 8 Feb 2024 17:21:29 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=snowman.net; s=dkim; t=1707430889; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3S52uQ8+3mCAmJNSTlsMaVPJGJhciwfH9mTQ1UeD9eA=; b=DGz824tGwK5BOfnNpafdFdX5AYEa7xnplnsqvNN9jaK4yTfQPmjPU4NnIpE0qGbjdw/JLt wAanqUU087K9OZBqBvMPykFmF7z+C2TFR+qWKOxdvbV/cI4M3q6EzOh5RhzvNJ+lipXAu+ lHDK/fmkEibF7jl4RC9IAJdiYxb/FGc= Date: Thu, 8 Feb 2024 17:21:29 -0500 From: Stephen Frost To: Ron Johnson Cc: Pgsql-admin Subject: Re: pg_basebackup --wal-method=fetch Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="buBDo3PYekOKmvob" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.1.4 (2021-12-11) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --buBDo3PYekOKmvob Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Ron Johnson (ronljohnsonjr@gmail.com) wrote: > On Thu, Feb 8, 2024 at 4:41=E2=80=AFPM Stephen Frost = wrote: > > * Ron Johnson (ronljohnsonjr@gmail.com) wrote: > > > On Thu, Feb 8, 2024 at 12:48=E2=80=AFPM Magnus Hagander > > wrote: > > > > On Thu, Feb 8, 2024, 17:05 Ron Johnson > > wrote: > > > >> (PG 14, if it matters.) > > > >> > > > >> What's the purpose of fetch mode, as opposed to streaming mode? Is > > it a > > > >> legacy of bygone days that just hasn't been deprecated, or is there > > > >> something I don't understand from reading > > > >> https://www.postgresql.org/docs/14/app-pgbasebackup.html? > > > > > > > > Your backup can go to a single file with it, which it can't do in > > > > streaming. Which means it can also be sent through a pipe. > > > > > > But isn't the whole purpose of pg_basebackup (running it on Node B, w= hen > > > the database instance is Node A)? > > > > Something seems missing from this question? >=20 > The word "streaming". > Should be "But isn't streaming the whole purpose of pg_basebackup"? I'm a bit confused on this point still as if the whole purpose of pg_basebackup is to be streaming ... then we should be defaulting to fetch mode still? > I use PgBackRest, though, and can't imagine single-threading any > reasonably-sized database. In fact, one of the tasks on my mental TODO > list is to research how to use PgBackRest to initialize a replica instance > prior to starting Streaming Replication. I use pgbackrest too. ;) That said, one of the longest poles in the tent when it comes to dealing with backups is compression- and there are tools like pigz that allow you to multi-thread a single stream across many cores, so it isn't necessarily the case that using fetch mode or pg_basebackup generally makes everything have to be completely single-process. Of course, pgbackrest has a lot of other features that make it a great tool to use. In terms of using pgbackrest to initialize a replica ... that's basically running 'pgbackrest restore --type=3Dstandby'? There's really not much more to it than that. pgbackrest will set up the restored system to replay from the WAL in the archive, you'd just need to configure primary_conninfo so that the replica will attempt to connect to the primary once it's caught up with all of the WAL in the archive. > > > It also needs one connection instead of two to the server, if that's > > > > limited. > > > > > > It's 2024, not 2011. Who can't spare an extra connection? > > > > Changing max_wal_senders requires a database-wide restart, so.. >=20 > To not have some wiggle room is poor planning Doesn't change reality though. > > If so, why? If that's not the angle, > > then what is? Would you suggest some better documentation of the > > option? I'm sure a proposal to improve the docs would be welcome, if > > there's something confusing about them and this option. >=20 > A hint as to the use-case for the non-default "streaming" option would be > enlightening. I mentioned a couple of them above and there is an example of streaming in the documentation today: ###### To create a backup of a single-tablespace local database and compress this with bzip2: $ pg_basebackup -D - -Ft -X fetch | bzip2 > backup.tar.bz2 ###### Would it make things more clear if this was an example that sent data to a tape device instead of through bzip2..? Thanks! Stephen --buBDo3PYekOKmvob Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEwf6gbxKhD863zrx/7WyKOINHZFUFAmXFU+YACgkQ7WyKOINH ZFUzQw/5Abbw/F8bKc7yHJ0OdhZ/I7qg665CQ3aLejjH6QFwFN97Xm+aHytruq7K iqDTtrMJ4y7hpLHm+gXoc2vYM16nhDvJ4IF3LCA8N2rMN7NMFE4N9JnQHmnlvu3/ EHi+Nsx42Wvq8xx2H2VyaZTSqjChGqPVKx7SArUuoEAJ6ypKj69DEceTG0dn1POG ehAW0lnhu57NbmSgeTVr/4hBVjtTFv86vWuMoTVj0yDmoRYxRF0VjhLAQN6UfElq LNO7NiBAr8YTqSv7DcSSE0ncq61r3s4/qghHd9quJAbcj1Hr/fKgZLoAgCIzeNyE etg+mmRLo59kTg/os0nw2rK6orZs6kYTAwuxiXDkEfU4SO8+yVdXcQSMpi985IUV tDs0Zw+69nyb7a6JKc8zu5pTc/7My3JuwE0+/0+2lvwtnQQJJ05EVlZIK2/iqc5u Q09TBYF0QsyBesV76fk369GkhCX1udoDKUtybj0hL/C1GAATPhltVUbr8JkUt/2W uVlqWfwty/D0C/+wieZDNZ1H2BXxXTZ3/XXfpvEL1CTaZg+KUdF5+xbpe9rqMLwf M5iNiRvhSSyp6o7wH38oMH0FofSgBbxX+Z44Q7JriH/aaal5tKlVta+LctyfFgxg cCQfzRzpNhX7XLhl+yU1vA6i4SN+9JFL0eOPZo9SIWYuNA7Nt54= =P7Pc -----END PGP SIGNATURE----- --buBDo3PYekOKmvob--