pgsql: Have the server properly terminate tar archives. - Mailing list pgsql-committers

From Robert Haas
Subject pgsql: Have the server properly terminate tar archives.
Date
Msg-id E1mkWuI-0001Hr-Kx@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: Remove check for accept() argument types
Next
From: Michael Paquier
Date:
Subject: Re: pgsql: Fix incorrect format placeholder.