Exclude backup_manifest file that existed in database, from BASE_BACKUP.
authorFujii Masao <fujii@postgresql.org>
Thu, 9 Apr 2020 13:37:11 +0000 (22:37 +0900)
committerFujii Masao <fujii@postgresql.org>
Thu, 9 Apr 2020 13:37:11 +0000 (22:37 +0900)
If there is already a backup_manifest file in the database cluster,
it belongs to the past backup that was used to start this server.
It is not correct for the backup being taken now. So this commit
changes pg_basebackup so that it always skips such backup_manifest
file. The backup_manifest file for the current backup will be injected
separately if users want it.

Author: Fujii Masao
Reviewed-by: Robert Haas
Discussion: https://postgr.es/m/78f76a3d-1a28-a97d-0394-5c96985dd1c0@oss.nttdata.com

src/backend/replication/basebackup.c
src/bin/pg_rewind/filemap.c

index 5d94b9c22911bc715f2be186f2d7942ac0b91571..50a9e9c28040fe76935b4a9525cd1b6656f15cf0 100644 (file)
@@ -266,6 +266,14 @@ static const struct exclude_list_item excludeFiles[] =
    {BACKUP_LABEL_FILE, false},
    {TABLESPACE_MAP, false},
 
+   /*
+    * If there's a backup_manifest, it belongs to a backup that was used to
+    * start this server. It is *not* correct for this backup. Our
+    * backup_manifest is injected into the backup separately if users want
+    * it.
+    */
+   {"backup_manifest", false},
+
    {"postmaster.pid", false},
    {"postmaster.opts", false},
 
index 9088f1f80fcb172527b0931aab66242498863b38..254efee0be344b0ad32b5f72bc32af1d549e76ad 100644 (file)
@@ -113,6 +113,14 @@ static const struct exclude_list_item excludeFiles[] =
    {"backup_label", false},    /* defined as BACKUP_LABEL_FILE */
    {"tablespace_map", false},  /* defined as TABLESPACE_MAP */
 
+   /*
+    * If there's a backup_manifest, it belongs to a backup that was used to
+    * start this server. It is *not* correct for this backup. Our
+    * backup_manifest is injected into the backup separately if users want
+    * it.
+    */
+   {"backup_manifest", false},
+
    {"postmaster.pid", false},
    {"postmaster.opts", false},