Re: [HACKERS] Don't include MMAP DSM's transient files in basebackup

2016-07-07 Thread Andres Freund
On 2016-07-07 08:49:18 +0100, Magnus Hagander wrote:
> On Thursday, July 7, 2016, Andres Freund  wrote:
> 
> > On 2016-07-06 16:46:53 +0300, Oskari Saarenmaa wrote:
> > > 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.
> >
> > No arguments against the change. But I am wondering how you ran into
> > this - the mmap dsm backend really should pretty much never be used...
> >
> >
> Unfortunately I think that's still what happens by default if you use
> pg_upgradecluster on debian :(

Ugh. Sounds like that should better be fixed before 9.6. It'll make
parallel query seriously slower.

Andres


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


Re: [HACKERS] Don't include MMAP DSM's transient files in basebackup

2016-07-07 Thread Magnus Hagander
On Thursday, July 7, 2016, Andres Freund  wrote:

> On 2016-07-06 16:46:53 +0300, Oskari Saarenmaa wrote:
> > 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.
>
> No arguments against the change. But I am wondering how you ran into
> this - the mmap dsm backend really should pretty much never be used...
>
>
Unfortunately I think that's still what happens by default if you use
pg_upgradecluster on debian :(

//Magnus



-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


Re: [HACKERS] Don't include MMAP DSM's transient files in basebackup

2016-07-07 Thread Andres Freund
Hi,

On 2016-07-06 16:46:53 +0300, Oskari Saarenmaa wrote:
> 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.

No arguments against the change. But I am wondering how you ran into
this - the mmap dsm backend really should pretty much never be used...

- Andres


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


Re: [HACKERS] Don't include MMAP DSM's transient files in basebackup

2016-07-07 Thread Michael Paquier
On Wed, Jul 6, 2016 at 10:46 PM, Oskari Saarenmaa  wrote:
> The files are not useful when restoring a backup and would be automatically
> deleted on startup anyway.

The same could be said about pg_snapshots.
-- 
Michael


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


[HACKERS] Don't include MMAP DSM's transient files in basebackup

2016-07-06 Thread Oskari Saarenmaa
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 
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