Fix a failure of pg_dump with !HAVE_LIBZ

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Fix a failure of pg_dump with !HAVE_LIBZ
Date: 2016-05-26 09:55:51
Message-ID: 20160526.185551.242041780.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello.

I got the following messages during investigating some other bug,
from pg_dump compiled with --without-zlib.

> $ rm -rf testdump; pg_dump "postgres://horiguti:hoge(at)localhost/postgres" --jobs=9 -Fd -f testdump; echo $?
> pg_dump: [archiver] WARNING: requested compression not available in this installation -- archive will be uncompressed
> pg_dump: [parallel archiver] not built with zlib support
> pg_dump: [archiver (db)] query failed: ERROR: could not import the requested snapshot
> DETAIL: The source transaction 10116 is not running anymore.
> pg_dump: [archiver (db)] query failed: ERROR: invalid snapshot identifier: "00002784-1"
> pg_dump: [archiver (db)] query failed: ERROR: invalid snapshot identifier: "00002784-1"
> 1

The warning says that it makes uncompressed archive but it really
doesn't since workers die unexpectedly from the succeeding
errors. This is because that compressLevel is corrected in
ReadHead(), where too late for it to be propagated to workers.
One reasonable place would be where the default value of
compressLevel is set in main(). (The following errors mentioning
snapshot id are the consequences of unexpected sudden death of
the first worker from this bug, which causes expiration of the
snapshot.)

It works correctly with the patch attached, both on Linux and on
Windows.

> $ rm -rf testdump; pg_dump "postgres://horiguti:hoge(at)localhost/postgres" --jobs=9 -Fd -f testdump; echo $?
> pg_dump: WARNING: requested compression (-1) not available in this installation -- archive will be uncompressed
> 0

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
0001-Fix-compressLevel-correction-for-parallel-mode.patch text/x-patch 1.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2016-05-26 09:57:40 Re: [sqlsmith] Failed assertions on parallel worker shutdown
Previous Message Magnus Hagander 2016-05-26 09:12:06 Re: pg_dump -j against standbys