Re: pg_basebackup's --gzip switch misbehaves
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2022-09-13T07:13:20Z
Lists: pgsql-hackers
Attachments
- 0001-Simplify-compression-level-handling-in-compression-s.patch (text/x-diff) patch 0001
On Sun, Sep 04, 2022 at 02:20:52PM +0900, Michael Paquier wrote: > ffd5365 has missed that wal_compress_level should be set to > Z_DEFAULT_COMPRESSION if there is nothing set in the compression > spec for a zlib build. pg_receivewal.c enforces that already. So, I have looked at this one. And it seems to me that the confusion comes down to the existence of PG_COMPRESSION_OPTION_LEVEL. I have considered a couple of approaches here, like introducing an extra routine in compression.c to assign a default compression level, but my conclusion is at the end simpler: we always finish by setting up a level even if the caller wants nothing, in which can we can just use each library's default. And lz4, zstd and zlib are able to handle the case where a default is given down to their internal routines just fine. Attached is the patch I am finishing with, consisting of: - the removal of PG_COMPRESSION_OPTION_LEVEL. - assigning a default compression level when nothing is specified in the spec. - a couple of complifications in pg_receivewal, pg_basebackup and the backend code as there is no need to worry about the compression level. A nice effect of this approach is that we can centralize the checks on lz4, zstd and zlib when a build does not support any of these options, as well as centralize the place where the default compression levels are set. This passes all the regression tests, and it fixes the issue reported. (Note that I have yet to run tests with all the libraries disabled in ./configure.) Thoughts? -- Michael
Commits
-
Make PG_TEST_NOCLEAN work for temporary directories in TAP tests
- 45cfa87e9c56 11.21 landed
- af36c13a7e92 12.16 landed
- b102e80ab822 13.12 landed
- c8987ea90cf2 14.9 landed
- 4b15868b698a 15.4 landed
- c24e9ef330ac 16.0 landed
- 8c12838001c2 17.0 landed
-
doc: document the TAP test environment variables
- c4421550fb57 16.0 landed
-
doc: update metacpan.org links to avoid redirects
- 5f80cd287c29 16.0 landed
-
Use min/max bounds defined by Zstd for compression level
- ade925e1693a 15.0 landed
- 18ac08f0b42d 16.0 landed
-
Fix incorrect value for "strategy" with deflateParams() in walmethods.c
- a9e99ff6b4ac 10.23 landed
- f01cc02259df 11.18 landed
- adb371c9cd95 12.13 landed
- a94576c377b7 13.9 landed
- 4b529f4697f3 14.6 landed
- b3c630cc9230 15.0 landed
- b447d6075db8 16.0 landed
-
Simplify handling of compression level with compression specifications
- 53332eacaff6 15.0 landed
- f352e2d08ac0 16.0 landed