diff options
author | Pavan Deolasee | 2018-08-03 08:39:12 +0000 |
---|---|---|
committer | Pavan Deolasee | 2018-08-03 08:42:42 +0000 |
commit | 81d499591b2ca1ae17917667765c5bcff19f012d (patch) | |
tree | 87f4a344430df91f3b9df293723622c17f25cc65 | |
parent | 8c9e9a36f9be336c891436c5b4bd4f2eeb30619d (diff) |
Use correct path for tablspaces while creating a basebackup
In XL, we embed the nodename in the tablespace subdir name to ensure that
non-conflicting paths are created when multiple coordinators/datanodes are
running on the same server. The code to handle tablespace mapping in basebackup
was missing this support.
Per report and patch by Wanglin.
-rw-r--r-- | src/backend/replication/basebackup.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c index 9776858f03..ee9e3686b7 100644 --- a/src/backend/replication/basebackup.c +++ b/src/backend/replication/basebackup.c @@ -907,14 +907,17 @@ sendTablespace(char *path, bool sizeonly) { int64 size; char pathbuf[MAXPGPATH]; + char subdirbuf[MAXPGPATH]; struct stat statbuf; /* * 'path' points to the tablespace location, but we only want to include * the version directory in it that belongs to us. */ - snprintf(pathbuf, sizeof(pathbuf), "%s/%s", path, - TABLESPACE_VERSION_DIRECTORY); + snprintf(subdirbuf, sizeof(subdirbuf), "%s_%s", + TABLESPACE_VERSION_DIRECTORY, PGXCNodeName); + snprintf(pathbuf, sizeof(pathbuf), "%s/%s_%s", path, + TABLESPACE_VERSION_DIRECTORY, PGXCNodeName); /* * Store a directory entry in the tar file so we get the permissions @@ -932,8 +935,7 @@ sendTablespace(char *path, bool sizeonly) return 0; } - size = _tarWriteHeader(TABLESPACE_VERSION_DIRECTORY, NULL, &statbuf, - sizeonly); + size = _tarWriteHeader(subdirbuf, NULL, &statbuf, sizeonly); /* Send all the files in the tablespace version directory */ size += sendDir(pathbuf, strlen(path), sizeonly, NIL, true); |