]> granicus.if.org Git - postgresql/commitdiff
Back-patch checkpoint clarification docs and pg_basebackup updates
authorMagnus Hagander <magnus@hagander.net>
Sat, 1 Apr 2017 15:20:05 +0000 (17:20 +0200)
committerMagnus Hagander <magnus@hagander.net>
Sat, 1 Apr 2017 15:20:05 +0000 (17:20 +0200)
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

doc/src/sgml/backup.sgml
doc/src/sgml/ref/pg_basebackup.sgml
src/bin/pg_basebackup/pg_basebackup.c

index 8c0bb1f6a207b8029bd62a9c52dfa40762b1645b..03c0dbf1cd0cdd2de2a3c975795fe0b3a1a5cb50 100644 (file)
@@ -862,7 +862,8 @@ SELECT pg_start_backup('label', false, false);
      <xref linkend="guc-checkpoint-completion-target">).  This is
      usually what you want, because it minimizes the impact on query
      processing.  If you want to start the backup as soon as
-     possible, change the second parameter to <literal>true</>.
+     possible, change the second parameter to <literal>true</>, which will
+     issue an immediate checkpoint using as much I/O as available.
     </para>
 
     <para>
index 95c801627b3a7bd670815b11aaadffe9fd651df4..134b29823683269ff1edf4508253349a9ba5c624 100644 (file)
@@ -382,7 +382,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>
@@ -589,6 +589,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
index a5bc3225337c8551fbc87aef91d7da972eab588f..613f2e159c3b2091d73d31200c1e0ae050d51f96 100644 (file)
@@ -1661,6 +1661,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 %s",
                                 escaped_label,
@@ -1698,6 +1706,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