The files are not useful when restoring a backup and would be automatically deleted on startup anyway. Also deleted an out-of-date comment in dsm.c.

/ Oskari
>From f26f06049b5f89ca3140462d6816259268322d78 Mon Sep 17 00:00:00 2001
From: Oskari Saarenmaa <o...@aiven.io>
Date: Wed, 6 Jul 2016 16:35:39 +0300
Subject: [PATCH] Don't include MMAP DSM's transient files in basebackup

Also drop an out-of-date comment about AllocateDir usage in dsm.c.
---
 src/backend/replication/basebackup.c | 6 +++---
 src/backend/storage/ipc/dsm.c        | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index da9b7a6..8867ad2 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -976,10 +976,10 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces,
 		}
 
 		/*
-		 * Skip pg_replslot, not useful to copy. But include it as an empty
-		 * directory anyway, so we get permissions right.
+		 * Skip pg_replslot and pg_dynshmem, not useful to copy. But include
+		 * them as empty directories anyway, so we get permissions right.
 		 */
-		if (strcmp(de->d_name, "pg_replslot") == 0)
+		if (strcmp(de->d_name, "pg_replslot") == 0 || strcmp(de->d_name, "pg_dynshmem") == 0)
 		{
 			if (!sizeonly)
 				_tarWriteHeader(pathbuf + basepathlen + 1, NULL, &statbuf);
diff --git a/src/backend/storage/ipc/dsm.c b/src/backend/storage/ipc/dsm.c
index 47f2bea..57fecdb 100644
--- a/src/backend/storage/ipc/dsm.c
+++ b/src/backend/storage/ipc/dsm.c
@@ -293,7 +293,6 @@ dsm_cleanup_for_mmap(void)
 	DIR		   *dir;
 	struct dirent *dent;
 
-	/* Open the directory; can't use AllocateDir in postmaster. */
 	if ((dir = AllocateDir(PG_DYNSHMEM_DIR)) == NULL)
 		ereport(ERROR,
 				(errcode_for_file_access(),
-- 
2.5.5

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to