Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbde8c2d

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

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 hasbeen 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
staticboolfound_tablespace_dirs= false;
116116

117117
/* Progress counters */
118-
staticuint64totalsize;
118+
staticuint64totalsize_kb;
119119
staticuint64totaldone;
120120
staticinttablespacecount;
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
#defineVERBOSE_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)

[8]ページ先頭

©2009-2025 Movatter.jp