basebackup-always-set-tablespace-size.patch

text/plain

Filename: basebackup-always-set-tablespace-size.patch
Type: text/plain
Part: 0
Message: Re: pg_stat_progress_basebackup - progress reporting for pg_basebackup, in the server side

Patch

Format: unified
File+
src/backend/access/transam/xlog.c 2 3
src/backend/access/transam/xlogfuncs.c 2 2
src/backend/replication/basebackup.c 2 3
src/include/access/xlog.h 1 1
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 3813eadfb4..b4eb7063b8 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -10227,8 +10227,7 @@ issue_xlog_fsync(int fd, XLogSegNo segno)
 XLogRecPtr
 do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p,
 				   StringInfo labelfile, List **tablespaces,
-				   StringInfo tblspcmapfile, bool infotbssize,
-				   bool needtblspcmapfile)
+				   StringInfo tblspcmapfile, bool needtblspcmapfile)
 {
 	bool		exclusive = (labelfile == NULL);
 	bool		backup_started_in_recovery = false;
@@ -10512,7 +10511,7 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p,
 			ti->oid = pstrdup(de->d_name);
 			ti->path = pstrdup(buflinkpath.data);
 			ti->rpath = relpath ? pstrdup(relpath) : NULL;
-			ti->size = infotbssize ? sendTablespace(fullpath, true) : -1;
+			ti->size = sendTablespace(fullpath, true);
 
 			if (tablespaces)
 				*tablespaces = lappend(*tablespaces, ti);
diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c
index 20316539b6..c0b46dceae 100644
--- a/src/backend/access/transam/xlogfuncs.c
+++ b/src/backend/access/transam/xlogfuncs.c
@@ -76,7 +76,7 @@ pg_start_backup(PG_FUNCTION_ARGS)
 	if (exclusive)
 	{
 		startpoint = do_pg_start_backup(backupidstr, fast, NULL, NULL,
-										NULL, NULL, false, true);
+										NULL, NULL, true);
 	}
 	else
 	{
@@ -94,7 +94,7 @@ pg_start_backup(PG_FUNCTION_ARGS)
 		register_persistent_abort_backup_handler();
 
 		startpoint = do_pg_start_backup(backupidstr, fast, NULL, label_file,
-										NULL, tblspc_map_file, false, true);
+										NULL, tblspc_map_file, true);
 	}
 
 	PG_RETURN_LSN(startpoint);
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index dea8aab45e..f92695ce91 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -243,8 +243,7 @@ perform_base_backup(basebackup_options *opt)
 
 	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
@@ -274,7 +273,7 @@ perform_base_backup(basebackup_options *opt)
 
 		/* Add a node for the base directory at the end */
 		ti = palloc0(sizeof(tablespaceinfo));
-		ti->size = opt->progress ? sendDir(".", 1, true, tablespaces, true) : -1;
+		ti->size = sendDir(".", 1, true, tablespaces, true);
 		tablespaces = lappend(tablespaces, ti);
 
 		/* Send tablespace header */
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h
index 98b033fc20..d4ca68900a 100644
--- a/src/include/access/xlog.h
+++ b/src/include/access/xlog.h
@@ -345,7 +345,7 @@ typedef enum SessionBackupState
 
 extern XLogRecPtr do_pg_start_backup(const char *backupidstr, bool fast,
 									 TimeLineID *starttli_p, StringInfo labelfile,
-									 List **tablespaces, StringInfo tblspcmapfile, bool infotbssize,
+									 List **tablespaces, StringInfo tblspcmapfile,
 									 bool needtblspcmapfile);
 extern XLogRecPtr do_pg_stop_backup(char *labelfile, bool waitforarchive,
 									TimeLineID *stoptli_p);