8000 Make pg_dump behave more sanely when built without HAVE_LIBZ. · eldilibra/postgres@f2f18a3 · GitHub
[go: up one dir, main page]

Skip to content

Commit f2f18a3

Browse files
committed
Make pg_dump behave more sanely when built without HAVE_LIBZ.
For some reason the code to emit a warning and switch to uncompressed output was placed down in the guts of pg_backup_archiver.c. This is definitely too late in the case of parallel operation (and I rather wonder if it wasn't too late for other purposes as well). Put it in pg_dump.c's option-processing logic, which seems a much saner place. Also, the default behavior with custom or directory output format was to emit the warning telling you the output would be uncompressed. This seems unhelpful, so silence that case. Back-patch to 9.3 where parallel dump was introduced. Kyotaro Horiguchi, adjusted a bit by me Report: <20160526.185551.242041780.horiguchi.kyotaro@lab.ntt.co.jp>
1 parent d32bc20 commit f2f18a3

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3298,17 +3298,7 @@ WriteHead(ArchiveHandle *AH)
32983298
(*AH->WriteBytePtr) (AH, AH->intSize);
32993299
(*AH->WriteBytePtr) (AH, AH->offSize);
33003300
(*AH->WriteBytePtr) (AH, AH->format);
3301-
3302-
#ifndef HAVE_LIBZ
3303-
if (AH->compression != 0)
3304-
write_msg(modulename, "WARNING: requested compression not available in this "
3305-
"installation -- archive will be uncompressed\n");
3306-
3307-
AH->compression = 0;
3308-
#endif
3309-
33103301
WriteInt(AH, AH->compression);
3311-
33123302
crtm = *localtime(&AH->createDate);
33133303
WriteInt(AH, crtm.tm_sec);
33143304
WriteInt(AH, crtm.tm_min);

src/bin/pg_dump/pg_dump.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,12 +603,21 @@ main(int argc, char **argv)
603603
/* Custom and directory formats are compressed by default, others not */
604604
if (compressLevel == -1)
605605
{
606+
#ifdef HAVE_LIBZ
606607
if (archiveFormat == archCustom || archiveFormat == archDirectory)
607608
compressLevel = Z_DEFAULT_COMPRESSION;
608609
else
610+
#endif
609611
compressLevel = 0;
610612
}
611613

614+
#ifndef HAVE_LIBZ
615+
if (compressLevel != 0)
616+
write_msg(NULL, "WARNING: requested compression not available in this "
617+
"installation -- archive will be uncompressed\n");
618+
compressLevel = 0;
619+
#endif
620+
612621
/*
613622
* On Windows we can only have at most MAXIMUM_WAIT_OBJECTS (= 64 usually)
614623
* parallel jobs because that's the maximum limit for the

0 commit comments

Comments
 (0)
0