Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb447d60

Browse files
committed
Fix incorrect value for "strategy" with deflateParams() in walmethods.c
The zlib documentation mentions the values supported for the compressionstrategy, but this code has been using a hardcoded value of 0 ratherthan Z_DEFAULT_STRATEGY. This commit adjusts the code to useZ_DEFAULT_STRATEGY.Backpatch down to where this code has been added to ease the backport ofany future patch touching this area.Reported-by: Tom LaneDiscussion:https://postgr.es/m/1400032.1662217889@sss.pgh.pa.usBackpatch-through: 10
1 parentd583036 commitb447d60

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎src/bin/pg_basebackup/walmethods.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
904904
returnNULL;
905905

906906
/* Turn off compression for header */
907-
if (deflateParams(tar_data->zp,0,0)!=Z_OK)
907+
if (deflateParams(tar_data->zp,0,Z_DEFAULT_STRATEGY)!=Z_OK)
908908
{
909909
tar_set_error("could not change compression parameters");
910910
returnNULL;
@@ -944,7 +944,8 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
944944
returnNULL;
945945

946946
/* Re-enable compression for the rest of the file */
947-
if (deflateParams(tar_data->zp,tar_data->compression_level,0)!=Z_OK)
947+
if (deflateParams(tar_data->zp,tar_data->compression_level,
948+
Z_DEFAULT_STRATEGY)!=Z_OK)
948949
{
949950
tar_set_error("could not change compression parameters");
950951
returnNULL;
@@ -1162,7 +1163,7 @@ tar_close(Walfile f, WalCloseMethod method)
11621163
elseif (tar_data->compression_algorithm==PG_COMPRESSION_GZIP)
11631164
{
11641165
/* Turn off compression */
1165-
if (deflateParams(tar_data->zp,0,0)!=Z_OK)
1166+
if (deflateParams(tar_data->zp,0,Z_DEFAULT_STRATEGY)!=Z_OK)
11661167
{
11671168
tar_set_error("could not change compression parameters");
11681169
return-1;
@@ -1174,7 +1175,8 @@ tar_close(Walfile f, WalCloseMethod method)
11741175
return-1;
11751176

11761177
/* Turn compression back on */
1177-
if (deflateParams(tar_data->zp,tar_data->compression_level,0)!=Z_OK)
1178+
if (deflateParams(tar_data->zp,tar_data->compression_level,
1179+
Z_DEFAULT_STRATEGY)!=Z_OK)
11781180
{
11791181
tar_set_error("could not change compression parameters");
11801182
return-1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp