v3-0002-Minor-code-cleanup-for-perform_base_backup.patch
application/octet-stream
Filename: v3-0002-Minor-code-cleanup-for-perform_base_backup.patch
Type: application/octet-stream
Part: 1
Message:
Re: tablespace_map code cleanup
Patch
Format: format-patch
Series: patch v3-0002
Subject: Minor code cleanup for perform_base_backup().
| File | + | − |
|---|---|---|
| src/backend/replication/basebackup.c | 8 | 10 |
From 10665fd4419b2bb76c2559e0d3e4806ba699246f Mon Sep 17 00:00:00 2001
From: Robert Haas <rhaas@postgresql.org>
Date: Wed, 6 May 2020 17:50:33 -0400
Subject: [PATCH v3 2/2] 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.
Discussion: http://postgr.es/m/CA+TgmoYq+59SJ2zBbP891ngWPA9fymOqntqYcweSDYXS2a620A@mail.gmail.com
---
src/backend/replication/basebackup.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index 98be1b854b..8a491384dd 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -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)
--
2.24.2 (Apple Git-127)