pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Have the server properly terminate tar archives.
Date: Tue, 09 Nov 2021 19:35:46 +0000
Message-ID: <E1mkWuI-0001Hr-Kx@gemulon.postgresql.org> (raw)

Have the server properly terminate tar archives.

Earlier versions of PostgreSQL featured a version of pg_basebackup
that wanted to edit tar archives but was too dumb to parse them
properly. The server made things easier for the client by failing
to add the two blocks of zero bytes that ought to end a tar file,
leaving it up to the client to do that.

But since commit 23a1c6578c87fca0e361c4f5f9a07df5ae1f9858, we
don't need this hack any more, because pg_basebackup is now smarter
and can parse tar files even if they are properly terminated! So
change the server to always properly terminate the tar files. Older
versions of pg_basebackup can't talk to new servers anyway, so
there's no compatibility break.

On the pg_basebackup side, we see still need to add the terminating
zero bytes if we're talking to an older server, but not when the
server is v15+. Hopefully at some point we'll be able to remove
some of this compatibility cruft, but it seems best to hang on to
it for now.

In passing, add a file header comment to bbstreamer_tar.c, to make
it clearer what's going on here.

Discussion: http://postgr.es/m/CA+TgmoZbNzsWwM4BE5Jb_qHncY817DYZwGf+2-7hkMQ27ZwsMQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5a1007a5088cd6ddf892f7422ea8dbaef362372f

Modified Files
--------------
src/backend/replication/basebackup.c   | 16 ++++++++++++++++
src/bin/pg_basebackup/bbstreamer_tar.c | 10 ++++++++++
src/bin/pg_basebackup/pg_basebackup.c  | 25 +++++++++++++++++++------
3 files changed, 45 insertions(+), 6 deletions(-)



Message-ID: <E1mkWuI-0001Hr-Kx@gemulon.postgresql.org>
Permalink:  ../E1mkWuI-0001Hr-Kx@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mkWuI-0001Hr-Kx@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: rhaas@postgresql.org
  Subject: Re: pgsql: Have the server properly terminate tar archives.
  In-Reply-To: <E1mkWuI-0001Hr-Kx@gemulon.postgresql.org>
  References: <E1mkWuI-0001Hr-Kx@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox