pg_dump - tar format and compression - Mailing list pgsql-hackers

From Stephen Frost
Subject pg_dump - tar format and compression
Date
Msg-id 20160425142454.GG10850@tamriel.snowman.net
Whole thread Raw
List pgsql-hackers
Greetings,

I'm working through the code coverage challenges for pg_dump and thought
I'd take on an easy one- pg_backup_tar.c.  Unfortunately, that turned
out to be not quite so simple as I had hoped.

As far as I can see, pg_dump's tar format doesn't support either writing
out or reading in compressed files, however, there's a bunch of

#ifdef HAVE_LIBZ
....
#else
#endif

code in pg_backup_tar.c.

Trying to create a compressed tar backup using:

pg_dump -Ft -Z5 -f test.tar.gz

Results in:

pg_dump: [tar archiver] compression is not supported by tar archive format

Running it without -Z5, then compressing the file and giving it to
pg_restore (even with -Ft) results in:

pg_restore -Ft test.tar.gz
pg_restore: [tar archiver] corrupt tar header found in�'W (expected 0, computed 63963) file position 512

(without -Ft, you get:

pg_restore test.tar.gz
pg_restore: [archiver] input file does not appear to be a valid archive

).

So, am I missing something here?  The comments at the top of
pg_backup_tar.c indicate that it was copied from pg_backup_file.c, but
if we're not going to support compressed tar files, then we should
really rip that code out, otherwise it's just confusing.

If I'm not missing anything and this is really just dead code, then I'm
willing to look at ripping that code out once I'm through the current
project of providing decent test coverage to pg_dump, but this does seem
like it'd be perfect project for a relative newcomer to hacking on PG..

Thanks!

Stephen

pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Updated backup APIs for non-exclusive backups
Next
From: Robert Haas
Date:
Subject: Re: pg_stat_activity crashes