pgbackrest.git / summary / log / commit / refs

commit    7ede058b456cb708acdcdba93b52a6729adf9380
Author:   David Steele <david@pgmasters.net>
Date:     Sun Mar 01 01:31:56 2015 +0000

    Backup checksums are no longer optional.


bin/pg_backrest.pl | 13 ++---- lib/BackRest/Backup.pm | 74 ++++++++++++++-------------------- lib/BackRest/Config.pm | 3 +- lib/BackRest/Restore.pm | 70 ++++++++++++++++++-------------- test/lib/BackRestTest/BackupTest.pm | 80 ++++++++++++------------------------- test/lib/BackRestTest/CommonTest.pm | 8 ++-- 6 files changed, 103 insertions(+), 145 deletions(-) diff --git a/bin/pg_backrest.pl b/bin/pg_backrest.pl index c65fcd186..7f9f8d7d3 100755 --- a/bin/pg_backrest.pl +++ b/bin/pg_backrest.pl @@ -56,9 +56,9 @@ pg_backrest.pl [options] [operation] Restore Options: --set backup set to restore (defaults to latest set). - --delta perform a delta restore using checksums when present. + --delta perform a delta restore. --force force a restore and overwrite all existing files. - with --delta forces size/timestamp delta even if checksums are present. + with --delta forces size/timestamp deltas. Recovery Options: --type type of recovery: @@ -183,9 +183,6 @@ if (operation_get() eq OP_ARCHIVE_PUSH) my $strSection = $bArchiveLocal ? CONFIG_SECTION_ARCHIVE : CONFIG_SECTION_BACKUP; my $strArchivePath = config_key_load($strSection, CONFIG_KEY_PATH); - # Get checksum flag - my $bChecksum = config_key_load(CONFIG_SECTION_BACKUP, CONFIG_KEY_CHECKSUM, true, 'y') eq 'y' ? true : false; - # Get the async compress flag. If compress_async=y then compression is off for the initial push when archiving locally my $bCompressAsync = false; @@ -234,8 +231,7 @@ if (operation_get() eq OP_ARCHIVE_PUSH) $oFile, undef, $bCompress, - undef, - !$bChecksum + undef ); &log(INFO, 'pushing archive log ' . $ARGV[1] . ($bArchiveLocal ? ' asynchronously' : '')); @@ -306,7 +302,6 @@ if (operation_get() eq OP_ARCHIVE_PUSH) undef, $bCompress, undef, - !$bChecksum, config_key_load(CONFIG_SECTION_BACKUP, CONFIG_KEY_THREAD_MAX), undef, config_key_load(CONFIG_SECTION_BACKUP, CONFIG_KEY_THREAD_TIMEOUT) @@ -482,7 +477,6 @@ if ($strRemote eq BACKUP) # Get the operational flags my $bCompress = config_key_load(CONFIG_SECTION_BACKUP, CONFIG_KEY_COMPRESS, true, 'y') eq 'y' ? true : false; -my $bChecksum = config_key_load(CONFIG_SECTION_BACKUP, CONFIG_KEY_CHECKSUM, true, 'y') eq 'y' ? true : false; # Set the lock path my $strLockPath = config_key_load(CONFIG_SECTION_BACKUP, CONFIG_KEY_PATH, true) . '/lock/' . @@ -515,7 +509,6 @@ backup_init param_get(PARAM_TYPE), config_key_load(CONFIG_SECTION_BACKUP, CONFIG_KEY_COMPRESS, true, 'y') eq 'y' ? true : false, config_key_load(CONFIG_SECTION_BACKUP, CONFIG_KEY_HARDLINK, true, 'y') eq 'y' ? true : false, - !$bChecksum, config_key_load(CONFIG_SECTION_BACKUP, CONFIG_KEY_THREAD_MAX), config_key_load(CONFIG_SECTION_BACKUP, CONFIG_KEY_ARCHIVE_REQUIRED, true, 'y') eq 'y' ? true : false, config_key_load(CONFIG_SECTION_BACKUP, CONFIG_KEY_THREAD_TIMEOUT), diff --git a/lib/BackRest/Backup.pm b/lib/BackRest/Backup.pm index 417c74403..c8ecd6624 100644 --- a/lib/BackRest/Backup.pm +++ b/lib/BackRest/Backup.pm @@ -31,7 +31,6 @@ my $oFile; my $strType; # Type of backup: full, differential (diff), incremental (incr) my $bCompress; my $bHardLink; -my $bNoChecksum; my $iThreadMax; my $iThreadLocalMax; my $iThreadThreshold = 10; @@ -57,7 +56,6 @@ sub backup_init my $strTypeParam = shift; my $bCompressParam = shift; my $bHardLinkParam = shift; - my $bNoChecksumParam = shift; my $iThreadMaxParam = shift; my $bArchiveRequiredParam = shift; my $iThreadTimeoutParam = shift; @@ -69,7 +67,6 @@ sub backup_init $strType = $strTypeParam; $bCompress = $bCompressParam; $bHardLink = $bHardLinkParam; - $bNoChecksum = $bNoChecksumParam; $bArchiveRequired = $bArchiveRequiredParam; $iThreadMax = $iThreadMaxParam; $iThreadTimeout = $iThreadTimeoutParam; @@ -321,7 +318,7 @@ sub archive_push my $bArchiveFile = basename($strSourceFile) =~ /^[0-F]{24}$/ ? true : false; # Append the checksum (if requested) - if ($bArchiveFile && !$bNoChecksum) + if ($bArchiveFile) { $strDestinationFile .= '-' . $oFile->hash(PATH_DB_ABSOLUTE, $strSourceFile); } @@ -927,7 +924,7 @@ sub backup_file &log(TRACE, "file ${strFile} already exists from previous backup attempt"); $oBackupManifest->remove($strSectionFile, $strFile, MANIFEST_SUBKEY_EXISTS); - $bProcess = !$bNoChecksum && !$oBackupManifest->test($strSectionFile, $strFile, MANIFEST_SUBKEY_CHECKSUM); + $bProcess = !$oBackupManifest->test($strSectionFile, $strFile, MANIFEST_SUBKEY_CHECKSUM); $bProcessChecksumOnly = $bProcess; } else @@ -1059,7 +1056,7 @@ sub backup_file "size $oyThreadData[$iThreadIdx]{small_size}"); # Start the thread - $oThread[$iThreadIdx] = threads->create(\&backup_file_thread, true, $iThreadIdx, !$bNoChecksum, !$bPathCreate, + $oThread[$iThreadIdx] = threads->create(\&backup_file_thread, true, $iThreadIdx, !$bPathCreate, $oyThreadData[$iThreadIdx]{size}, $oBackupManifest); } @@ -1119,20 +1116,17 @@ sub backup_file else { &log(DEBUG, "starting backup in main process"); - backup_file_thread(false, 0, !$bNoChecksum, !$bPathCreate, $oyThreadData[0]{size}, $oBackupManifest); + backup_file_thread(false, 0, !$bPathCreate, $oyThreadData[0]{size}, $oBackupManifest); } } sub backup_file_thread { - my @args = @_; - - my $bMulti = $args[0]; # Is this thread one of many? - my $iThreadIdx = $args[1]; # Defines the index of this thread - my $bChecksum = $args[2]; # Should checksums be generated on files after they have been backed up? - my $bPathCreate = $args[3]; # Should paths be created automatically? - my $lSizeTotal = $args[4]; # Total size of the files to be copied by this thread - my $oBackupManifest = $args[5]; # Backup manifest object (only used when single-threaded) + my $bMulti = shift; # Is this thread one of many? + my $iThreadIdx = shift; # Defines the index of this thread + my $bPathCreate = shift; # Should paths be created automatically? + my $lSizeTotal = shift; # Total size of the files to be copied by this thread + my $oBackupManifest = shift; # Backup manifest object (only used when single-threaded) my $lSize = 0; # Size of files currently copied by this thread my $strLog; # Store the log message @@ -1205,7 +1199,7 @@ sub backup_file_thread ($lSizeTotal > 0 ? ', ' . int($lSize * 100 / $lSizeTotal) . '%' : '') . ')'; # Generate checksum for file if configured - if ($bChecksum && $lCopySize != 0) + if ($lCopySize != 0) { # Store checksum in the manifest if ($bMulti) @@ -1306,7 +1300,6 @@ sub backup $oBackupManifest->set(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_TYPE, undef, $strType); $oBackupManifest->set(MANIFEST_SECTION_BACKUP, MANIFEST_KEY_TIMESTAMP_START, undef, $strTimestampStart); $oBackupManifest->set(MANIFEST_SECTION_BACKUP_OPTION, MANIFEST_KEY_COMPRESS, undef, $bCompress ? 'y' : 'n'); - $oBackupManifest->set(MANIFEST_SECTION_BACKUP_OPTION, MANIFEST_KEY_CHECKSUM, undef, !$bNoChecksum ? 'y' : 'n'); $oBackupManifest->set(MANIFEST_SECTION_BACKUP_OPTION, MANIFEST_KEY_HARDLINK, undef, $bHardLink ? 'y' : 'n'); # Start backup (unless no-start-stop is set) @@ -1495,10 +1488,11 @@ sub backup # Copy the log file from the archive repo to the backup my $strDestinationFile = "base/pg_xlog/${strArchive}" . ($bCompress ? ".$oFile->{strCompressExtension}" : ''); - $oFile->copy(PATH_BACKUP_ARCHIVE, $stryArchiveFile[0], - PATH_BACKUP_TMP, $strDestinationFile, - $stryArchiveFile[0] =~ "^.*\.$oFile->{strCompressExtension}\$", - $bCompress, undef, $lModificationTime); + my ($bCopyResult, $strCopyChecksum, $lCopySize) = + $oFile->copy(PATH_BACKUP_ARCHIVE, $stryArchiveFile[0], + PATH_BACKUP_TMP, $strDestinationFile, + $stryArchiveFile[0] =~ "^.*\.$oFile->{strCompressExtension}\$", + $bCompress, undef, $lModificationTime); # Add the archive file to the manifest so it can be part of the restore and checked in validation my $strPathSection = 'base:path'; @@ -1506,33 +1500,23 @@ sub backup my $strFileSection = 'base:file'; my $strFileLog = "pg_xlog/${strArchive}"; - # Get the checksum and compare against the one already on log log file (if there is one) - my $strChecksum = undef; - - if (!$bNoChecksum) + # Compare the checksum against the one already in the archive log name + if ($stryArchiveFile[0] =~ "^${strArchive}-[0-f]+(\\.$oFile->{strCompressExtension}){0,1}\$" && + $stryArchiveFile[0] !~ "^${strArchive}-${strCopyChecksum}(\\.$oFile->{strCompressExtension}){0,1}\$") { - $strChecksum = $oFile->hash(PATH_BACKUP_TMP, $strDestinationFile, $bCompress); - - if ($stryArchiveFile[0] =~ "^${strArchive}-[0-f]+(\\.$oFile->{strCompressExtension}){0,1}\$" && - $stryArchiveFile[0] !~ "^${strArchive}-${strChecksum}(\\.$oFile->{strCompressExtension}){0,1}\$") - { - confess &log(ERROR, "error copying log '$stryArchiveFile[0]' to backup - checksum recored with file does " . - "not match actual checksum of '${strChecksum}'", ERROR_CHECKSUM); - } + confess &log(ERROR, "error copying log '$stryArchiveFile[0]' to backup - checksum recorded with file does " . + "not match actual checksum of '${strCopyChecksum}'", ERROR_CHECKSUM); } - if (defined($strChecksum)) - { - # Set manifest values - $oBackupManifest->set($strFileSection, $strFileLog, MANIFEST_SUBKEY_USER, - $oBackupManifest->get($strPathSection, $strPathLog, MANIFEST_SUBKEY_USER)); - $oBackupManifest->set($strFileSection, $strFileLog, MANIFEST_SUBKEY_GROUP, - $oBackupManifest->get($strPathSection, $strPathLog, MANIFEST_SUBKEY_GROUP)); - $oBackupManifest->set($strFileSection, $strFileLog, MANIFEST_SUBKEY_MODE, '0700'); - $oBackupManifest->set($strFileSection, $strFileLog, MANIFEST_SUBKEY_MODIFICATION_TIME, $lModificationTime); - $oBackupManifest->set($strFileSection, $strFileLog, MANIFEST_SUBKEY_SIZE, 16777216); - $oBackupManifest->set($strFileSection, $strFileLog, MANIFEST_SUBKEY_CHECKSUM, $strChecksum); - } + # Set manifest values + $oBackupManifest->set($strFileSection, $strFileLog, MANIFEST_SUBKEY_USER, + $oBackupManifest->get($strPathSection, $strPathLog, MANIFEST_SUBKEY_USER)); + $oBackupManifest->set($strFileSection, $strFileLog, MANIFEST_SUBKEY_GROUP, + $oBackupManifest->get($strPathSection, $strPathLog, MANIFEST_SUBKEY_GROUP)); + $oBackupManifest->set($strFileSection, $strFileLog, MANIFEST_SUBKEY_MODE, '0700'); + $oBackupManifest->set($strFileSection, $strFileLog, MANIFEST_SUBKEY_MODIFICATION_TIME, $lModificationTime); + $oBackupManifest->set($strFileSection, $strFileLog, MANIFEST_SUBKEY_SIZE, $lCopySize); + $oBackupManifest->set($strFileSection, $strFileLog, MANIFEST_SUBKEY_CHECKSUM, $strCopyChecksum); } } diff --git a/lib/BackRest/Config.pm b/lib/BackRest/Config.pm index b335e7b37..9cc599eb4 100644 --- a/lib/BackRest/Config.pm +++ b/lib/BackRest/Config.pm @@ -46,7 +46,7 @@ our @EXPORT = qw(config_load config_key_load config_section_load operation_get o CONFIG_KEY_LEVEL_FILE CONFIG_KEY_LEVEL_CONSOLE - CONFIG_KEY_COMPRESS CONFIG_KEY_CHECKSUM CONFIG_KEY_PSQL CONFIG_KEY_REMOTE + CONFIG_KEY_COMPRESS CONFIG_KEY_PSQL CONFIG_KEY_REMOTE CONFIG_KEY_FULL_RETENTION CONFIG_KEY_DIFFERENTIAL_RETENTION CONFIG_KEY_ARCHIVE_RETENTION_TYPE CONFIG_KEY_ARCHIVE_RETENTION @@ -160,7 +160,6 @@ use constant CONFIG_KEY_LEVEL_CONSOLE => 'level-console', CONFIG_KEY_COMPRESS => 'compress', - CONFIG_KEY_CHECKSUM => 'checksum', CONFIG_KEY_PSQL => 'psql', CONFIG_KEY_REMOTE => 'remote', diff --git a/lib/BackRest/Restore.pm b/lib/BackRest/Restore.pm index 5f4e7103f..24ad4a64a 100644 --- a/lib/BackRest/Restore.pm +++ b/lib/BackRest/Restore.pm @@ -682,25 +682,8 @@ sub restore_thread # Perform delta if requested if ($self->{bDelta}) { - # Do checksum delta if --force was not requested and checksums exist - my $strChecksum = $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_CHECKSUM, false); - - if (!$self->{bForce} && defined($strChecksum) && - $oFileThread->hash(PATH_DB_ABSOLUTE, $strDestinationFile) eq $strChecksum) - { - &log(DEBUG, "${strDestinationFile} exists and matches backup checksum ${strChecksum}"); - - # Even if hash is the same set the time back to backup time. This helps with unit testing, but also - # presents a pristine version of the database. - utime($oManifest->get($strSection, $strName, MANIFEST_SUBKEY_MODIFICATION_TIME), - $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_MODIFICATION_TIME), - $strDestinationFile) - or confess &log(ERROR, "unable to set time for ${strDestinationFile}"); - - next; - } - # Else use size/timestamp delta - else + # If force then use size/timestamp delta + if ($self->{bForce}) { my $oStat = lstat($strDestinationFile); @@ -715,6 +698,25 @@ sub restore_thread next; } } + else + { + my ($strChecksum, $lSize) = $oFileThread->hash_size(PATH_DB_ABSOLUTE, $strDestinationFile); + + if (($lSize == $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_SIZE) && $lSize == 0) || + ($strChecksum eq $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_CHECKSUM))) + { + &log(DEBUG, "${strDestinationFile} exists and is zero size or matches backup checksum"); + + # Even if hash is the same set the time back to backup time. This helps with unit testing, but also + # presents a pristine version of the database. + utime($oManifest->get($strSection, $strName, MANIFEST_SUBKEY_MODIFICATION_TIME), + $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_MODIFICATION_TIME), + $strDestinationFile) + or confess &log(ERROR, "unable to set time for ${strDestinationFile}"); + + next; + } + } } $oFileThread->remove(PATH_DB_ABSOLUTE, $strDestinationFile); @@ -722,17 +724,25 @@ sub restore_thread # Set user and group if running as root (otherwise current user and group will be used for restore) # Copy the file from the backup to the database - $oFileThread->copy(PATH_BACKUP_CLUSTER, (defined($strReference) ? $strReference : $self->{strBackupPath}) . - "/${strSourcePath}/${strName}" . - ($bSourceCompression ? '.' . $oFileThread->{strCompressExtension} : ''), - PATH_DB_ABSOLUTE, $strDestinationFile, - $bSourceCompression, # Source is compressed based on backup settings - undef, undef, - $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_MODIFICATION_TIME), - $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_MODE), - undef, - $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_USER), - $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_GROUP)); + my ($bCopyResult, $strCopyChecksum, $lCopySize) = + $oFileThread->copy(PATH_BACKUP_CLUSTER, (defined($strReference) ? $strReference : $self->{strBackupPath}) . + "/${strSourcePath}/${strName}" . + ($bSourceCompression ? '.' . $oFileThread->{strCompressExtension} : ''), + PATH_DB_ABSOLUTE, $strDestinationFile, + $bSourceCompression, # Source is compressed based on backup settings + undef, undef, + $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_MODIFICATION_TIME), + $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_MODE), + undef, + $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_USER), + $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_GROUP)); + + if ($lCopySize != 0 && $strCopyChecksum ne $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_CHECKSUM)) + { + confess &log(ERROR, "error restoring ${strDestinationFile}: actual checksum ${strCopyChecksum} " . + "does not match expected checksum " . + $oManifest->get($strSection, $strName, MANIFEST_SUBKEY_CHECKSUM), ERROR_CHECKSUM); + } } # Even number threads move up when they have finished a queue, odd numbered threads move down diff --git a/test/lib/BackRestTest/BackupTest.pm b/test/lib/BackRestTest/BackupTest.pm index d31ec45ed..7938de18b 100755 --- a/test/lib/BackRestTest/BackupTest.pm +++ b/test/lib/BackRestTest/BackupTest.pm @@ -191,12 +191,12 @@ sub BackRestTestBackup_ClusterStop $strPath = defined($strPath) ? $strPath : BackRestTestCommon_DbCommonPathGet(); $bImmediate = defined($bImmediate) ? $bImmediate : false; - # Disconnect user session - BackRestTestBackup_PgDisconnect(); - # If postmaster process is running then stop the cluster if (-e $strPath . '/postmaster.pid') { + # Disconnect user session + BackRestTestBackup_PgDisconnect(); + BackRestTestCommon_Execute(BackRestTestCommon_PgSqlBinPathGet() . "/pg_ctl stop -D ${strPath} -w -s -m " . ($bImmediate ? 'immediate' : 'fast')); } @@ -1130,9 +1130,7 @@ sub BackRestTestBackup_RestoreCompare $oActualManifest->set($strSection, $strName, 'size', ${$oExpectedManifestRef}{$strSection}{$strName}{size}); } - if ($oActualManifest->get($strSection, $strName, 'size') != 0 && - defined(${$oExpectedManifestRef}{'backup:option'}{checksum}) && - ${$oExpectedManifestRef}{'backup:option'}{checksum} eq 'y') + if ($oActualManifest->get($strSection, $strName, 'size') != 0) { $oActualManifest->set($strSection, $strName, 'checksum', $oFile->hash(PATH_DB_ABSOLUTE, "${strSectionPath}/${strName}")); @@ -1141,8 +1139,6 @@ sub BackRestTestBackup_RestoreCompare } # Set actual to expected for settings that always change from backup to backup - $oActualManifest->set(MANIFEST_SECTION_BACKUP_OPTION, MANIFEST_KEY_CHECKSUM, undef, - ${$oExpectedManifestRef}{'backup:option'}{checksum}); $oActualManifest->set(MANIFEST_SECTION_BACKUP_OPTION, MANIFEST_KEY_COMPRESS, undef, ${$oExpectedManifestRef}{'backup:option'}{compress}); $oActualManifest->set(MANIFEST_SECTION_BACKUP_OPTION, MANIFEST_KEY_HARDLINK, undef, @@ -1243,15 +1239,13 @@ sub BackRestTestBackup_Test { for (my $bCompress = false; $bCompress <= true; $bCompress++) { - for (my $bChecksum = false; $bChecksum <= true; $bChecksum++) - { for (my $bArchiveAsync = false; $bArchiveAsync <= true; $bArchiveAsync++) { for (my $bCompressAsync = false; $bCompressAsync <= true; $bCompressAsync++) { # Increment the run, log, and decide whether this unit test should be run if (!BackRestTestCommon_Run(++$iRun, - "rmt ${bRemote}, cmp ${bCompress}, chk ${bChecksum}, " . + "rmt ${bRemote}, cmp ${bCompress}, " . "arc_async ${bArchiveAsync}, cmp_async ${bCompressAsync}")) {next} # Create the test directory @@ -1274,7 +1268,7 @@ sub BackRestTestBackup_Test BackRestTestCommon_ConfigCreate('db', ($bRemote ? BACKUP : undef), $bCompress, - $bChecksum, # checksum + undef, # checksum undef, # hardlink undef, # thread-max $bArchiveAsync, @@ -1317,12 +1311,7 @@ sub BackRestTestBackup_Test BackRestTestCommon_Execute($strCommand . " ${strSourceFile}"); # Build the archive name to check for at the destination - my $strArchiveCheck = $strArchiveFile; - - if ($bChecksum) - { - $strArchiveCheck .= "-${strArchiveChecksum}"; - } + my $strArchiveCheck = "${strArchiveFile}-${strArchiveChecksum}"; if ($bCompress) { @@ -1345,7 +1334,6 @@ sub BackRestTestBackup_Test } } } - } $bCreate = true; } @@ -1372,13 +1360,11 @@ sub BackRestTestBackup_Test { for (my $bCompress = false; $bCompress <= true; $bCompress++) { - for (my $bChecksum = false; $bChecksum <= true; $bChecksum++) - { for (my $bExists = false; $bExists <= true; $bExists++) { # Increment the run, log, and decide whether this unit test should be run if (!BackRestTestCommon_Run(++$iRun, - "rmt ${bRemote}, cmp ${bCompress}, chk ${bChecksum}, exists ${bExists}")) {next} + "rmt ${bRemote}, cmp ${bCompress}, exists ${bExists}")) {next} # Create the test directory if ($bCreate) @@ -1403,7 +1389,7 @@ sub BackRestTestBackup_Test BackRestTestCommon_ConfigCreate('db', # local ($bRemote ? BACKUP : undef), # remote $bCompress, # compress - $bChecksum, # checksum + undef, # checksum undef, # hardlink undef, # thread-max undef, # archive-async @@ -1430,12 +1416,7 @@ sub BackRestTestBackup_Test &log(INFO, ' archive ' .sprintf('%02x', $iArchiveNo) . " - ${strArchiveFile}"); - my $strSourceFile = $strArchiveFile; - - if ($bChecksum) - { - $strSourceFile .= "-${strArchiveChecksum}"; - } + my $strSourceFile = "${strArchiveFile}-${strArchiveChecksum}"; if ($bCompress) { @@ -1479,7 +1460,6 @@ sub BackRestTestBackup_Test $bCreate = true; } } - } } if (BackRestTestCommon_Cleanup()) @@ -1504,14 +1484,11 @@ sub BackRestTestBackup_Test { for (my $bCompress = false; $bCompress <= true; $bCompress++) { - for (my $bChecksum = false; $bChecksum <= true; $bChecksum++) - { for (my $bHardlink = false; $bHardlink <= true; $bHardlink++) { # Increment the run, log, and decide whether this unit test should be run if (!BackRestTestCommon_Run(++$iRun, - "rmt ${bRemote}, cmp ${bCompress}, chk ${bChecksum}, " . - "hardlink ${bHardlink}")) {next} + "rmt ${bRemote}, cmp ${bCompress}, hardlink ${bHardlink}")) {next} # Get base time my $lTime = time() - 100000; @@ -1521,7 +1498,6 @@ sub BackRestTestBackup_Test $oManifest{backup}{version} = version_get(); $oManifest{'backup:option'}{compress} = $bCompress ? 'y' : 'n'; - $oManifest{'backup:option'}{checksum} = $bChecksum ? 'y' : 'n'; $oManifest{'backup:option'}{hardlink} = $bHardlink ? 'y' : 'n'; # Create the test directory @@ -1541,13 +1517,13 @@ sub BackRestTestBackup_Test ); BackRestTestBackup_ManifestFileCreate(\%oManifest, 'base', 'PG_VERSION', '9.3', - $bChecksum ? 'e1f7a3a299f62225cba076fc6d3d6e677f303482' : undef, $lTime); + 'e1f7a3a299f62225cba076fc6d3d6e677f303482', $lTime); # Create base path BackRestTestBackup_ManifestPathCreate(\%oManifest, 'base', 'base'); BackRestTestBackup_ManifestFileCreate(\%oManifest, 'base', 'base/base1.txt', 'BASE', - $bChecksum ? 'a3b357a3e395e43fcfb19bb13f3c1b5179279593' : undef, $lTime); + 'a3b357a3e395e43fcfb19bb13f3c1b5179279593', $lTime); # Create tablespace path BackRestTestBackup_ManifestPathCreate(\%oManifest, 'base', 'pg_tblspc'); @@ -1556,7 +1532,7 @@ sub BackRestTestBackup_Test BackRestTestCommon_ConfigCreate('db', # local $bRemote ? BACKUP : undef, # remote $bCompress, # compress - $bChecksum, # checksum + true, # checksum $bRemote ? undef : $bHardlink, # hardlink $iThreadMax); # thread-max @@ -1566,7 +1542,7 @@ sub BackRestTestBackup_Test BackRestTestCommon_ConfigCreate('backup', # local DB, # remote $bCompress, # compress - $bChecksum, # checksum + true, # checksum $bHardlink, # hardlink $iThreadMax); # thread-max } @@ -1631,7 +1607,7 @@ sub BackRestTestBackup_Test BackRestTestBackup_ManifestTablespaceCreate(\%oManifest, 1); BackRestTestBackup_ManifestFileCreate(\%oManifest, "tablespace:1", 'tablespace1.txt', 'TBLSPC1', - $bChecksum ? 'd85de07d6421d90aa9191c11c889bfde43680f0f' : undef, $lTime); + 'd85de07d6421d90aa9191c11c889bfde43680f0f', $lTime); my $strBackup = BackRestTestBackup_BackupSynthetic($strType, $strStanza, $bRemote, $oFile, \%oManifest, @@ -1651,7 +1627,7 @@ sub BackRestTestBackup_Test BackRestTestBackup_ManifestTablespaceCreate(\%oManifest, 2); BackRestTestBackup_ManifestFileCreate(\%oManifest, "tablespace:2", 'tablespace2.txt', 'TBLSPC2', - $bChecksum ? 'dc7f76e43c46101b47acc55ae4d593a9e6983578' : undef, $lTime); + 'dc7f76e43c46101b47acc55ae4d593a9e6983578', $lTime); $strBackup = BackRestTestBackup_BackupSynthetic($strType, $strStanza, $bRemote, $oFile, \%oManifest, 'resume and add tablespace 2', TEST_BACKUP_RESUME); @@ -1692,12 +1668,12 @@ sub BackRestTestBackup_Test BackRestTestBackup_ManifestReference(\%oManifest, $strBackup); BackRestTestBackup_ManifestFileCreate(\%oManifest, 'base', 'base/base2.txt', 'BASE2', - $bChecksum ? '09b5e31766be1dba1ec27de82f975c1b6eea2a92' : undef, $lTime); + '09b5e31766be1dba1ec27de82f975c1b6eea2a92', $lTime); BackRestTestBackup_ManifestTablespaceDrop(\%oManifest, 1, 2); BackRestTestBackup_ManifestFileCreate(\%oManifest, "tablespace:2", 'tablespace2b.txt', 'TBLSPC2B', - $bChecksum ? 'e324463005236d83e6e54795dbddd20a74533bf3' : undef, $lTime); + 'e324463005236d83e6e54795dbddd20a74533bf3', $lTime); $strBackup = BackRestTestBackup_BackupSynthetic($strType, $strStanza, $bRemote, $oFile, \%oManifest, 'add files and remove tablespace 2'); @@ -1708,7 +1684,7 @@ sub BackRestTestBackup_Test BackRestTestBackup_ManifestReference(\%oManifest, $strBackup); BackRestTestBackup_ManifestFileCreate(\%oManifest, 'base', 'base/base1.txt', 'BASEUPDT', - $bChecksum ? '9a53d532e27785e681766c98516a5e93f096a501' : undef, $lTime); + '9a53d532e27785e681766c98516a5e93f096a501', $lTime); $strBackup = BackRestTestBackup_BackupSynthetic($strType, $strStanza, $bRemote, $oFile, \%oManifest, 'update files'); @@ -1742,7 +1718,7 @@ sub BackRestTestBackup_Test BackRestTestBackup_ManifestFileRemove(\%oManifest, "tablespace:2", 'tablespace2b.txt', true); BackRestTestBackup_ManifestFileCreate(\%oManifest, "tablespace:2", 'tablespace2c.txt', 'TBLSPC2C', - $bChecksum ? 'ad7df329ab97a1e7d35f1ff0351c079319121836' : undef, $lTime); + 'ad7df329ab97a1e7d35f1ff0351c079319121836', $lTime); BackRestTestBackup_BackupBegin($strType, $strStanza, $bRemote, "remove files during backup", true, true, 1); BackRestTestCommon_ExecuteEnd(TEST_MANIFEST_BUILD); @@ -1757,7 +1733,7 @@ sub BackRestTestBackup_Test BackRestTestBackup_ManifestReference(\%oManifest); BackRestTestBackup_ManifestFileCreate(\%oManifest, 'base', 'base/base1.txt', 'BASEUPDT2', - $bChecksum ? '7579ada0808d7f98087a0a586d0df9de009cdc33' : undef, $lTime); + '7579ada0808d7f98087a0a586d0df9de009cdc33', $lTime); $strFullBackup = BackRestTestBackup_BackupSynthetic($strType, $strStanza, $bRemote, $oFile, \%oManifest); @@ -1767,13 +1743,12 @@ sub BackRestTestBackup_Test BackRestTestBackup_ManifestReference(\%oManifest, $strFullBackup); BackRestTestBackup_ManifestFileCreate(\%oManifest, 'base', 'base/base2.txt', 'BASE2UPDT', - $bChecksum ? 'cafac3c59553f2cfde41ce2e62e7662295f108c0' : undef, $lTime); + 'cafac3c59553f2cfde41ce2e62e7662295f108c0', $lTime); $strBackup = BackRestTestBackup_BackupSynthetic($strType, $strStanza, $bRemote, $oFile, \%oManifest, 'add files'); } } } - } if (BackRestTestCommon_Cleanup()) { @@ -1799,13 +1774,11 @@ sub BackRestTestBackup_Test { for (my $bCompress = false; $bCompress <= true; $bCompress++) { - for (my $bChecksum = false; $bChecksum <= true; $bChecksum++) - { for (my $bArchiveAsync = false; $bArchiveAsync <= true; $bArchiveAsync++) { # Increment the run, log, and decide whether this unit test should be run if (!BackRestTestCommon_Run(++$iRun, - "rmt ${bRemote}, cmp ${bCompress}, chk ${bChecksum}, arc_async ${bArchiveAsync}")) {next} + "rmt ${bRemote}, cmp ${bCompress}, arc_async ${bArchiveAsync}")) {next} # Create the file object my $oFile = new BackRest::File @@ -1827,7 +1800,7 @@ sub BackRestTestBackup_Test BackRestTestCommon_ConfigCreate('db', # local $bRemote ? BACKUP : undef, # remote $bCompress, # compress - $bChecksum, # checksum + undef, # checksum $bRemote ? undef : true, # hardlink $iThreadMax, # thread-max $bArchiveAsync, # archive-async @@ -1839,7 +1812,7 @@ sub BackRestTestBackup_Test BackRestTestCommon_ConfigCreate('backup', # local $bRemote ? DB : undef, # remote $bCompress, # compress - $bChecksum, # checksum + undef, # checksum true, # hardlink $iThreadMax, # thread-max undef, # archive-async @@ -2112,7 +2085,6 @@ sub BackRestTestBackup_Test } } } - } if (BackRestTestCommon_Cleanup()) { diff --git a/test/lib/BackRestTest/CommonTest.pm b/test/lib/BackRestTest/CommonTest.pm index 1b13b5dba..bf0400dab 100755 --- a/test/lib/BackRestTest/CommonTest.pm +++ b/test/lib/BackRestTest/CommonTest.pm @@ -613,10 +613,10 @@ sub BackRestTestCommon_ConfigCreate $oParamHash{'global:backup'}{'compress'} = 'n'; } - if (defined($bChecksum) && !$bChecksum) - { - $oParamHash{'global:backup'}{'checksum'} = 'n'; - } + # if (defined($bChecksum) && $bChecksum) + # { + # $oParamHash{'global:backup'}{'checksum'} = 'y'; + # } $oParamHash{$strCommonStanza}{'path'} = $strCommonDbCommonPath; $oParamHash{'global:backup'}{'path'} = $strCommonBackupPath; [parent: 28326d6b4c4a]