aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication/basebackup.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2020-06-17 10:57:34 -0400
committerRobert Haas <rhaas@postgresql.org>2020-06-17 10:57:34 -0400
commit1fa092913d260056b1aaf627ebc9cd9655c3a27c (patch)
treec50a870b2bf4480c591143e9df77de87426f2eda /src/backend/replication/basebackup.c
parenta513f1dfbf2c29a51b0f7cbd5913ce2d2ee452c5 (diff)
downloadpostgresql-1fa092913d260056b1aaf627ebc9cd9655c3a27c.tar.gz
postgresql-1fa092913d260056b1aaf627ebc9cd9655c3a27c.zip
Don't export basebackup.c's sendTablespace().
Commit 72d422a5227ef6f76f412486a395aba9f53bf3f0 made xlog.c call sendTablespace() with the 'sizeonly' argument set to true, which required basebackup.c to export sendTablespace(). However, that's kind of ugly, so instead defer the call to sendTablespace() until basebackup.c regains control. That way, it can still be a static function. 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/backend/replication/basebackup.c')
-rw-r--r--src/backend/replication/basebackup.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index 10082820655..62633e7ddcd 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -58,6 +58,8 @@ typedef struct
pg_checksum_type manifest_checksum_type;
} basebackup_options;
+static int64 sendTablespace(char *path, char *oid, bool sizeonly,
+ struct backup_manifest_info *manifest);
static int64 sendDir(const char *path, int basepathlen, bool sizeonly,
List *tablespaces, bool sendtblspclinks,
backup_manifest_info *manifest, const char *spcoid);
@@ -307,8 +309,7 @@ perform_base_backup(basebackup_options *opt)
PROGRESS_BASEBACKUP_PHASE_WAIT_CHECKPOINT);
startptr = do_pg_start_backup(opt->label, opt->fastcheckpoint, &starttli,
labelfile, &tablespaces,
- tblspc_map_file,
- opt->progress, opt->sendtblspcmapfile);
+ tblspc_map_file, opt->sendtblspcmapfile);
/*
* Once do_pg_start_backup has been called, ensure that any failure causes
@@ -337,10 +338,7 @@ perform_base_backup(basebackup_options *opt)
/* Add a node for the base directory at the end */
ti = palloc0(sizeof(tablespaceinfo));
- if (opt->progress)
- ti->size = sendDir(".", 1, true, tablespaces, true, NULL, NULL);
- else
- ti->size = -1;
+ ti->size = -1;
tablespaces = lappend(tablespaces, ti);
/*
@@ -349,10 +347,19 @@ perform_base_backup(basebackup_options *opt)
*/
if (opt->progress)
{
+ pgstat_progress_update_param(PROGRESS_BASEBACKUP_PHASE,
+ PROGRESS_BASEBACKUP_PHASE_ESTIMATE_BACKUP_SIZE);
+
foreach(lc, tablespaces)
{
tablespaceinfo *tmp = (tablespaceinfo *) lfirst(lc);
+ if (tmp->path == NULL)
+ tmp->size = sendDir(".", 1, true, tablespaces, true, NULL,
+ NULL);
+ else
+ tmp->size = sendTablespace(tmp->path, tmp->oid, true,
+ NULL);
backup_total += tmp->size;
}
}
@@ -1145,7 +1152,7 @@ sendFileWithContent(const char *filename, const char *content,
*
* Only used to send auxiliary tablespaces, not PGDATA.
*/
-int64
+static int64
sendTablespace(char *path, char *spcoid, bool sizeonly,
backup_manifest_info *manifest)
{