Re: PATCH: Make pg_stop_backup() archive wait optional

Tsunakawa, Takayuki <tsunakawa.takay@jp.fujitsu.com>

From: "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>
To: 'David Steele' <david@pgmasters.net>, Robert Haas <robertmhaas@gmail.com>
Cc: Michael Paquier <michael.paquier@gmail.com>, Pg Hackers <pgsql-hackers@postgresql.org>, Stephen Frost <sfrost@snowman.net>
Date: 2017-03-17T04:47:03Z
Lists: pgsql-hackers
From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of David Steele
> The attached patch udpates the docs per your suggestion and has been rebased
> on master at d69fae2.

I made this ready for committer.  The patch applied except for catversion.h, the patch content looks good, and the target test passed as follows:

I set archive_command to 'sleep 10'.  pg_stop_backup() with archive wait took about 10 seconds, emitting NOTICE messages.

postgres=# select pg_stop_backup(false, true);
NOTICE:  pg_stop_backup cleanup done, waiting for required WAL segments to be archived

NOTICE:  pg_stop_backup complete, all required WAL segments have been archived
                              pg_stop_backup
---------------------------------------------------------------------------
 (0/B0000F8,"START WAL LOCATION: 0/B000028 (file 00000001000000000000000B)+
 CHECKPOINT LOCATION: 0/B000060                                           +
 BACKUP METHOD: streamed                                                  +
 BACKUP FROM: master                                                      +
 START TIME: 2017-03-17 13:26:47 JST                                      +
 LABEL: a                                                                 +
 ","")
(1 row)


pg_stop_backup() without archive wait returned immediately without displaying any NOTICE messages.


postgres=# select pg_stop_backup(false, false);
                              pg_stop_backup
---------------------------------------------------------------------------
 (0/D000130,"START WAL LOCATION: 0/D000028 (file 00000001000000000000000D)+
 CHECKPOINT LOCATION: 0/D000060                                           +
 BACKUP METHOD: streamed                                                  +
 BACKUP FROM: master                                                      +
 START TIME: 2017-03-17 13:29:46 JST                                      +
 LABEL: a                                                                 +
 ","")
(1 row)


BTW, does the developer of each feature have to modify the catalog version in catversion.h?  It's a bit annoying to see the patch application failure on catversion.h.  Isn't it enough to modify the catalog version only when alpha/beta/RC/final versions are released?


Regards
Takayuki Tsunakawa


Commits

  1. Expose waitforarchive option through pg_stop_backup()

  2. Mark pg_start_backup and pg_stop_backup as parallel-restricted.