Skip to content

Commit bde8c2d

Browse files
committed
Improve base backup protocol documentation
Document that the tablespace sizes are in units of kilobytes. Make the pg_basebackup source code a bit clearer about this, too. Reviewed-by: Magnus Hagander <magnus@hagander.net>
1 parent 1d7a6e3 commit bde8c2d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

doc/src/sgml/protocol.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2615,8 +2615,8 @@ The commands accepted in replication mode are:
26152615
<term><literal>size</literal> (<type>int8</type>)</term>
26162616
<listitem>
26172617
<para>
2618-
The approximate size of the tablespace, if progress report has
2619-
been requested; otherwise it's null.
2618+
The approximate size of the tablespace, in kilobytes (1024 bytes),
2619+
if progress report has been requested; otherwise it's null.
26202620
</para>
26212621
</listitem>
26222622
</varlistentry>

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static bool made_tablespace_dirs = false;
115115
static bool found_tablespace_dirs = false;
116116

117117
/* Progress counters */
118-
static uint64 totalsize;
118+
static uint64 totalsize_kb;
119119
static uint64 totaldone;
120120
static int tablespacecount;
121121

@@ -722,7 +722,7 @@ progress_report(int tablespacenum, const char *filename, bool force)
722722
return; /* Max once per second */
723723

724724
last_progress_report = now;
725-
percent = totalsize ? (int) ((totaldone / 1024) * 100 / totalsize) : 0;
725+
percent = totalsize_kb ? (int) ((totaldone / 1024) * 100 / totalsize_kb) : 0;
726726

727727
/*
728728
* Avoid overflowing past 100% or the full size. This may make the total
@@ -732,8 +732,8 @@ progress_report(int tablespacenum, const char *filename, bool force)
732732
*/
733733
if (percent > 100)
734734
percent = 100;
735-
if (totaldone / 1024 > totalsize)
736-
totalsize = totaldone / 1024;
735+
if (totaldone / 1024 > totalsize_kb)
736+
totalsize_kb = totaldone / 1024;
737737

738738
/*
739739
* Separate step to keep platform-dependent format code out of
@@ -742,7 +742,7 @@ progress_report(int tablespacenum, const char *filename, bool force)
742742
*/
743743
snprintf(totaldone_str, sizeof(totaldone_str), INT64_FORMAT,
744744
totaldone / 1024);
745-
snprintf(totalsize_str, sizeof(totalsize_str), INT64_FORMAT, totalsize);
745+
snprintf(totalsize_str, sizeof(totalsize_str), INT64_FORMAT, totalsize_kb);
746746

747747
#define VERBOSE_FILENAME_LENGTH 35
748748
if (verbose)
@@ -1942,11 +1942,11 @@ BaseBackup(void)
19421942
/*
19431943
* Sum up the total size, for progress reporting
19441944
*/
1945-
totalsize = totaldone = 0;
1945+
totalsize_kb = totaldone = 0;
19461946
tablespacecount = PQntuples(res);
19471947
for (i = 0; i < PQntuples(res); i++)
19481948
{
1949-
totalsize += atol(PQgetvalue(res, i, 2));
1949+
totalsize_kb += atol(PQgetvalue(res, i, 2));
19501950

19511951
/*
19521952
* Verify tablespace directories are empty. Don't bother with the

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy