Subject: [PATCH v48 7/7] Exclude pg_stat directory from base backup

From: Kyotaro Horiguchi <[email-masked]>
Date: Tue, 29 Sep 2020 23:19:58 +0900

basebackup sends the content of pg_stat directory, which is doomed to
be removed at startup from the backup. Now that pg_stat_statements
saves a temporary file into the directory, let exclude pg_stat
directory from a base backup.
---
 src/backend/replication/basebackup.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index f0d75f55bd..f54fcec70a 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -149,6 +149,13 @@ struct exclude_list_item
  */
 static const char *const excludeDirContents[] =
 {
+	/*
+	 * Skip statistics files. PGSTAT_STAT_PERMANENT_DIRECTORY must be skipped
+	 * because the files in the directory will be removed at startup from the
+	 * backup.
+	 */
+	PGSTAT_STAT_PERMANENT_DIRECTORY,
+
 	/*
 	 * It is generally not useful to backup the contents of this directory
 	 * even if the intention is to restore to another primary. See backup.sgml
-- 
2.27.0

----Next_Part(Fri_Mar__5_17_18_56_2021_497)----