From b865070eddb4eedbeab70e5de287e250680b3f85 Mon Sep 17 00:00:00 2001 From: David Steele Date: Sun, 14 Jun 2015 10:12:36 -0400 Subject: [PATCH] Experimental 9.5 support. Unit tests are not working yet. --- README.md | 2 + doc/doc.xml | 3 ++ lib/BackRest/Archive.pm | 7 ++- lib/BackRest/Db.pm | 11 +++-- test/lib/BackRestTest/CommonTest.pm | 16 ++++++- test/test.pl | 74 +++++++++++++++-------------- 6 files changed, 70 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 46c8314f5..ed907ac75 100644 --- a/README.md +++ b/README.md @@ -774,6 +774,8 @@ example: db-path=/data/db * Logging now uses unbuffered output. This should make log files that are being written by multiple threads less chaotic. Suggested by Michael Renner. +* Experimental support for PostgreSQL 9.5. This may break when the control version or WAL magic changes but will be kept as up to date as possible in each release. + ### v0.70: Stability improvements for archiving, improved logging and help * Fixed an issue where archive-copy would fail on an incr/diff backup when hardlink=n. In this case the pg_xlog path does not already exist and must be created. Reported by Michael Renner diff --git a/doc/doc.xml b/doc/doc.xml index c232007ff..450f19efd 100644 --- a/doc/doc.xml +++ b/doc/doc.xml @@ -732,6 +732,9 @@ Run a full backup on the db stanza. --type can Logging now uses unbuffered output. This should make log files that are being written by multiple threads less chaotic. Suggested by Michael Renner. + + Experimental support for 9.5. This may break when the control version or WAL magic changes but will be updated in each release. + diff --git a/lib/BackRest/Archive.pm b/lib/BackRest/Archive.pm index 8463cbb57..7d32ee6c7 100644 --- a/lib/BackRest/Archive.pm +++ b/lib/BackRest/Archive.pm @@ -176,7 +176,12 @@ sub walInfo my $strDbVersion; my $iSysIdOffset; - if ($iMagic == hex('0xD07E')) + if ($iMagic == hex('0xD085')) + { + $strDbVersion = '9.5'; + $iSysIdOffset = 20; + } + elsif ($iMagic == hex('0xD07E')) { $strDbVersion = '9.4'; $iSysIdOffset = 20; diff --git a/lib/BackRest/Db.pm b/lib/BackRest/Db.pm index c52cb0fd0..80ae8b4ba 100644 --- a/lib/BackRest/Db.pm +++ b/lib/BackRest/Db.pm @@ -90,7 +90,7 @@ sub is_remote #################################################################################################################################### sub versionSupport { - my @strySupportVersion = ('8.3', '8.4', '9.0', '9.1', '9.2', '9.3', '9.4'); + my @strySupportVersion = ('8.3', '8.4', '9.0', '9.1', '9.2', '9.3', '9.4', '9.5'); return \@strySupportVersion; } @@ -216,14 +216,15 @@ sub info close($hFile); # Make sure the control version is supported - if ($iControlVersion == 942 && $iCatalogVersion == 201505311) - { - $strDbVersion = '9.5'; - } if ($iControlVersion == 942 && $iCatalogVersion == 201409291) { $strDbVersion = '9.4'; } + # Leave 9.5 catalog version out until it stabilizes (then move 9.5 to the top of if list) + elsif ($iControlVersion == 942) # && $iCatalogVersion == 201505311) + { + $strDbVersion = '9.5'; + } elsif ($iControlVersion == 937 && $iCatalogVersion == 201306121) { $strDbVersion = '9.3'; diff --git a/test/lib/BackRestTest/CommonTest.pm b/test/lib/BackRestTest/CommonTest.pm index 8c6e998df..048560028 100755 --- a/test/lib/BackRestTest/CommonTest.pm +++ b/test/lib/BackRestTest/CommonTest.pm @@ -787,7 +787,13 @@ sub BackRestTestCommon_Setup # Get the Postgres version my @stryVersionToken = split(/ /, $strOutLog); @stryVersionToken = split(/\./, $stryVersionToken[2]); - $strCommonDbVersion = $stryVersionToken[0] . '.' . $stryVersionToken[1]; + $strCommonDbVersion = $stryVersionToken[0] . '.' . trim($stryVersionToken[1]); + + if ($strCommonDbVersion =~ /devel$/) + { + $strCommonDbVersion =~ s/devel$//; + &log(INFO, "Testing against ${strCommonDbVersion} development version"); + } # Don't run unit tests for unsupported versions my $strVersionSupport = versionSupport(); @@ -796,6 +802,14 @@ sub BackRestTestCommon_Setup { confess "currently only version ${$strVersionSupport}[0] and up are supported"; } + + if ($strCommonDbVersion eq '9.5') + { + &log(WARN, "unit tests do not currently work with version 9.5"); + return false; + } + + return true; } #################################################################################################################################### diff --git a/test/test.pl b/test/test.pl index 19573b362..fc87d2a55 100755 --- a/test/test.pl +++ b/test/test.pl @@ -252,49 +252,51 @@ eval { do { - BackRestTestCommon_Setup($strTestPath, $stryTestVersion[0], $iModuleTestRun, $bDryRun, $bNoCleanup, $bLogForce); - - &log(INFO, "TESTING psql-bin = $stryTestVersion[0]\n"); - - if ($bInfinite) + if (BackRestTestCommon_Setup($strTestPath, $stryTestVersion[0], $iModuleTestRun, $bDryRun, $bNoCleanup, $bLogForce)) { - $iRun++; - &log(INFO, "INFINITE - RUN ${iRun}\n"); - } + &log(INFO, "TESTING psql-bin = $stryTestVersion[0]\n"); - if ($strModule eq 'all' || $strModule eq 'utility') - { - BackRestTestUtility_Test($strModuleTest); - } - - if ($strModule eq 'all' || $strModule eq 'config') - { - BackRestTestConfig_Test($strModuleTest); - } - - if ($strModule eq 'all' || $strModule eq 'file') - { - BackRestTestFile_Test($strModuleTest); - } - - if ($strModule eq 'all' || $strModule eq 'backup') - { - BackRestTestBackup_Test($strModuleTest, $iThreadMax); - - if (@stryTestVersion > 1 && ($strModuleTest eq 'all' || $strModuleTest eq 'full')) + if ($bInfinite) { - for (my $iVersionIdx = 1; $iVersionIdx < @stryTestVersion; $iVersionIdx++) + $iRun++; + &log(INFO, "INFINITE - RUN ${iRun}\n"); + } + + if ($strModule eq 'all' || $strModule eq 'utility') + { + BackRestTestUtility_Test($strModuleTest); + } + + if ($strModule eq 'all' || $strModule eq 'config') + { + BackRestTestConfig_Test($strModuleTest); + } + + if ($strModule eq 'all' || $strModule eq 'file') + { + BackRestTestFile_Test($strModuleTest); + } + + if ($strModule eq 'all' || $strModule eq 'backup') + { + BackRestTestBackup_Test($strModuleTest, $iThreadMax); + + if (@stryTestVersion > 1 && ($strModuleTest eq 'all' || $strModuleTest eq 'full')) { - BackRestTestCommon_Setup($strTestPath, $stryTestVersion[$iVersionIdx], $iModuleTestRun, $bDryRun, $bNoCleanup); - &log(INFO, "TESTING psql-bin = $stryTestVersion[$iVersionIdx] for backup/full\n"); - BackRestTestBackup_Test('full', $iThreadMax); + for (my $iVersionIdx = 1; $iVersionIdx < @stryTestVersion; $iVersionIdx++) + { + BackRestTestCommon_Setup($strTestPath, $stryTestVersion[$iVersionIdx], + $iModuleTestRun, $bDryRun, $bNoCleanup); + &log(INFO, "TESTING psql-bin = $stryTestVersion[$iVersionIdx] for backup/full\n"); + BackRestTestBackup_Test('full', $iThreadMax); + } } } - } - if ($strModule eq 'compare') - { - BackRestTestCompare_Test($strModuleTest); + if ($strModule eq 'compare') + { + BackRestTestCompare_Test($strModuleTest); + } } } while ($bInfinite);