Back-patch checkpoint clarification docs and pg_basebackup updates
authorMagnus Hagander
Sat, 1 Apr 2017 15:20:05 +0000 (17:20 +0200)
committerMagnus Hagander
Sat, 1 Apr 2017 15:27:12 +0000 (17:27 +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/ref/pg_basebackup.sgml
src/bin/pg_basebackup/pg_basebackup.c

index c26239076d8fd3341d66d975402957802bf20c22..f17c2d2122894656e732c2f659769ff19aa0dcf5 100644 (file)
@@ -361,7 +361,7 @@ PostgreSQL documentation
       
       
        
-        Sets checkpoint mode to fast or spread (default) (see ).
+        Sets checkpoint mode to fast (immediate) or spread (default) (see ).
        
       
      
@@ -568,6 +568,14 @@ PostgreSQL documentation
  
   Notes
 
+  
+   At the beginning of the backup, a checkpoint needs to be written on the
+   server the backup is taken from.  Especially if the option
+   --checkpoint=fast is not used, this can take some time
+   during which pg_basebackup will be appear
+   to be idle.
+  
+
   
    The backup will include all files in the data directory and tablespaces,
    including the configuration files and any additional files placed in the
index 2748f58106f5a3f8fe086f9acee94f89a602d505..60ead91a9da4734138d837c6f47baa1bafac9908 100644 (file)
@@ -1643,6 +1643,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,
@@ -1680,6 +1688,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