diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_basebackup/pg_basebackup.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c index 65ca1b16f0c..faa69d14ceb 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -109,6 +109,11 @@ typedef void (*WriteDataCallback) (size_t nbytes, char *buf, #define MINIMUM_VERSION_FOR_TEMP_SLOTS 100000 /* + * Backup manifests are supported from version 13. + */ +#define MINIMUM_VERSION_FOR_MANIFESTS 130000 + +/* * Different ways to include WAL */ typedef enum @@ -1770,7 +1775,7 @@ BaseBackup(void) char *basebkp; char escaped_label[MAXPGPATH]; char *maxrate_clause = NULL; - char *manifest_clause; + char *manifest_clause = NULL; char *manifest_checksums_clause = ""; int i; char xlogstart[64]; @@ -1836,15 +1841,6 @@ BaseBackup(void) if (manifest) { - if (serverMajor < 1300) - { - const char *serverver = PQparameterStatus(conn, "server_version"); - - pg_log_error("backup manifests are not supported by server version %s", - serverver ? serverver : "'unknown'"); - exit(1); - } - if (manifest_force_encode) manifest_clause = "MANIFEST 'force-encode'"; else @@ -1853,13 +1849,6 @@ BaseBackup(void) manifest_checksums_clause = psprintf("MANIFEST_CHECKSUMS '%s'", manifest_checksums); } - else - { - if (serverMajor < 1300) - manifest_clause = ""; - else - manifest_clause = "MANIFEST 'no'"; - } if (verbose) pg_log_info("initiating base backup, waiting for checkpoint to complete"); @@ -1883,7 +1872,7 @@ BaseBackup(void) maxrate_clause ? maxrate_clause : "", format == 't' ? "TABLESPACE_MAP" : "", verify_checksums ? "" : "NOVERIFY_CHECKSUMS", - manifest_clause, + manifest_clause ? manifest_clause : "", manifest_checksums_clause); if (PQsendQuery(conn, basebkp) == 0) @@ -2589,6 +2578,10 @@ main(int argc, char **argv) */ umask(pg_mode_mask); + /* Backup manifests are supported in 13 and newer versions */ + if (PQserverVersion(conn) < MINIMUM_VERSION_FOR_MANIFESTS) + manifest = false; + /* * Verify that the target directory exists, or create it. For plaintext * backups, always require the directory. For tar backups, require it |