Skip to content

Commit 51e26c9

Browse files
committed
Clarify the role of checkpoint at the begininng of base backups
Output a message about checkpoint starting in verbose mode of pg_basebackup, and make the documentation state more clearly that this happens. Author: Michael Banck
1 parent caa6c1f commit 51e26c9

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

doc/src/sgml/backup.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,8 @@ SELECT pg_start_backup('label', false, false);
862862
<xref linkend="guc-checkpoint-completion-target">). This is
863863
usually what you want, because it minimizes the impact on query
864864
processing. If you want to start the backup as soon as
865-
possible, change the second parameter to <literal>true</>.
865+
possible, change the second parameter to <literal>true</>, which will
866+
issue an immediate checkpoint using as much I/O as available.
866867
</para>
867868

868869
<para>

doc/src/sgml/ref/pg_basebackup.sgml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ PostgreSQL documentation
419419
<term><option>--checkpoint=<replaceable class="parameter">fast|spread</replaceable></option></term>
420420
<listitem>
421421
<para>
422-
Sets checkpoint mode to fast or spread (default) (see <xref linkend="backup-lowlevel-base-backup">).
422+
Sets checkpoint mode to fast (immediate) or spread (default) (see <xref linkend="backup-lowlevel-base-backup">).
423423
</para>
424424
</listitem>
425425
</varlistentry>
@@ -659,6 +659,14 @@ PostgreSQL documentation
659659
<refsect1>
660660
<title>Notes</title>
661661

662+
<para>
663+
At the beginning of the backup, a checkpoint needs to be written on the
664+
server the backup is taken from. Especially if the option
665+
<literal>--checkpoint=fast</literal> is not used, this can take some time
666+
during which <application>pg_basebackup</application> will be appear
667+
to be idle.
668+
</para>
669+
662670
<para>
663671
The backup will include all files in the data directory and tablespaces,
664672
including the configuration files and any additional files placed in the

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,6 +1753,14 @@ BaseBackup(void)
17531753
if (maxrate > 0)
17541754
maxrate_clause = psprintf("MAX_RATE %u", maxrate);
17551755

1756+
if (verbose)
1757+
fprintf(stderr,
1758+
_("%s: initiating base backup, waiting for checkpoint to complete\n"),
1759+
progname);
1760+
1761+
if (showprogress && !verbose)
1762+
fprintf(stderr, "waiting for checkpoint\n");
1763+
17561764
basebkp =
17571765
psprintf("BASE_BACKUP LABEL '%s' %s %s %s %s %s %s",
17581766
escaped_label,
@@ -1790,6 +1798,9 @@ BaseBackup(void)
17901798

17911799
strlcpy(xlogstart, PQgetvalue(res, 0, 0), sizeof(xlogstart));
17921800

1801+
if (verbose)
1802+
fprintf(stderr, _("%s: checkpoint completed\n"), progname);
1803+
17931804
/*
17941805
* 9.3 and later sends the TLI of the starting point. With older servers,
17951806
* assume it's the same as the latest timeline reported by

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