pgbackrest.git / summary / log / commit / refs
commit 8dce7bbb608c65a16a4e41ae2cd95c588154e9e0
Author: David Steele <dwsteele@users.noreply.github.com>
Commit: GitHub <noreply@github.com>
Date: Mon Sep 14 14:15:40 2020 +0000
Ignore backup_manifest in PG13.
This file is created by pg_basebackup so might be in the data directory if the cluster was restored from a pg_basebackup backup. Also exclude backup_manifest.tmp since it is possible to find that in the backup directory.
doc/xml/release.xml | 9 +++++++++
src/info/manifest.c | 3 +++
src/postgres/interface.h | 2 ++
test/src/module/info/manifestTest.c | 25 ++++++++++++++++++++++---
4 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/doc/xml/release.xml b/doc/xml/release.xml
index 1af4ed118..a83b03c14 100644
--- a/doc/xml/release.xml
+++ b/doc/xml/release.xml
@@ -15,6 +15,15 @@
<release date="XXXX-XX-XX" version="2.30dev" title="UNDER DEVELOPMENT">
<release-core-list>
<release-improvement-list>
+ <release-item>
+ <release-item-contributor-list>
+ <release-item-contributor id="david.steele"/>
+ <release-item-reviewer id="cynthia.shang"/>
+ </release-item-contributor-list>
+
+ <p>Ignore <file>backup_manifest</file> in <postgres/> 13.</p>
+ </release-item>
+
<release-item>
<release-item-contributor-list>
<release-item-contributor id="david.steele"/>
diff --git a/src/info/manifest.c b/src/info/manifest.c
index 60f1f8921..47673223e 100644
--- a/src/info/manifest.c
+++ b/src/info/manifest.c
@@ -608,6 +608,9 @@ manifestBuildCallback(void *data, const StorageInfo *info)
(strEqZ(info->name, PG_FILE_BACKUPLABEL) && pgVersion >= PG_VERSION_96) ||
// Skip old backup labels
strEqZ(info->name, PG_FILE_BACKUPLABELOLD) ||
+ // Skip backup_manifest/tmp in versions where it is created
+ ((strEqZ(info->name, PG_FILE_BACKUPMANIFEST) || strEqZ(info->name, PG_FILE_BACKUPMANIFEST_TMP)) &&
+ pgVersion >= PG_VERSION_13) ||
// Skip running process options
strEqZ(info->name, PG_FILE_POSTMASTEROPTS) ||
// Skip process id file to avoid confusing postgres after restore
diff --git a/src/postgres/interface.h b/src/postgres/interface.h
index a560f07f4..b3263a308 100644
--- a/src/postgres/interface.h
+++ b/src/postgres/interface.h
@@ -16,6 +16,8 @@ Defines for various Postgres paths and files
***********************************************************************************************************************************/
#define PG_FILE_BACKUPLABEL "backup_label"
#define PG_FILE_BACKUPLABELOLD "backup_label.old"
+#define PG_FILE_BACKUPMANIFEST "backup_manifest"
+#define PG_FILE_BACKUPMANIFEST_TMP "backup_manifest.tmp"
#define PG_FILE_PGCONTROL "pg_control"
#define PG_FILE_PGFILENODEMAP "pg_filenode.map"
#define PG_FILE_PGINTERNALINIT "pg_internal.init"
diff --git a/test/src/module/info/manifestTest.c b/test/src/module/info/manifestTest.c
index b04206fa5..187fbfb43 100644
--- a/test/src/module/info/manifestTest.c
+++ b/test/src/module/info/manifestTest.c
@@ -107,6 +107,15 @@ testRun(void)
"db-system-id=0\n" \
"db-version=\"12\"\n"
+ #define TEST_MANIFEST_DB_13 \
+ "\n" \
+ "[backup:db]\n" \
+ "db-catalog-version=202007201\n" \
+ "db-control-version=1300\n" \
+ "db-id=0\n" \
+ "db-system-id=0\n" \
+ "db-version=\"13\"\n"
+
#define TEST_MANIFEST_OPTION_ALL \
"\n" \
"[backup:option]\n" \
@@ -940,6 +949,14 @@ testRun(void)
// create pg_xlog/wal as a link
storagePathCreateP(storageTest, STRDEF("wal"), .mode = 0700);
+ // Create backup_manifest and backup_manifest.tmp that will show up for PG12 but will be ignored in PG13
+ storagePutP(
+ storageNewWriteP(storagePgWrite, STRDEF(PG_FILE_BACKUPMANIFEST), .modeFile = 0600, .timeModified = 1565282198),
+ BUFSTRDEF("MANIFEST"));
+ storagePutP(
+ storageNewWriteP(storagePgWrite, STRDEF(PG_FILE_BACKUPMANIFEST_TMP), .modeFile = 0600, .timeModified = 1565282199),
+ BUFSTRDEF("MANIFEST"));
+
// Test manifest - 'pg_data/pg_tblspc' will appear in manifest but 'pg_tblspc' will not (no links). Recovery signal files
// and backup_label ignored. Old recovery files and pg_xlog are now just another file/directory and will not be ignored.
// pg_wal contents will be ignored online. pg_clog pgVersion > 10 master:true, pg_xact pgVersion > 10 master:false
@@ -964,6 +981,8 @@ testRun(void)
"\n"
"[target:file]\n"
"pg_data/PG_VERSION={\"size\":3,\"timestamp\":1565282100}\n"
+ "pg_data/backup_manifest={\"mode\":\"0600\",\"size\":8,\"timestamp\":1565282198}\n"
+ "pg_data/backup_manifest.tmp={\"mode\":\"0600\",\"size\":8,\"timestamp\":1565282199}\n"
"pg_data/base/1/555_init={\"master\":false,\"size\":0,\"timestamp\":1565282114}\n"
"pg_data/base/1/555_init.1={\"master\":false,\"size\":0,\"timestamp\":1565282114}\n"
"pg_data/base/1/555_vm.1_vm={\"master\":false,\"size\":0,\"timestamp\":1565282114}\n"
@@ -1008,10 +1027,10 @@ testRun(void)
"check manifest");
// -------------------------------------------------------------------------------------------------------------------------
- TEST_TITLE("rerun 12, offline");
+ TEST_TITLE("run 13, offline");
// pg_wal not ignored
- TEST_ASSIGN(manifest, manifestNewBuild(storagePg, PG_VERSION_12, false, false, NULL, NULL), "build manifest");
+ TEST_ASSIGN(manifest, manifestNewBuild(storagePg, PG_VERSION_13, false, false, NULL, NULL), "build manifest");
contentSave = bufNew(0);
TEST_RESULT_VOID(manifestSave(manifest, ioBufferWriteNew(contentSave)), "save manifest");
@@ -1019,7 +1038,7 @@ testRun(void)
strNewBuf(contentSave),
strNewBuf(harnessInfoChecksumZ(hrnReplaceKey(
TEST_MANIFEST_HEADER
- TEST_MANIFEST_DB_12
+ TEST_MANIFEST_DB_13
TEST_MANIFEST_OPTION_ALL
"\n"
"[backup:target]\n"
[parent: fc77c511824f]