mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Invent on_exit_nicely for pg_dump.
Per recent discussions on pgsql-hackers regarding parallel pg_dump.
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
|
||||
#include "compress_io.h"
|
||||
#include "dumpmem.h"
|
||||
#include "dumputils.h"
|
||||
|
||||
/*----------------------
|
||||
* Compressor API
|
||||
@@ -109,8 +110,8 @@ ParseCompressionOption(int compression, CompressionAlgorithm *alg, int *level)
|
||||
*alg = COMPR_ALG_NONE;
|
||||
else
|
||||
{
|
||||
die_horribly(NULL, modulename, "Invalid compression code: %d\n",
|
||||
compression);
|
||||
exit_horribly(modulename, "Invalid compression code: %d\n",
|
||||
compression);
|
||||
*alg = COMPR_ALG_NONE; /* keep compiler quiet */
|
||||
}
|
||||
|
||||
@@ -133,7 +134,7 @@ AllocateCompressor(int compression, WriteFunc writeF)
|
||||
|
||||
#ifndef HAVE_LIBZ
|
||||
if (alg == COMPR_ALG_LIBZ)
|
||||
die_horribly(NULL, modulename, "not built with zlib support\n");
|
||||
exit_horribly(modulename, "not built with zlib support\n");
|
||||
#endif
|
||||
|
||||
cs = (CompressorState *) pg_calloc(1, sizeof(CompressorState));
|
||||
@@ -169,7 +170,7 @@ ReadDataFromArchive(ArchiveHandle *AH, int compression, ReadFunc readF)
|
||||
#ifdef HAVE_LIBZ
|
||||
ReadDataFromArchiveZlib(AH, readF);
|
||||
#else
|
||||
die_horribly(NULL, modulename, "not built with zlib support\n");
|
||||
exit_horribly(modulename, "not built with zlib support\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -187,7 +188,7 @@ WriteDataToArchive(ArchiveHandle *AH, CompressorState *cs,
|
||||
#ifdef HAVE_LIBZ
|
||||
return WriteDataToArchiveZlib(AH, cs, data, dLen);
|
||||
#else
|
||||
die_horribly(NULL, modulename, "not built with zlib support\n");
|
||||
exit_horribly(modulename, "not built with zlib support\n");
|
||||
#endif
|
||||
case COMPR_ALG_NONE:
|
||||
return WriteDataToArchiveNone(AH, cs, data, dLen);
|
||||
@@ -234,9 +235,9 @@ InitCompressorZlib(CompressorState *cs, int level)
|
||||
cs->zlibOutSize = ZLIB_OUT_SIZE;
|
||||
|
||||
if (deflateInit(zp, level) != Z_OK)
|
||||
die_horribly(NULL, modulename,
|
||||
"could not initialize compression library: %s\n",
|
||||
zp->msg);
|
||||
exit_horribly(modulename,
|
||||
"could not initialize compression library: %s\n",
|
||||
zp->msg);
|
||||
|
||||
/* Just be paranoid - maybe End is called after Start, with no Write */
|
||||
zp->next_out = (void *) cs->zlibOut;
|
||||
@@ -343,9 +344,9 @@ ReadDataFromArchiveZlib(ArchiveHandle *AH, ReadFunc readF)
|
||||
out = pg_malloc(ZLIB_OUT_SIZE + 1);
|
||||
|
||||
if (inflateInit(zp) != Z_OK)
|
||||
die_horribly(NULL, modulename,
|
||||
"could not initialize compression library: %s\n",
|
||||
zp->msg);
|
||||
exit_horribly(modulename,
|
||||
"could not initialize compression library: %s\n",
|
||||
zp->msg);
|
||||
|
||||
/* no minimal chunk size for zlib */
|
||||
while ((cnt = readF(AH, &buf, &buflen)))
|
||||
@@ -514,7 +515,7 @@ cfopen_write(const char *path, const char *mode, int compression)
|
||||
fp = cfopen(fname, mode, 1);
|
||||
free(fname);
|
||||
#else
|
||||
die_horribly(NULL, modulename, "not built with zlib support\n");
|
||||
exit_horribly(modulename, "not built with zlib support\n");
|
||||
fp = NULL; /* keep compiler quiet */
|
||||
#endif
|
||||
}
|
||||
@@ -541,7 +542,7 @@ cfopen(const char *path, const char *mode, int compression)
|
||||
fp = NULL;
|
||||
}
|
||||
#else
|
||||
die_horribly(NULL, modulename, "not built with zlib support\n");
|
||||
exit_horribly(modulename, "not built with zlib support\n");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user