Content-Length: 283115 | pFad | http://github.com/postgrespro/postgres/commit/dabf63bc9a5b71f61c2c8712c85d33fdc06efa8c

0C pg_basebackup: Fix a couple of recently-introduced bugs. · postgrespro/postgres@dabf63b · GitHub
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/dabf63bc9a5b71f61c2c8712c85d33fdc06efa8c

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy