From b17bf31fb6dbe67b6efdcd634a4d29ede1cf9d76 Mon Sep 17 00:00:00 2001 From: David Steele Date: Tue, 8 Sep 2015 16:58:00 -0400 Subject: [PATCH] Implement issue #130: Info files should be updated with new version when pgBackRest is upgraded. --- lib/BackRest/Common/Ini.pm | 6 ++++++ test/lib/BackRestTest/BackupTest.pm | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/lib/BackRest/Common/Ini.pm b/lib/BackRest/Common/Ini.pm index b2289a072..25251bb82 100644 --- a/lib/BackRest/Common/Ini.pm +++ b/lib/BackRest/Common/Ini.pm @@ -105,6 +105,12 @@ sub new { confess &log(ERROR, "format of ${strFileName} is ${iFormat} but " . BACKREST_FORMAT . ' is required', ERROR_FORMAT); } + + # Check if the version has changed + if (!$self->test(INI_SECTION_BACKREST, INI_KEY_VERSION, undef, BACKREST_VERSION)) + { + $self->set(INI_SECTION_BACKREST, INI_KEY_VERSION, undef, BACKREST_VERSION); + } } else { diff --git a/test/lib/BackRestTest/BackupTest.pm b/test/lib/BackRestTest/BackupTest.pm index 014e609a1..92f98a8c2 100755 --- a/test/lib/BackRestTest/BackupTest.pm +++ b/test/lib/BackRestTest/BackupTest.pm @@ -984,6 +984,10 @@ sub BackRestTestBackup_Test BackRestTestBackup_ManifestFileCreate(\%oManifest, "tablespace/2", 'tablespace2b.txt', 'TBLSPC2B', 'e324463005236d83e6e54795dbddd20a74533bf3', $lTime); + # Munge the version to make sure it gets corrected on the next run + BackRestTestBackup_ManifestMunge($oFile, $bRemote, $strBackup, INI_SECTION_BACKREST, INI_KEY_VERSION, undef, + '0.00'); + $strBackup = BackRestTestBackup_BackupSynthetic($strType, $strStanza, $bRemote, $oFile, \%oManifest, 'add files and remove tablespace 2');