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.
pgBackRest
Regression, Unit, & Integration Testing
Introduction
pgBackRest uses Docker to run tests and generate documentation. Docker's light-weight virualization provides the a good balance between proper OS emulation and performance (especially startup)
A Vagrantfile
is provided that contains the complete configuration required to run pgBackRest tests and build documentation. If Vagrant is not suitable then the Vagrantfile
still contains the configuration steps required to build a test system.
NOTE: this is not required for normal operation of pgBackRest.
Testing
The easiest way to start testing pgBackRest is with the included Vagrantfile
.
Build Vagrant and Logon:
cd test
vagrant up
vagrant ssh
The vagrant up
command may take some time as a number of Docker containers must also be built. The vagrant ssh
command automatically logs onto the VM.
Run All Tests:
/backrest/test/test.pl
Run Tests for a Specific OS:
/backrest/test/test.pl --vm=co6
Run Tests for a Specific OS and Module:
/backrest/test/test.pl --vm=co6 --module=backup
Run Tests for a Specific OS, Module, and Test:
/backrest/test/test.pl --vm=co6 --module=backup --test=full
Run Tests for a Specific OS, Module, Test, and Run:
/backrest/test/test.pl --vm=co6 --module=backup --test=full --run=1
Run Tests for a Specific OS, Module, Test, and Process Max:
/backrest/test/test.pl --vm=co6 --module=backup --test=full --process-max=4
NOTE: process-max is only applicable to the
synthetic
andfull
tests in thebackup
module.
Run Tests for a Specific OS, Module, Test, Process Max, and Database Version:
/backrest/test/test.pl --vm=co6 --module=backup --test=full --process-max=4 --pg-version=9.4
NOTE: pg-version is only applicable to the
full
test in thebackup
module.
Iterate All Possible Test Combinations:
/backrest/test/test.pl --dry-run