Commit 453e0e3f authored by Robert Haas's avatar Robert Haas

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
parent 1fa09291
...@@ -269,7 +269,7 @@ perform_base_backup(basebackup_options *opt) ...@@ -269,7 +269,7 @@ perform_base_backup(basebackup_options *opt)
XLogRecPtr endptr; XLogRecPtr endptr;
TimeLineID endtli; TimeLineID endtli;
StringInfo labelfile; StringInfo labelfile;
StringInfo tblspc_map_file = NULL; StringInfo tblspc_map_file;
backup_manifest_info manifest; backup_manifest_info manifest;
int datadirpathlen; int datadirpathlen;
List *tablespaces = NIL; List *tablespaces = NIL;
...@@ -424,24 +424,22 @@ perform_base_backup(basebackup_options *opt) ...@@ -424,24 +424,22 @@ perform_base_backup(basebackup_options *opt)
if (ti->path == NULL) if (ti->path == NULL)
{ {
struct stat statbuf; struct stat statbuf;
bool sendtblspclinks = true;
/* In the main tar, include the backup_label first... */ /* In the main tar, include the backup_label first... */
sendFileWithContent(BACKUP_LABEL_FILE, labelfile->data, sendFileWithContent(BACKUP_LABEL_FILE, labelfile->data,
&manifest); &manifest);
/* /* Then the tablespace_map file, if required... */
* Send tablespace_map file if required and then the bulk of if (opt->sendtblspcmapfile)
* the files.
*/
if (tblspc_map_file && opt->sendtblspcmapfile)
{ {
sendFileWithContent(TABLESPACE_MAP, tblspc_map_file->data, sendFileWithContent(TABLESPACE_MAP, tblspc_map_file->data,
&manifest); &manifest);
sendDir(".", 1, false, tablespaces, false, sendtblspclinks = false;
&manifest, NULL);
} }
else
sendDir(".", 1, false, tablespaces, true, /* Then the bulk of the files... */
sendDir(".", 1, false, tablespaces, sendtblspclinks,
&manifest, NULL); &manifest, NULL);
/* ... and pg_control after everything else. */ /* ... and pg_control after everything else. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment