summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas2020-06-17 15:05:42 +0000
committerRobert Haas2020-06-17 15:05:42 +0000
commit453e0e3f0ef3202386b553719f628cef93ff95a7 (patch)
tree29ac2d906933b9968604d6c9b9b3e8caa04c7bc6 /src
parent1fa092913d260056b1aaf627ebc9cd9655c3a27c (diff)
Minor code cleanup for perform_base_backup().
Merge two calls to sendDir() that are exactly the same except for the fifth argument. Adjust comments to match. Also, don't bother checking whether tblspc_map_file is NULL. We initialize it in all cases, so it can't be. Patch by me, reviewed by Amit Kapila and Kyotaro Horiguchi. Discussion: http://postgr.es/m/CA+TgmoYq+59SJ2zBbP891ngWPA9fymOqntqYcweSDYXS2a620A@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r--src/backend/replication/basebackup.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index 62633e7ddcd..efcf1e6eb56 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -269,7 +269,7 @@ perform_base_backup(basebackup_options *opt)
XLogRecPtr endptr;
TimeLineID endtli;
StringInfo labelfile;
- StringInfo tblspc_map_file = NULL;
+ StringInfo tblspc_map_file;
backup_manifest_info manifest;
int datadirpathlen;
List *tablespaces = NIL;
@@ -424,25 +424,23 @@ perform_base_backup(basebackup_options *opt)
if (ti->path == NULL)
{
struct stat statbuf;
+ bool sendtblspclinks = true;
/* In the main tar, include the backup_label first... */
sendFileWithContent(BACKUP_LABEL_FILE, labelfile->data,
&manifest);
- /*
- * Send tablespace_map file if required and then the bulk of
- * the files.
- */
- if (tblspc_map_file && opt->sendtblspcmapfile)
+ /* Then the tablespace_map file, if required... */
+ if (opt->sendtblspcmapfile)
{
sendFileWithContent(TABLESPACE_MAP, tblspc_map_file->data,
&manifest);
- sendDir(".", 1, false, tablespaces, false,
- &manifest, NULL);
+ sendtblspclinks = false;
}
- else
- sendDir(".", 1, false, tablespaces, true,
- &manifest, NULL);
+
+ /* Then the bulk of the files... */
+ sendDir(".", 1, false, tablespaces, sendtblspclinks,
+ &manifest, NULL);
/* ... and pg_control after everything else. */
if (lstat(XLOG_CONTROL_FILE, &statbuf) != 0)