pgBackRest 2.11 commit log

v2.11: C Implementation of Archive Get

commit   : 68d20edea6cbfc7b8b6db69633e08ac473821547    
  
author   : David Steele <david@pgmasters.net>    
date     : Sun, 10 Mar 2019 18:56:00 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sun, 10 Mar 2019 18:56:00 +0200    

Click here for diff

Bug Fixes:  
  
* Fix possible truncated WAL segments when an error occurs mid-write. (Reported by blogh.)  
* Fix info command missing WAL min/max when stanza specified. (Fixed by Stefan Fercot.)  
* Fix non-compliant JSON for options passed from C to Perl. (Reported by Leo Khomenko.)  
  
Improvements:  
  
* The archive-get command is implemented entirely in C.  
* Enable socket keep-alive on older Perl versions. (Contributed by Marc Cousin.)  
* Error when parameters are passed to a command that does not accept parameters. (Suggested by Jason O'Donnell.)  
* Add hints when unable to find a WAL segment in the archive. (Suggested by Hans-Jürgen Schönig.)  
* Improve error when hostname cannot be found in a certificate. (Suggested by James Badger.)  
* Add additional options to backup.manifest for debugging purposes. (Contributed by blogh.)  

M README.md
M doc/RELEASE.md
M doc/resource/exe.cache
M doc/xml/release.xml
M lib/pgBackRest/Version.pm
M src/perl/embed.auto.c
M src/version.h
M test/code-count/file-type.yaml

Move crypto module to common/crypto.

commit   : 2ef5ad70a29b36db570f8f50a2ba821fc4ee02ff    
  
author   : David Steele <david@pgmasters.net>    
date     : Sun, 10 Mar 2019 13:27:30 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sun, 10 Mar 2019 13:27:30 +0200    

Click here for diff

It makes sense for the crypto code to be in common since it is not pgBackRest-specific.  
  
Also combine the crypto tests into a single module.  

M doc/xml/release.xml
M libc/LibC.xs
M libc/Makefile.PL
M libc/xs/crypto/cipherBlock.xsh
M libc/xs/crypto/hash.xsh
M src/Makefile
M src/command/archive/get/file.c
M src/command/archive/get/file.h
M src/command/info/info.c
R099 src/crypto/cipherBlock.c src/common/crypto/cipherBlock.c
R097 src/crypto/cipherBlock.h src/common/crypto/cipherBlock.h
R099 src/crypto/crypto.c src/common/crypto/common.c
R096 src/crypto/crypto.h src/common/crypto/common.h
R098 src/crypto/hash.c src/common/crypto/hash.c
R098 src/crypto/hash.h src/common/crypto/hash.h
M src/common/io/tls/client.c
M src/info/info.c
M src/info/info.h
M src/info/infoArchive.h
M src/info/infoPg.h
M src/perl/libc.auto.c
M src/protocol/helper.c
M src/storage/driver/s3/storage.c
M test/define.yaml
M test/src/common/harnessTls.c
R067 test/src/module/crypto/cipherBlockTest.c test/src/module/common/cryptoTest.c
D test/src/module/crypto/cryptoTest.c
D test/src/module/crypto/hashTest.c

Move compress module to common/compress.

commit   : 95597be81e7450fdbb88a6c17b549e9eb750d5dd    
  
author   : David Steele <david@pgmasters.net>    
date     : Sun, 10 Mar 2019 13:11:20 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sun, 10 Mar 2019 13:11:20 +0200    

Click here for diff

It makes sense for the compression code to be in common since it is not pgBackRest-specific.  

M doc/xml/release.xml
M libc/Makefile.PL
M src/Makefile
M src/command/archive/get/file.c
R098 src/compress/gzip.c src/common/compress/gzip/common.c
R090 src/compress/gzip.h src/common/compress/gzip/common.h
R099 src/compress/gzipCompress.c src/common/compress/gzip/compress.c
R097 src/compress/gzipCompress.h src/common/compress/gzip/compress.h
R098 src/compress/gzipDecompress.c src/common/compress/gzip/decompress.c
R097 src/compress/gzipDecompress.h src/common/compress/gzip/decompress.h
M test/define.yaml
M test/src/module/command/archiveGetTest.c
R100 test/src/module/compress/gzipTest.c test/src/module/common/compressGzipTest.c

Move help/help test module to command/help.

commit   : 2f63babe9dfa6f49d5fbc9a6e039e1a1dfa5054d    
  
author   : David Steele <david@pgmasters.net>    
date     : Sun, 10 Mar 2019 11:55:01 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sun, 10 Mar 2019 11:55:01 +0200    

Click here for diff

M test/define.yaml
R100 test/src/module/help/helpTest.c test/src/module/command/helpTest.c

Add additional options to backup.manifest for debugging purposes.

commit   : e4e2606fce1ef28e82f359581e1a90be6d10414c    
  
author   : blogh <blo.talkto@gmail.com>    
date     : Sun, 10 Mar 2019 11:03:52 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sun, 10 Mar 2019 11:03:52 +0200    

Click here for diff

Add the buffer-size, compress-level, compress-level-network, and process-max options to the backup:option section in backup.manifest to aid in debugging.  
  
It may also make sense to propagate these options up to backup.info so they can be displayed in the info command, but for now this is deemed sufficient.  
  
Contributed by blogh.  

M doc/xml/release.xml
M lib/pgBackRest/Backup/Backup.pm
M lib/pgBackRest/Manifest.pm
M src/perl/embed.auto.c
M test/expect/mock-all-001.log
M test/expect/mock-all-002.log
M test/lib/pgBackRestTest/Env/Host/HostBackupTest.pm
M test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm

Add hints when unable to find a WAL segment in the archive.

commit   : 21f56f64ebe0af34b61793efad1730707a8e9f39    
  
author   : David Steele <david@pgmasters.net>    
date     : Sun, 10 Mar 2019 10:38:12 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sun, 10 Mar 2019 10:38:12 +0200    

Click here for diff

When this error happens in the context of a backup it can be a bit mystifying as to why the backup is failing.  Add some hints to get the user started.  
  
These hints will appear any time a WAL segment can't be found, which makes the hint about the check command redundant when the user is actually running the check command, but it doesn't seem worth trying to exclude the hint in that case.  
  
Suggested by Hans-Jürgen Schönig.  

M doc/xml/release.xml
M lib/pgBackRest/Archive/Common.pm
M src/perl/embed.auto.c
M test/lib/pgBackRestTest/Module/Command/CommandArchiveCommonPerlTest.pm

Add note for CSTD settings on BSD variants.

commit   : bc9fb0f59ae4d9cc843fa8ac2d9d434cf850910d    
  
author   : David Steele <david@pgmasters.net>    
date     : Sun, 10 Mar 2019 09:16:25 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sun, 10 Mar 2019 09:16:25 +0200    

Click here for diff

Suggested by ucando, jungle-boogie, Luca Ferrari.  

M doc/xml/release.xml
M src/Makefile

Make DESTDIR fully-configurable in the Makefile.

commit   : 786e77a9feb0ec3133d7f1ab7efe0037816a1382    
  
author   : Douglas J Hunley <doug.hunley@gmail.com>    
date     : Sat, 9 Mar 2019 11:40:55 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sat, 9 Mar 2019 11:40:55 +0200    

Click here for diff

DESTDIR always had /usr/bin appended which was a problem systems that don't use /usr/bin as the install location for binaries.  
  
Instead, use the value of DESTDIR exactly and update the Debian packages accordingly.  
  
Contributed by Douglas J Hunley.  

M doc/xml/release.xml
M src/Makefile
A test/patch/debian-package.patch

Error when parameters are passed to a command that does not accept parameters.

commit   : 60fe5b7365c9eaaa03e954cac7dec14777aa2461    
  
author   : David Steele <david@pgmasters.net>    
date     : Sat, 9 Mar 2019 11:03:47 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sat, 9 Mar 2019 11:03:47 +0200    

Click here for diff

This behavior allowed a command like this to run without error:  
  
pgbackrest backup --stanza=db full  
  
Even though it actually performed an incremental backup in most circumstances because the `full` parameter was ignored.  
  
Instead, output an error and exit.  
  
Suggested by Jason O'Donnell.  

M build/lib/pgBackRestBuild/Config/Build.pm
M build/lib/pgBackRestBuild/Config/Data.pm
M doc/xml/release.xml
M src/config/config.auto.c
M src/config/config.c
M src/config/config.h
M src/config/parse.c
M test/src/module/config/configTest.c
M test/src/module/config/parseTest.c

Prevent option warning from being output when running help command.

commit   : cad6fedb7ba2877f7ea1b2e23415c42b6bda3483    
  
author   : David Steele <david@pgmasters.net>    
date     : Thu, 7 Mar 2019 15:54:59 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Thu, 7 Mar 2019 15:54:59 +0200    

Click here for diff

This warning was being output when getting help if retention was not set:  
  
WARN: option repo1-retention-full is not set, the repository may run out of space  
  
Suppress this when getting help since the warning will display by default on a system that is not completely configured.  

M doc/xml/release.xml
M src/config/load.c
M test/src/module/config/loadTest.c

Add clean and uninstall targets to Makefile.

commit   : 3d7edc4ca4db2f75a33d43ffc5131a6a20086507    
  
author   : Luca Ferrari <fluca1978@gmail.com>    
date     : Thu, 7 Mar 2019 14:08:35 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Thu, 7 Mar 2019 14:08:35 +0200    

Click here for diff

Contributed by Luca Ferrari.  

M doc/xml/release.xml
M src/Makefile

Create test matrix for mock/all to increase coverage and reduce tests.

commit   : d441061168ec56d22082a6ff54e5f1fb02cc8eae    
  
author   : David Steele <david@pgmasters.net>    
date     : Sat, 2 Mar 2019 15:01:02 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sat, 2 Mar 2019 15:01:02 +0200    

Click here for diff

The same test configurations are run on all four test VMs, which seems a real waste of resources.  
  
Vary the tests per VM to increase coverage while reducing the total number of tests. Be sure to include each major feature (remote, s3, encryption) in each VM at least once.  

M doc/xml/release.xml
M test/define.yaml
M test/expect/mock-all-001.log
M test/expect/mock-all-002.log
D test/expect/mock-all-003.log
M test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm

Create test matrix for mock/expire to increase coverage and reduce tests.

commit   : f7d1d4400f1edcdd3216dfa5c9d1e306946c36a2    
  
author   : David Steele <david@pgmasters.net>    
date     : Fri, 1 Mar 2019 19:04:26 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Fri, 1 Mar 2019 19:04:26 +0200    

Click here for diff

The same test configurations are run on all four test VMs, which seems a real waste of resources.  
  
Vary the tests per VM to increase coverage while reducing the total number of tests.  

M doc/xml/release.xml
M test/define.yaml
M test/lib/pgBackRestTest/Module/Mock/MockExpireTest.pm

Create test matrix for mock/archive-stop to increase coverage and reduce tests.

commit   : 91622942c2e465cb46571343d0e40f8b7cef8742    
  
author   : David Steele <david@pgmasters.net>    
date     : Fri, 1 Mar 2019 17:12:41 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Fri, 1 Mar 2019 17:12:41 +0200    

Click here for diff

The same test configurations are run on all four test VMs, which seems a real waste of resources.  
  
Vary the tests per VM to increase coverage while reducing the total number of tests. Be sure to include each major feature (remote, s3, encryption) in each VM at least once.  

M doc/xml/release.xml
M test/define.yaml
M test/expect/mock-archive-stop-001.log
M test/expect/mock-archive-stop-002.log
D test/expect/mock-archive-stop-003.log
D test/expect/mock-archive-stop-004.log
D test/expect/mock-archive-stop-005.log
D test/expect/mock-archive-stop-006.log
D test/expect/mock-archive-stop-007.log
M test/lib/pgBackRestTest/Module/Mock/MockArchiveStopTest.pm

Don’t make a copy of the context name in the MemContext module.

commit   : c307d9fdf9439661d2a94f215bbc7b1ef714e34f    
  
author   : David Steele <david@pgmasters.net>    
date     : Fri, 1 Mar 2019 15:58:52 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Fri, 1 Mar 2019 15:58:52 +0200    

Click here for diff

This is very inefficient in terms of memory and time and dynamic context names were never utilized.  
  
Just require that context names be valid for the life of the context.  
  
In practice they are all static strings.  

M doc/xml/release.xml
M src/common/memContext.c
M src/common/memContext.h
M test/src/module/common/memContextTest.c

Improve performance of context and memory allocations in MemContext module.

commit   : 90709dfd213b1eb1dab3daff0101768f61be4b5f    
  
author   : David Steele <david@pgmasters.net>    
date     : Fri, 1 Mar 2019 14:57:01 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Fri, 1 Mar 2019 14:57:01 +0200    

Click here for diff

Allocations required a sequential scan through the allocation list for both contexts and memory.  This was very inefficient since for the most part individual memory allocations are seldom freed directly, rather they are freed when their context is freed.  
  
For both types of allocations track an index for the lowest free position.  After an allocation of the free position, a sequential search will be required for the next allocation but this is still far better than doing a scan for every allocation.  
  
With a moderately-sized dataset (500 history entries in backup.info), there is a 237X performance improvement when combined with the f74e88bb refactor.  
  
Before:  
  
  %   cumulative   self  
 time   seconds   seconds name  
 65.11    331.37   331.37 memContextAlloc  
 16.19    413.78    82.40 memContextCurrent  
 14.74    488.81    75.03 memContextTop  
  2.65    502.29    13.48 memContextNewIndex  
  1.18    508.31     6.02 memFind  
  
After:  
  
  %   cumulative   self  
 time   seconds   seconds name  
 94.69      2.14     2.14 memFind  
  
Finding memory allocations in order to free or resize them is the next bottleneck, but this does not seem to be a major issue presently.  

M doc/xml/release.xml
M src/common/memContext.c
M test/src/module/common/memContextTest.c

Use contextTop/contextCurrent instead of memContextTop()/memContextCurrent() in MemContext module.

commit   : f74e88bba9c7a7912f0b1fc322823f1b527042f8    
  
author   : David Steele <david@pgmasters.net>    
date     : Fri, 1 Mar 2019 13:33:58 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Fri, 1 Mar 2019 13:33:58 +0200    

Click here for diff

Using the functions internally is great for abstraction but not so great for performance on non-optimized builds.  
  
Also, the functions end up prominent in any profiled build.  

M doc/xml/release.xml
M src/common/memContext.c

Update default documentation version to PostgreSQL 10.

commit   : 6ce3310f8a2900d1af717da8d4c3345a9016933b    
  
author   : David Steele <david@pgmasters.net>    
date     : Fri, 1 Mar 2019 09:10:14 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Fri, 1 Mar 2019 09:10:14 +0200    

Click here for diff

Also update CentOS 6 and 7 versions to PostgreSQL 9.5 and 9.6 respectively.  

M doc/xml/release.xml
M doc/xml/user-guide.xml

Documentation builds on PostgreSQL 9.4-10.

commit   : 409360924151a561dd5dc122dbcd9173a4e6c950    
  
author   : David Steele <david@pgmasters.net>    
date     : Fri, 1 Mar 2019 09:00:51 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Fri, 1 Mar 2019 09:00:51 +0200    

Click here for diff

More than likely 9.2-11 will work as well, but this has not been tested.  
  
However, 11 needs work on the group permissions introduced in that version.  

M doc/xml/release.xml
M doc/xml/user-guide.xml

Enable socket keep-alive on older Perl versions.

commit   : cb3b4fa24bbe271a517b50a3522bc5075d8fe6c7    
  
author   : Marc Cousin <marc.cousin@people-doc.com>    
date     : Thu, 28 Feb 2019 14:33:29 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Thu, 28 Feb 2019 14:33:29 +0200    

Click here for diff

The prior method depended on IO:Socket:SSL to push the keep-alive options down to the socket but it only worked for recent versions of the module.  
  
Instead, create the socket directly using IO::Socket::IP if available or IO:Socket:INET as a fallback.  The keep-alive option is set directly on the socket before it is passed to IO:Socket:SSL.  
  
Contributed by Marc Cousin.  

M doc/xml/release.xml
M lib/pgBackRest/Common/Http/Client.pm
M src/perl/embed.auto.c
M test/lib/pgBackRestTest/Module/Storage/StorageS3CertPerlTest.pm

Cleanup local/remote protocol interaction from 9367cc46.

commit   : 0913523096cf9178ffa46595171dc16ab815148b    
  
author   : David Steele <david@pgmasters.net>    
date     : Thu, 28 Feb 2019 09:51:19 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Thu, 28 Feb 2019 09:51:19 +0200    

Click here for diff

The command option was not being set correctly when a remote was started from a local.  It was being set as 'local' rather than the command that the local was running as.  
  
Also automatically select the remote protocol id based on whether it is started from a local (use the local protocol id) or from the main process (use 0).  
  
These were not live issues but could cause strange behaviors as new features are added that might be hard to diagnose.  

M src/main.c
M src/protocol/helper.c
M src/protocol/helper.h
M src/storage/helper.c
M test/expect/mock-archive-002.log
M test/src/module/protocol/protocolTest.c
M test/src/module/storage/remoteTest.c

The archive-get command is implemented entirely in C.

commit   : db4b447be89878496f0a50905b2f51c1306b9de5    
  
author   : David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 23:03:02 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 23:03:02 +0200    

Click here for diff

This new implementation should behave exactly like the old Perl code with the exception of a few updated log messages.  
  
Remove as much of the Perl code as possible without breaking other commands.  

M doc/xml/release.xml
M doc/xml/user-guide.xml
D lib/pgBackRest/Archive/Get/Async.pm
M lib/pgBackRest/Archive/Get/File.pm
D lib/pgBackRest/Archive/Get/Get.pm
M lib/pgBackRest/Backup/Backup.pm
M lib/pgBackRest/Expire.pm
M lib/pgBackRest/Main.pm
M lib/pgBackRest/Protocol/Helper.pm
M lib/pgBackRest/Protocol/Local/Minion.pm
M src/Makefile
M src/command/archive/common.c
M src/command/archive/common.h
M src/command/archive/get/file.c
M src/command/archive/get/file.h
M src/command/archive/get/get.c
M src/command/archive/get/get.h
A src/command/archive/get/protocol.c
A src/command/archive/get/protocol.h
M src/command/local/local.c
M src/main.c
M src/perl/embed.auto.c
M test/define.yaml
M test/lib/pgBackRestTest/Module/Command/CommandArchiveGetPerlTest.pm
M test/src/module/command/archiveCommonTest.c
M test/src/module/command/archiveGetTest.c
M test/src/module/protocol/protocolTest.c

Migrate local command to C.

commit   : 9367cc461cda63698caa04ddb262405eef05890d    
  
author   : David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 22:34:21 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 22:34:21 +0200    

Click here for diff

The C local is only used for C commands in the main process.  
  
Some tweaking of the existing protocolGet() command was required. Originally the idea was to share the function for local and remote requests but the differences (as in Perl) were too great to make that practical.  

M build/lib/pgBackRestBuild/Config/Data.pm
M doc/xml/release.xml
M src/Makefile
A src/command/local/local.c
A src/command/local/local.h
M src/config/define.auto.c
M src/main.c
M src/protocol/client.h
M src/protocol/helper.c
M src/protocol/helper.h
M src/storage/driver/remote/storage.c
M src/storage/driver/remote/storage.h
M src/storage/helper.c
M test/define.yaml
M test/lib/pgBackRestTest/Module/Command/CommandArchiveGetPerlTest.pm
A test/src/module/command/localTest.c
M test/src/module/protocol/protocolTest.c

Add ProtocolParallel* objects for parallelizing commands.

commit   : 35abd4cd9517c4acf02d98bf386e1ef2ed2e8485    
  
author   : David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 21:10:52 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 21:10:52 +0200    

Click here for diff

Allows commands to be easily parallelized if the jobs are broken up into discrete, non-overlapping chunks.  

M doc/xml/release.xml
M src/Makefile
A src/protocol/parallel.c
A src/protocol/parallel.h
A src/protocol/parallelJob.c
A src/protocol/parallelJob.h
M test/define.yaml
M test/src/module/protocol/protocolTest.c

Add ProtocolCommand object.

commit   : 35acfae7c2328a70f978973aa1c7ed91af750d88    
  
author   : David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 19:48:30 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 19:48:30 +0200    

Click here for diff

This formalizes the creation of protocol commands, which was previously done by creating KeyValue objects manually.  

M doc/xml/release.xml
M src/Makefile
M src/config/protocol.c
M src/protocol/client.c
M src/protocol/client.h
A src/protocol/command.c
A src/protocol/command.h
M src/protocol/server.c
M src/storage/driver/remote/fileRead.c
M src/storage/driver/remote/storage.c
M test/define.yaml
M test/src/module/protocol/protocolTest.c

Expose handle (file descriptor) from IoRead when applicable.

commit   : dee90d3e606262fe99dcc099867a96039540a1c2    
  
author   : David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 18:11:09 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 18:11:09 +0200    

Click here for diff

Some IO objects have file descriptors which can be useful for monitoring with select().  
  
It might also be useful to expose handles for write objects but there is currently no use case.  

M doc/xml/release.xml
M src/common/exec.c
M src/common/exec.h
M src/common/io/handleRead.c
M src/common/io/handleRead.h
M src/common/io/read.c
M src/common/io/read.h
M src/common/io/read.intern.h
M test/src/module/common/execTest.c
M test/src/module/common/ioTest.c

Improve null-handling of varToLog().

commit   : b1957b07f351a93fa64658f8c898420b4bbe68f5    
  
author   : David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 18:10:18 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 18:10:18 +0200    

Click here for diff

M doc/xml/release.xml
M src/common/type/variant.c
M test/src/module/common/typeVariantTest.c

Add lstRemove() to List object.

commit   : ea2aef1d0ceff366b75f663281df511b8169eadd    
  
author   : David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 18:09:21 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 18:09:21 +0200    

Click here for diff

Because it is sometimes useful to remove items from a list.  

M doc/xml/release.xml
M src/common/type/list.c
M src/common/type/list.h
M test/src/module/common/typeListTest.c

Improve fork harness to allow multiple children and setup pipes automatically.

commit   : 4be271ea2a1a7bed4e5165f10a8e62a19b4e7dc9    
  
author   : David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 18:07:16 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 18:07:16 +0200    

Click here for diff

There was a lot of extra boilerplate involved in setting up pipes so that is now automated.  
  
In some cases testing with multiple children is useful so allow that as well.  

M doc/xml/release.xml
M test/src/common/harnessFork.h
M test/src/module/command/archiveGetTest.c
M test/src/module/command/remoteTest.c
M test/src/module/common/errorTest.c
M test/src/module/common/exitTest.c
M test/src/module/common/forkTest.c
M test/src/module/common/ioTest.c
M test/src/module/common/lockTest.c
M test/src/module/config/protocolTest.c
M test/src/module/protocol/protocolTest.c
M test/src/module/storage/posixTest.c

Only run test-level stack trace by default for unit-tested modules.

commit   : 18b62a4220acabc4ba0018ed884e20f695304aed    
  
author   : David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 17:09:19 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Wed, 27 Feb 2019 17:09:19 +0200    

Click here for diff

This amends 70c30dfb which disabled test tracing in general.  
  
Instead, only enable test tracing by default for modules that are being unit tested. This saves lots of time but still ensures that test tracing is working and helps with debugging in unit tests.  
  
Also rename the option to --debug-test-trace for a clarity.  

M doc/xml/release.xml
M src/common/debug.h
M src/info/infoArchive.c
M test/lib/pgBackRestTest/Common/JobTest.pm
M test/test.pl

Create test matrix for mock/stanza to increase coverage and reduce tests.

commit   : 3a05359087560248dc0bc7d1ce35516c6a5d622f    
  
author   : David Steele <david@pgmasters.net>    
date     : Sun, 24 Feb 2019 07:42:41 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sun, 24 Feb 2019 07:42:41 +0200    

Click here for diff

The same test configurations are run on all four test VMs, which seems a real waste of resources.  
  
Vary the tests per VM to increase coverage while reducing the total number of tests. Be sure to include each major feature (remote, s3, encryption) in each VM at least once.  

M doc/xml/release.xml
M test/define.yaml
M test/expect/mock-stanza-002.log
D test/expect/mock-stanza-003.log
M test/lib/pgBackRestTest/Module/Mock/MockStanzaTest.pm

Reduce expect log level in mock/stanza tests.

commit   : 6d3e18b181d08f4e1ed64c097346a3532e6005af    
  
author   : David Steele <david@pgmasters.net>    
date     : Sun, 24 Feb 2019 06:55:59 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sun, 24 Feb 2019 06:55:59 +0200    

Click here for diff

The expect tests were originally a rough-and-ready type of unit test so monitoring changes in the expect log helped us detect changes in behavior.  
  
Now the stanza code is heavily unit-tested so the detailed logs mainly cause churn and don't have any measurable benefit.  
  
Reduce the log level to DETAIL to make the logs less verbose and volatile, yet still check user-facing log messages.  

M doc/xml/release.xml
M test/expect/mock-stanza-001.log
M test/expect/mock-stanza-002.log
M test/expect/mock-stanza-003.log
M test/lib/pgBackRestTest/Module/Mock/MockStanzaTest.pm

Rename test modules for consistency.

commit   : 2f081f3ec7a0c9bb664eb5a426ec21859bb48722    
  
author   : David Steele <david@pgmasters.net>    
date     : Sat, 23 Feb 2019 18:51:52 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sat, 23 Feb 2019 18:51:52 +0200    

Click here for diff

The conventions for command and info tests have shifted in the C modules, though not even all the C modules got the message.  

M doc/xml/release.xml
M test/define.yaml
R099 test/lib/pgBackRestTest/Module/Archive/ArchiveCommonPerlTest.pm test/lib/pgBackRestTest/Module/Command/CommandArchiveCommonPerlTest.pm
R099 test/lib/pgBackRestTest/Module/Archive/ArchiveGetPerlTest.pm test/lib/pgBackRestTest/Module/Command/CommandArchiveGetPerlTest.pm
R099 test/lib/pgBackRestTest/Module/Archive/ArchivePushPerlTest.pm test/lib/pgBackRestTest/Module/Command/CommandArchivePushPerlTest.pm
R099 test/lib/pgBackRestTest/Module/Archive/ArchiveInfoUnitPerlTest.pm test/lib/pgBackRestTest/Module/Info/InfoInfoArchivePerlTest.pm
R099 test/lib/pgBackRestTest/Module/Backup/BackupInfoUnitPerlTest.pm test/lib/pgBackRestTest/Module/Info/InfoInfoBackupPerlTest.pm
R100 test/src/module/archive/commonTest.c test/src/module/command/archiveCommonTest.c
R100 test/src/module/archive/getTest.c test/src/module/command/archiveGetTest.c
R100 test/src/module/archive/pushTest.c test/src/module/command/archivePushTest.c

Create test matrix for mock/archive to increase coverage and reduce tests.

commit   : d489eb87f7f7da58dd02812e5088f507e1cab491    
  
author   : David Steele <david@pgmasters.net>    
date     : Sat, 23 Feb 2019 15:59:39 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sat, 23 Feb 2019 15:59:39 +0200    

Click here for diff

The same test configurations are run on all four test VMs, which seems a real waste of resources.  
  
Vary the tests per VM to increase coverage while reducing the total number of tests.  Be sure to include each major feature (remote, s3, encryption) in each VM at least once.  

M doc/xml/release.xml
M test/define.yaml
M test/expect/mock-archive-001.log
M test/expect/mock-archive-002.log
D test/expect/mock-archive-003.log
M test/lib/pgBackRestTest/Module/Mock/MockArchiveTest.pm

Create aliases for test VMs ordered by age.

commit   : 4a7588e604d3b39858f09e8c879e973bd4432ded    
  
author   : David Steele <david@pgmasters.net>    
date     : Sat, 23 Feb 2019 15:13:23 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sat, 23 Feb 2019 15:13:23 +0200    

Click here for diff

This will allow for smarter allocation of tests in the next commit.  

M doc/xml/release.xml
M test/lib/pgBackRestTest/Common/VmTest.pm

Reduce expect log level in mock/archive tests.

commit   : 59d7958914d2965d0690ebd579541c21a40ad201    
  
author   : David Steele <david@pgmasters.net>    
date     : Sat, 23 Feb 2019 15:05:06 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sat, 23 Feb 2019 15:05:06 +0200    

Click here for diff

The expect tests were originally a rough-and-ready type of unit test so monitoring changes in the expect log helped us detect changes in behavior.  
  
Now the archive code is heavily unit-tested so the detailed logs mainly cause churn and don't have any measurable benefit.  
  
Reduce the log level to DETAIL to make the logs less verbose and volatile, yet still check user-facing log messages.  

M doc/xml/release.xml
M test/expect/mock-archive-001.log
M test/expect/mock-archive-002.log
M test/lib/pgBackRestTest/Module/Mock/MockArchiveTest.pm

Improve error when hostname cannot be found in a certificate.

commit   : a9cbf23f4cacb18d85e7a6f02cff198790a9e21f    
  
author   : David Steele <david@pgmasters.net>    
date     : Sat, 23 Feb 2019 07:28:27 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Sat, 23 Feb 2019 07:28:27 +0200    

Click here for diff

Update error message with the hostname and more detail about what went wrong.  Hopefully this will help in diagnosing certificate/hostname issues.  
  
Suggested by James Badger.  

M doc/xml/release.xml
M src/common/io/tls/client.c
M test/src/module/common/ioTlsTest.c

Fix non-compliant JSON for options passed from C to Perl.

commit   : 1f66bda02ec9ae92403af2feeaf61505b3482932    
  
author   : David Steele <david@pgmasters.net>    
date     : Fri, 22 Feb 2019 12:02:26 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Fri, 22 Feb 2019 12:02:26 +0200    

Click here for diff

We have been using a hacked-up JSON generator to pass options from C to Perl since the C binary was introduced.  This generator was not very compliant which led to issues with \n, ", etc. inside strings.  
  
We have a fully-compliant JSON generator now so use that instead.  
  
Reported by Leo Khomenko.  

M doc/xml/release.xml
M lib/pgBackRest/Config/Config.pm
M libc/Makefile.PL
M src/Makefile
M src/perl/config.c
M src/perl/embed.auto.c
M test/src/module/perl/configTest.c

Disable test-level stack trace by default.

commit   : 70c30dfb619a3ec2ea7d465d5b8e2014518b723d    
  
author   : David Steele <david@pgmasters.net>    
date     : Fri, 22 Feb 2019 11:40:30 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Fri, 22 Feb 2019 11:40:30 +0200    

Click here for diff

Detailed stack traces for low-level functions (e.g. strCat, bufMove) can be very useful for debugging but leaving them on for all tests has become quite burdensome in terms of time.  Complex operations like generating JSON on a large KevValue can lead to timeouts even with generous values.  
  
Add a new param, --debug-trace, to enable test-level stack trace, but leave it off by default.  

M doc/xml/release.xml
M src/common/debug.h
M test/lib/pgBackRestTest/Common/JobTest.pm
M test/test.pl

Add missing ToLog() coverage to String, List, and PgControl.

commit   : ae86e6d5b2f6f86bc3ec1a4b1378d9b49e89799e    
  
author   : David Steele <david@pgmasters.net>    
date     : Fri, 22 Feb 2019 11:31:37 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Fri, 22 Feb 2019 11:31:37 +0200    

Click here for diff

Missing coverage is exposed in the next commit which disables test tracing by default.  

M doc/xml/release.xml
M test/define.yaml
M test/src/module/common/typeListTest.c
M test/src/module/common/typeStringTest.c
M test/src/module/postgres/interfaceTest.c

Fix incorrect tags.

commit   : a7c8906581e8fc875c3cac99153aacb323de034f    
  
author   : David Steele <david@pgmasters.net>    
date     : Thu, 21 Feb 2019 18:49:02 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Thu, 21 Feb 2019 18:49:02 +0200    

Click here for diff

M doc/xml/release.xml

Use driver for remote protocol introduced in da628be8.

commit   : e14c0eeb65a998a419e5a2e6c0ce833e8d7d03dc    
  
author   : David Steele <david@pgmasters.net>    
date     : Thu, 21 Feb 2019 16:20:46 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Thu, 21 Feb 2019 16:20:46 +0200    

Click here for diff

The remote protocol was calling into the Storage object but this required some translation which will get more awkward as time goes by.  
  
Instead, call directly into the local driver so the communication is directly driver to driver.  This still requires resolving the path and may eventually have more duplication with the Storage object methods but it seems the right thing to do.  

M src/Makefile
M src/storage/driver/remote/protocol.c
M src/storage/storage.c
M src/storage/storage.intern.h
M test/src/module/storage/posixTest.c

Resolve storage path expressions before passing to remote.

commit   : b1eb8af7d5093a26a2e221a428540e5e7b356eed    
  
author   : David Steele <david@pgmasters.net>    
date     : Thu, 21 Feb 2019 15:40:21 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Thu, 21 Feb 2019 15:40:21 +0200    

Click here for diff

Expressions such as <REPO:ARCHIVE> require a stanza name in order to be resolved correctly.  However, if the stanza name is passed to the remote then that remote will only work correctly for that one stanza.  
  
Instead, resolved the expressions locally but still pass a relative path to the remote.  That way, a storage path that is only configured on the remote does not need to be known locally.  

M doc/xml/release.xml
M src/protocol/helper.c
M src/storage/driver/posix/storage.c
M src/storage/driver/remote/storage.c
M src/storage/driver/remote/storage.h
M src/storage/driver/s3/storage.c
M src/storage/helper.c
M src/storage/storage.c
M src/storage/storage.intern.h
M test/expect/mock-archive-002.log
M test/expect/mock-stanza-002.log
M test/expect/mock-stanza-003.log
M test/src/module/protocol/protocolTest.c

Allow cfgExecParam() to exclude options.

commit   : b4d4680f8c3126d1c2016d30aa2a1b77aac085c0    
  
author   : David Steele <david@pgmasters.net>    
date     : Thu, 21 Feb 2019 14:40:35 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Thu, 21 Feb 2019 14:40:35 +0200    

Click here for diff

It is useful to be able to exclude an option even if it is shared by both commands.  

M doc/xml/release.xml
M src/config/exec.c
M test/src/module/config/execTest.c

Improve null-handling of strToLog().

commit   : be6a3f131e746304c6a30c39fcab4fe4b44dcb7f    
  
author   : David Steele <david@pgmasters.net>    
date     : Thu, 21 Feb 2019 14:26:06 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Thu, 21 Feb 2019 14:26:06 +0200    

Click here for diff

NULL was returning {"(null)"} which was comprehensible but not very pretty.  Instead return null on NULL.  

M doc/xml/release.xml
M src/common/type/string.c
M test/src/module/common/typeStringTest.c

Add kvKeyExists() to KeyValue object.

commit   : 1fd89f05afd8d8614d7b38a006eda4418f6324ce    
  
author   : David Steele <david@pgmasters.net>    
date     : Thu, 21 Feb 2019 14:16:17 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Thu, 21 Feb 2019 14:16:17 +0200    

Click here for diff

Check if a key exists even if the value is NULL, which is the same result for a missing key.  

M doc/xml/release.xml
M src/common/type/keyValue.c
M src/common/type/keyValue.h
M test/src/module/common/typeKeyValueTest.c

Fix info command missing WAL min/max when stanza specified.

commit   : 80df1114bdc97a930421f491bb7f41d9aeab6069    
  
author   : Stefan Fercot <stefan.fercot@dalibo.com>    
date     : Thu, 21 Feb 2019 12:09:12 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Thu, 21 Feb 2019 12:09:12 +0200    

Click here for diff

This issue was a result of STORAGE_REPO_PATH prepending an extra stanza when the stanza was specified on the command line.  
  
The tests missed this because by some strange coincidence the WAL dirs were empty for each test that specified a stanza.  Add new tests to prevent a regression.  
  
Fixed by Stefan Fercot.  

M doc/xml/release.xml
M src/command/info/info.c
M test/src/module/command/infoTest.c

Add storageHelperFree() to storage helper.

commit   : 1519f5b04540d5a431044f83a45b604ad8757397    
  
author   : David Steele <david@pgmasters.net>    
date     : Thu, 21 Feb 2019 11:40:30 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Thu, 21 Feb 2019 11:40:30 +0200    

Click here for diff

Free all cached objects in the storage helper, especially the stanza name.  
  
This clears the storage environment for tests that switch stanza names or go from a stanza name to no stanza name or vice versa. This is only useful for testing right now, but may be used in the future for commands than act on multiple stanzas.  

M doc/xml/release.xml
M src/storage/helper.c
M src/storage/helper.h
M test/src/common/harnessConfig.c
M test/src/module/storage/posixTest.c

Migrate remote archive-get command to C.

commit   : b0b5989acae29b962b9101719459234968a8e6c1    
  
author   : David Steele <david@pgmasters.net>    
date     : Wed, 20 Feb 2019 22:57:18 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Wed, 20 Feb 2019 22:57:18 +0200    

Click here for diff

All required protocol commands are implemented so this is mostly a matter of enabling the feature and updating expect logs.  

M doc/xml/release.xml
M lib/pgBackRest/Archive/Get/Get.pm
M lib/pgBackRest/Main.pm
M src/command/archive/get/get.c
M src/main.c
M src/perl/embed.auto.c
M test/expect/mock-archive-001.log
M test/expect/mock-archive-002.log
M test/expect/mock-stanza-001.log
M test/expect/mock-stanza-002.log
M test/expect/mock-stanza-003.log

Add exists() to remote storage.

commit   : 6866ff031a6a48d6cd966f5df78bcbc2c84a3890    
  
author   : David Steele <david@pgmasters.net>    
date     : Wed, 20 Feb 2019 22:43:02 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Wed, 20 Feb 2019 22:43:02 +0200    

Click here for diff

M doc/xml/release.xml
M src/storage/driver/remote/protocol.c
M src/storage/driver/remote/protocol.h
M src/storage/driver/remote/storage.c
M test/define.yaml
M test/src/module/storage/remoteTest.c

Increase per-call stack trace size to 4096.

commit   : 71bc5697b1a35c8460af7885b888b1d43bd994b1    
  
author   : David Steele <david@pgmasters.net>    
date     : Wed, 20 Feb 2019 22:23:19 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Wed, 20 Feb 2019 22:23:19 +0200    

Click here for diff

This was previously 256, which was too small to log protocol parameters.  Not only did this truncate important debug information but varying path lengths caused spurious differences in the expect logs.  

M doc/xml/release.xml
M src/common/stackTrace.h

Add separate archive-get-async command.

commit   : 73be64ce49aaff9d94f70c47590476c404365ce4    
  
author   : David Steele <david@pgmasters.net>    
date     : Wed, 20 Feb 2019 15:52:07 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Wed, 20 Feb 2019 15:52:07 +0200    

Click here for diff

This command was previously forked off from the archive-get command which required a bit of artificial option and log manipulation.  
  
A separate command is easier to test and will work on platforms that don't have fork(), e.g. Windows.  

M build/lib/pgBackRestBuild/Config/Data.pm
M doc/lib/BackRestDoc/Common/DocConfig.pm
M doc/xml/release.xml
M lib/pgBackRest/Archive/Get/Get.pm
M lib/pgBackRest/LibCAuto.pm
M lib/pgBackRest/Main.pm
M src/Makefile
M src/command/archive/get/get.c
M src/command/help/help.c
M src/config/config.auto.c
M src/config/config.auto.h
M src/config/define.auto.c
M src/config/define.auto.h
M src/config/define.c
M src/perl/embed.auto.c
M test/expect/mock-archive-002.log
M test/expect/mock-stanza-002.log
M test/expect/mock-stanza-003.log
M test/src/module/archive/getTest.c

Add instructions for building the coverage report.

commit   : e48b406cdc3c73056137d6767a7f70e08bee9806    
  
author   : David Steele <david@pgmasters.net>    
date     : Wed, 20 Feb 2019 15:48:14 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Wed, 20 Feb 2019 15:48:14 +0200    

Click here for diff

These are intended to be temporary until a fully automated report is developed.  
  
Since we don't know when that will happen, at least make it easier to generate the current report.  

A doc/RELEASE.md
M doc/xml/release.xml

Migrate remote command to C.

commit   : da628be8a8045e73b621fb229ac149b545008327    
  
author   : David Steele <david@pgmasters.net>    
date     : Tue, 19 Feb 2019 20:57:38 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Tue, 19 Feb 2019 20:57:38 +0200    

Click here for diff

Prior to this the Perl remote was used to satisfy C requests. This worked fine but since the remote needed to be migrated to C anyway there was no reason to wait.  
  
Add the ProtocolServer object and tweak ProtocolClient to work with it. It was also necessary to add a mechanism to get option values from the remote so that encryption settings could be read and used in the storage object.  
  
Update the remote storage objects to comply with the protocol changes and add the storage protocol handler.  
  
Ideally this commit would have been broken up into smaller chunks but there are cross-dependencies in the protocol layer and it didn't seem worth the extra effort.  

M doc/xml/release.xml
M src/Makefile
A src/command/remote/remote.c
A src/command/remote/remote.h
A src/config/protocol.c
A src/config/protocol.h
M src/main.c
M src/protocol/client.c
M src/protocol/client.h
M src/protocol/helper.c
A src/protocol/server.c
A src/protocol/server.h
M src/storage/driver/remote/fileRead.c
A src/storage/driver/remote/protocol.c
A src/storage/driver/remote/protocol.h
M src/storage/driver/remote/storage.c
M test/define.yaml
A test/src/module/command/remoteTest.c
A test/src/module/config/protocolTest.c
M test/src/module/protocol/protocolTest.c
M test/src/module/storage/remoteTest.c

Fix possible truncated WAL segments when an error occurs mid-write.

commit   : d211c2b8b51ae5b796bbb581d21a4a406e3ed972    
  
author   : David Steele <david@pgmasters.net>    
date     : Fri, 15 Feb 2019 11:52:39 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Fri, 15 Feb 2019 11:52:39 +0200    

Click here for diff

The file write object destructors called close() and finalized the file even if it was not completely written.  This was an issue in both the C and Perl code.  
  
Rewrite the destructors to simply free resources (like file handles) rather than calling the close() method.  This leaves the temp file in place for filesystems that use temp files.  
  
Add unit tests to prevent regression.  
  
Reported by blogh.  

M doc/xml/release.xml
M lib/pgBackRest/Common/Io/Base.pm
M lib/pgBackRest/Common/Io/Handle.pm
M lib/pgBackRest/Storage/Posix/FileWrite.pm
M src/perl/embed.auto.c
M src/storage/driver/posix/fileWrite.c
M test/lib/pgBackRestTest/Module/Common/CommonIoHandlePerlTest.pm
M test/lib/pgBackRestTest/Module/Storage/StoragePosixPerlTest.pm
M test/lib/pgBackRestTest/Module/Storage/StorageS3PerlTest.pm
M test/src/module/storage/posixTest.c

Change execRead() to return a size_t.

commit   : 2cd204f38037f1465c84bb4e6b55893204ee8f93    
  
author   : Stephen Frost <sfrost@snowman.net>    
date     : Tue, 12 Feb 2019 14:59:51 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Tue, 12 Feb 2019 14:59:51 +0200    

Click here for diff

execRead() should be returning a size_t, not a void. Thankfully, this isn't actually used and therefore shouldn't be an issue, but we should fix it anyway.  
  
Contributed by Stephen Frost.  

M doc/xml/release.xml
M src/common/exec.c
M src/common/exec.h

Begin v2.11 development.

commit   : a5f6f801d7651606363715471dcb958e3339414c    
  
author   : David Steele <david@pgmasters.net>    
date     : Tue, 12 Feb 2019 14:11:16 +0200    
  
committer: David Steele <david@pgmasters.net>    
date     : Tue, 12 Feb 2019 14:11:16 +0200    

Click here for diff

M doc/xml/release.xml
M lib/pgBackRest/Version.pm
M src/perl/embed.auto.c
M src/version.h