aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2018-03-27 16:14:40 +0300
committerTeodor Sigaev <teodor@sigaev.ru>2018-03-27 16:14:40 +0300
commit920a5e500a119b03356fb1fb64a677eb1aa5fc6f (patch)
tree8830b4fe2fd32cbc6b81787d3aa70c4410044499 /src/backend
parent3ad55863e9392bff73377911ebbf9760027ed405 (diff)
downloadpostgresql-920a5e500a119b03356fb1fb64a677eb1aa5fc6f.tar.gz
postgresql-920a5e500a119b03356fb1fb64a677eb1aa5fc6f.zip
Skip temp tables from basebackup.
Do not store temp tables in basebackup, they will not be visible anyway, so, there are not reasons to store them. Author: David Steel Reviewed by: me Discussion: https://www.postgresql.org/message-id/flat/5ea4d26a-a453-c1b7-eff9-5a3ef8f8aceb@pgmasters.net
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/replication/basebackup.c10
-rw-r--r--src/backend/storage/file/fd.c3
2 files changed, 11 insertions, 2 deletions
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index e4c45c50256..654d0832da2 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -1072,6 +1072,16 @@ sendDir(const char *path, int basepathlen, bool sizeonly, List *tablespaces,
}
}
+ /* Exclude temporary relations */
+ if (isDbDir && looks_like_temp_rel_name(de->d_name))
+ {
+ elog(DEBUG2,
+ "temporary relation file \"%s\" excluded from backup",
+ de->d_name);
+
+ continue;
+ }
+
snprintf(pathbuf, sizeof(pathbuf), "%s/%s", path, de->d_name);
/* Skip pg_control here to back up it last */
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 2a18e94ff49..d30a725f900 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -325,7 +325,6 @@ static void RemovePgTempFilesInDir(const char *tmpdirname, bool missing_ok,
bool unlink_all);
static void RemovePgTempRelationFiles(const char *tsdirname);
static void RemovePgTempRelationFilesInDbspace(const char *dbspacedirname);
-static bool looks_like_temp_rel_name(const char *name);
static void walkdir(const char *path,
void (*action) (const char *fname, bool isdir, int elevel),
@@ -3192,7 +3191,7 @@ RemovePgTempRelationFilesInDbspace(const char *dbspacedirname)
}
/* t<digits>_<digits>, or t<digits>_<digits>_<forkname> */
-static bool
+bool
looks_like_temp_rel_name(const char *name)
{
int pos;