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

Commitb3c630c

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 parent7fe55d5 commitb3c630c

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
@@ -905,7 +905,7 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
905905
returnNULL;
906906

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

947947
/* Re-enable compression for the rest of the file */
948-
if (deflateParams(tar_data->zp,tar_data->compression_level,0)!=Z_OK)
948+
if (deflateParams(tar_data->zp,tar_data->compression_level,
949+
Z_DEFAULT_STRATEGY)!=Z_OK)
949950
{
950951
tar_set_error("could not change compression parameters");
951952
returnNULL;
@@ -1164,7 +1165,7 @@ tar_close(Walfile f, WalCloseMethod method)
11641165
elseif (tar_data->compression_algorithm==PG_COMPRESSION_GZIP)
11651166
{
11661167
/* Turn off compression */
1167-
if (deflateParams(tar_data->zp,0,0)!=Z_OK)
1168+
if (deflateParams(tar_data->zp,0,Z_DEFAULT_STRATEGY)!=Z_OK)
11681169
{
11691170
tar_set_error("could not change compression parameters");
11701171
return-1;
@@ -1176,7 +1177,8 @@ tar_close(Walfile f, WalCloseMethod method)
11761177
return-1;
11771178

11781179
/* Turn compression back on */
1179-
if (deflateParams(tar_data->zp,tar_data->compression_level,0)!=Z_OK)
1180+
if (deflateParams(tar_data->zp,tar_data->compression_level,
1181+
Z_DEFAULT_STRATEGY)!=Z_OK)
11801182
{
11811183
tar_set_error("could not change compression parameters");
11821184
return-1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp