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

Commit542d781

Browse files
committed
Disable silently generation of manifests with servers <= 12 in pg_basebackup
Since 0d8c9c1, pg_basebackup would generate an error if connected to abackend version older than 12 where backup manifests are not supported.Avoiding this error is possible by using the --no-manifest option.This error handling could be confusing for some users, where patching abackup script that interacts with multiple backend versions would causethe addition of --no-manifest to potentially not generate a backupmanifest even for Postgres 13 and newer versions. As we want toencourage the use of backup manifests as much as possible, this commitsilently disables manifests where not supported, instead of generatingan error.While on it, rework a bit the code to make it more consistent with thesurroundings when generating the BASE_BACKUP command.Per discussion with Andres Freund, Stephen Frost, Robert Haas, ÁlvaroHerrera, Kyotaro Horiguchi, Tom Lane, David Steele, and me.Author: Michael PaquierDiscussion:https://postgr.es/m/20200410080910.GZ1606@paquier.xyz
1 parentf0ca378 commit542d781

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

‎src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ typedef void (*WriteDataCallback) (size_t nbytes, char *buf,
108108
*/
109109
#defineMINIMUM_VERSION_FOR_TEMP_SLOTS 100000
110110

111+
/*
112+
* Backup manifests are supported from version 13.
113+
*/
114+
#defineMINIMUM_VERSION_FOR_MANIFESTS130000
115+
111116
/*
112117
* Different ways to include WAL
113118
*/
@@ -1770,7 +1775,7 @@ BaseBackup(void)
17701775
char*basebkp;
17711776
charescaped_label[MAXPGPATH];
17721777
char*maxrate_clause=NULL;
1773-
char*manifest_clause;
1778+
char*manifest_clause=NULL;
17741779
char*manifest_checksums_clause="";
17751780
inti;
17761781
charxlogstart[64];
@@ -1836,15 +1841,6 @@ BaseBackup(void)
18361841

18371842
if (manifest)
18381843
{
1839-
if (serverMajor<1300)
1840-
{
1841-
constchar*serverver=PQparameterStatus(conn,"server_version");
1842-
1843-
pg_log_error("backup manifests are not supported by server version %s",
1844-
serverver ?serverver :"'unknown'");
1845-
exit(1);
1846-
}
1847-
18481844
if (manifest_force_encode)
18491845
manifest_clause="MANIFEST 'force-encode'";
18501846
else
@@ -1853,13 +1849,6 @@ BaseBackup(void)
18531849
manifest_checksums_clause=psprintf("MANIFEST_CHECKSUMS '%s'",
18541850
manifest_checksums);
18551851
}
1856-
else
1857-
{
1858-
if (serverMajor<1300)
1859-
manifest_clause="";
1860-
else
1861-
manifest_clause="MANIFEST 'no'";
1862-
}
18631852

18641853
if (verbose)
18651854
pg_log_info("initiating base backup, waiting for checkpoint to complete");
@@ -1883,7 +1872,7 @@ BaseBackup(void)
18831872
maxrate_clause ?maxrate_clause :"",
18841873
format=='t' ?"TABLESPACE_MAP" :"",
18851874
verify_checksums ?"" :"NOVERIFY_CHECKSUMS",
1886-
manifest_clause,
1875+
manifest_clause ?manifest_clause :"",
18871876
manifest_checksums_clause);
18881877

18891878
if (PQsendQuery(conn,basebkp)==0)
@@ -2589,6 +2578,10 @@ main(int argc, char **argv)
25892578
*/
25902579
umask(pg_mode_mask);
25912580

2581+
/* Backup manifests are supported in 13 and newer versions */
2582+
if (PQserverVersion(conn)<MINIMUM_VERSION_FOR_MANIFESTS)
2583+
manifest= false;
2584+
25922585
/*
25932586
* Verify that the target directory exists, or create it. For plaintext
25942587
* backups, always require the directory. For tar backups, require it

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp