Skip to content

Commit dabf63b

Browse files
committed
pg_basebackup: Fix a couple of recently-introduced bugs.
The server expects the compression level to be between 1 and 9, but Z_DEFAULT_COMPRESSION is -1, so we must not try to send that value to the server. Because pg_basebackup's -R option is implemented on the client side, it can't be used in combination with a backup target. Error out if someone tries that, instead of silently ignoring the option. Both issues were reported by Tushar Ahuja; patch by me. Discussion: http://postgr.es/m/CA+TgmoaMwgdx8HxBjF8hmbohVvPL_0H5LqNrSq0uU+7BKp_Q2A@mail.gmail.com
1 parent acea505 commit dabf63b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1871,6 +1871,12 @@ BaseBackup(void)
18711871
exit(1);
18721872
}
18731873

1874+
if (writerecoveryconf)
1875+
{
1876+
pg_log_error("recovery configuration cannot be written when a backup target is used");
1877+
exit(1);
1878+
}
1879+
18741880
AppendPlainCommandOption(&buf, use_new_option_syntax, "TABLESPACE_MAP");
18751881

18761882
if ((colon = strchr(backup_target, ':')) == NULL)
@@ -1913,7 +1919,7 @@ BaseBackup(void)
19131919
}
19141920
AppendStringCommandOption(&buf, use_new_option_syntax,
19151921
"COMPRESSION", compressmethodstr);
1916-
if (compresslevel != 0)
1922+
if (compresslevel != 0 && compresslevel != Z_DEFAULT_COMPRESSION)
19171923
AppendIntegerCommandOption(&buf, use_new_option_syntax,
19181924
"COMPRESSION_LEVEL", compresslevel);
19191925
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy