Skip to content

Commit

Permalink
Back-patch checkpoint clarification docs and pg_basebackup updates
Browse files Browse the repository at this point in the history
This backpatches 51e26c9 and 7220c7b, including both documentation
updates clarifying the checkpoints at the beginning of base backups and
the messages in verbose and progress mdoe of pg_basebackup.

Author: Michael Banck
Discussion: https://postgr.es/m/21444.1488142764%40sss.pgh.pa.us
  • Loading branch information
mhagander committed Apr 1, 2017
1 parent cb366b5 commit bd34e7f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
10 changes: 9 additions & 1 deletion doc/src/sgml/ref/pg_basebackup.sgml
Expand Up @@ -361,7 +361,7 @@ PostgreSQL documentation
<term><option>--checkpoint=<replaceable class="parameter">fast|spread</replaceable></option></term>
<listitem>
<para>
Sets checkpoint mode to fast or spread (default) (see <xref linkend="backup-lowlevel-base-backup">).
Sets checkpoint mode to fast (immediate) or spread (default) (see <xref linkend="backup-lowlevel-base-backup">).
</para>
</listitem>
</varlistentry>
Expand Down Expand Up @@ -568,6 +568,14 @@ PostgreSQL documentation
<refsect1>
<title>Notes</title>

<para>
At the beginning of the backup, a checkpoint needs to be written on the
server the backup is taken from. Especially if the option
<literal>--checkpoint=fast</literal> is not used, this can take some time
during which <application>pg_basebackup</application> will be appear
to be idle.
</para>

<para>
The backup will include all files in the data directory and tablespaces,
including the configuration files and any additional files placed in the
Expand Down
11 changes: 11 additions & 0 deletions src/bin/pg_basebackup/pg_basebackup.c
Expand Up @@ -1655,6 +1655,14 @@ BaseBackup(void)
if (maxrate > 0)
maxrate_clause = psprintf("MAX_RATE %u", maxrate);

if (verbose)
fprintf(stderr,
_("%s: initiating base backup, waiting for checkpoint to complete\n"),
progname);

if (showprogress && !verbose)
fprintf(stderr, "waiting for checkpoint\r");

basebkp =
psprintf("BASE_BACKUP LABEL '%s' %s %s %s %s %s",
escaped_label,
Expand Down Expand Up @@ -1691,6 +1699,9 @@ BaseBackup(void)

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

if (verbose)
fprintf(stderr, _("%s: checkpoint completed\n"), progname);

/*
* 9.3 and later sends the TLI of the starting point. With older servers,
* assume it's the same as the latest timeline reported by
Expand Down

0 comments on commit bd34e7f

Please sign in to comment.