pgbackrest.git / summary / log / commit / refs
commit d6d57e654e48101fdbd2ef06316f71b395dbdfd1
Author: David Steele <david@pgmasters.net>
Date: Tue Jan 06 18:08:56 2015 +0000
Fixed the way wait was done after the manifest is created. Previously, waits were done for base and each tablespace which is not very efficient. Now one wait is done after the entire manifest is built. Also storing the exact time that copy began.
bin/pg_backrest_remote.pl | 13 +--
lib/BackRest/Backup.pm | 164 ++++++++++++++++++++++--------------
lib/BackRest/File.pm | 83 ++++++++++--------
lib/BackRest/Remote.pm | 9 +-
test/lib/BackRestTest/BackupTest.pm | 4 +-
test/lib/BackRestTest/FileTest.pm | 109 ++++++++++++++++--------
6 files changed, 242 insertions(+), 140 deletions(-)
diff --git a/bin/pg_backrest_remote.pl b/bin/pg_backrest_remote.pl
index 5936bf5b7..e84d388c8 100755
--- a/bin/pg_backrest_remote.pl
+++ b/bin/pg_backrest_remote.pl
@@ -149,15 +149,19 @@ while ($strCommand ne OP_EXIT)
param_get(\%oParamHash, 'user', false),
param_get(\%oParamHash, 'group', false));
}
+ # Wait
+ elsif ($strCommand eq OP_FILE_WAIT)
+ {
+ $oRemote->output_write($oFile->wait(PATH_ABSOLUTE));
+ }
# Generate a manifest
elsif ($strCommand eq OP_FILE_MANIFEST)
{
my %oManifestHash;
- $oFile->manifest(PATH_ABSOLUTE, param_get(\%oParamHash, 'path'), \%oManifestHash,
- param_get(\%oParamHash, 'pause') eq 'y' ? true : false);
+ $oFile->manifest(PATH_ABSOLUTE, param_get(\%oParamHash, 'path'), \%oManifestHash);
- my $strOutput = "name\ttype\tuser\tgroup\tpermission\tmodification_time\tinode\tsize\tlink_destination\tfuture";
+ my $strOutput = "name\ttype\tuser\tgroup\tpermission\tmodification_time\tinode\tsize\tlink_destination";
foreach my $strName (sort(keys $oManifestHash{name}))
{
@@ -171,8 +175,7 @@ while ($strCommand ne OP_EXIT)
(defined($oManifestHash{name}{"${strName}"}{inode}) ? $oManifestHash{name}{"${strName}"}{inode} : "") . "\t" .
(defined($oManifestHash{name}{"${strName}"}{size}) ? $oManifestHash{name}{"${strName}"}{size} : "") . "\t" .
(defined($oManifestHash{name}{"${strName}"}{link_destination}) ?
- $oManifestHash{name}{"${strName}"}{link_destination} : "") . "\t" .
- (defined($oManifestHash{name}{"${strName}"}{future}) ? $oManifestHash{name}{"${strName}"}{future} : "");
+ $oManifestHash{name}{"${strName}"}{link_destination} : "");
}
$oRemote->output_write($strOutput);
diff --git a/lib/BackRest/Backup.pm b/lib/BackRest/Backup.pm
index 0bb3fea36..bb9526126 100644
--- a/lib/BackRest/Backup.pm
+++ b/lib/BackRest/Backup.pm
@@ -815,17 +815,19 @@ sub backup_manifest_build
my $oTablespaceMapRef = shift;
my $strLevel = shift;
+ # If no level is defined then it must be base
if (!defined($strLevel))
{
$strLevel = 'base';
}
+ # Get the manifest for this level
my %oManifestHash;
+ $oFile->manifest(PATH_DB_ABSOLUTE, $strDbClusterPath, \%oManifestHash);
- $oFile->manifest(PATH_DB_ABSOLUTE, $strDbClusterPath, \%oManifestHash, true);
-
- ${$oBackupManifestRef}{backup}{'timestamp-last-modified'} = 0;
+ ${$oBackupManifestRef}{'backup:path'}{$strLevel} = $strDbClusterPath;
+ # Loop though all paths/files/links in the manifest
foreach my $strName (sort(keys $oManifestHash{name}))
{
# Skip certain files during backup
@@ -852,75 +854,30 @@ sub backup_manifest_build
confess &log(ASSERT, "unrecognized file type $cType for file $strName");
}
+ # User and group required for all types
${$oBackupManifestRef}{"${strSection}"}{"${strName}"}{user} = $oManifestHash{name}{"${strName}"}{user};
${$oBackupManifestRef}{"${strSection}"}{"${strName}"}{group} = $oManifestHash{name}{"${strName}"}{group};
+ # Mode for required file and path type only
if ($cType eq 'f' || $cType eq 'd')
{
${$oBackupManifestRef}{"${strSection}"}{"${strName}"}{permission} = $oManifestHash{name}{"${strName}"}{permission};
}
+ # Modification time and size required for file type only
if ($cType eq 'f')
{
${$oBackupManifestRef}{"${strSection}"}{"${strName}"}{modification_time} = $oManifestHash{name}{"${strName}"}{modification_time} + 0;
-# ${$oBackupManifestRef}{"${strSection}"}{"${strName}"}{inode} = $oManifestHash{name}{"${strName}"}{inode} + 0;
${$oBackupManifestRef}{"${strSection}"}{"${strName}"}{size} = $oManifestHash{name}{"${strName}"}{size} + 0;
-
- if ($oManifestHash{name}{"${strName}"}{modification_time} + 0 > ${$oBackupManifestRef}{backup}{'timestamp-last-modified'})
- {
- ${$oBackupManifestRef}{backup}{'timestamp-last-modified'} = $oManifestHash{name}{"${strName}"}{modification_time} + 0;
- }
-
- if (defined(${$oLastManifestRef}{"${strSection}"}{"${strName}"}{size}) &&
-# defined(${$oLastManifestRef}{"${strSection}"}{"${strName}"}{inode}) &&
- defined(${$oLastManifestRef}{"${strSection}"}{"${strName}"}{modification_time}))
- {
- if (${$oBackupManifestRef}{"${strSection}"}{"${strName}"}{size} ==
- ${$oLastManifestRef}{"${strSection}"}{"${strName}"}{size} &&
-# ${$oBackupManifestRef}{"${strSection}"}{"${strName}"}{inode} ==
-# ${$oLastManifestRef}{"${strSection}"}{"${strName}"}{inode} &&
- ${$oBackupManifestRef}{"${strSection}"}{"${strName}"}{modification_time} ==
- ${$oLastManifestRef}{"${strSection}"}{"${strName}"}{modification_time})
- {
- if (defined(${$oLastManifestRef}{"${strSection}"}{"${strName}"}{reference}))
- {
- ${$oBackupManifestRef}{"${strSection}"}{"${strName}"}{reference} =
- ${$oLastManifestRef}{"${strSection}"}{"${strName}"}{reference};
- }
- else
- {
- ${$oBackupManifestRef}{"${strSection}"}{"${strName}"}{reference} =
- ${$oLastManifestRef}{backup}{label};
- }
-
- if (defined(${$oLastManifestRef}{"${strSection}"}{"${strName}"}{checksum}))
- {
- ${$oBackupManifestRef}{"${strSection}"}{"${strName}"}{checksum} =
- ${$oLastManifestRef}{"${strSection}"}{"${strName}"}{checksum};
- }
-
- my $strReference = ${$oBackupManifestRef}{"${strSection}"}{"${strName}"}{reference};
-
- if (!defined(${$oBackupManifestRef}{backup}{reference}))
- {
- ${$oBackupManifestRef}{backup}{reference} = $strReference;
- }
- else
- {
- if (${$oBackupManifestRef}{backup}{reference} !~ /$strReference/)
- {
- ${$oBackupManifestRef}{backup}{reference} .= ",${strReference}";
- }
- }
- }
- }
}
+ # Link destination required for link type only
if ($cType eq 'l')
{
${$oBackupManifestRef}{"${strSection}"}{"${strName}"}{link_destination} =
$oManifestHash{name}{"${strName}"}{link_destination};
+ # If this is a tablespace then follow the link
if (index($strName, 'pg_tblspc/') == 0 && $strLevel eq 'base')
{
my $strTablespaceOid = basename($strName);
@@ -935,8 +892,97 @@ sub backup_manifest_build
}
}
- ${$oBackupManifestRef}{backup}{'timestamp-last-modified'} =
- timestamp_string_get(undef, ${$oBackupManifestRef}{backup}{'timestamp-last-modified'});
+ # If this is the base level then do post-processing
+ if ($strLevel eq 'base')
+ {
+ my $bTimeInFuture = false;
+
+ my $lTimeBegin = $oFile->wait(PATH_DB_ABSOLUTE);
+
+ # Only required if comparing to last backup
+ if (defined(${$oLastManifestRef}{backup}{label}))
+ {
+ # Loop through all backup paths (base and tablespaces)
+ foreach my $strPathKey (sort(keys ${$oBackupManifestRef}{'backup:path'}))
+ {
+ my $strSection = "${strPathKey}:file";
+
+ # Make sure file section exists
+ if (defined(${$oBackupManifestRef}{$strSection}))
+ {
+ # Loop though all files
+ foreach my $strName (sort (keys ${$oBackupManifestRef}{$strSection}))
+ {
+ # If modification time is in the future (in this backup OR the last backup) set warning flag and do not
+ # allow a reference
+ if (${$oBackupManifestRef}{$strSection}{$strName}{modification_time} > $lTimeBegin ||
+ (defined(${$oLastManifestRef}{$strSection}{$strName}{future}) &&
+ ${$oLastManifestRef}{$strSection}{$strName}{future} eq 'y'))
+ {
+ $bTimeInFuture = true;
+
+ # Only mark as future if still in the future in the current backup
+ if (${$oBackupManifestRef}{$strSection}{$strName}{modification_time} > $lTimeBegin)
+ {
+ ${$oBackupManifestRef}{$strSection}{$strName}{future} = 'y';
+ }
+ }
+ # Else check if modification time and size are unchanged
+ elsif (${$oBackupManifestRef}{$strSection}{$strName}{size} ==
+ ${$oLastManifestRef}{$strSection}{$strName}{size} &&
+ ${$oBackupManifestRef}{$strSection}{$strName}{modification_time} ==
+ ${$oLastManifestRef}{$strSection}{$strName}{modification_time})
+ {
+ # Copy reference from previous backup if possible
+ if (defined(${$oLastManifestRef}{$strSection}{$strName}{reference}))
+ {
+ ${$oBackupManifestRef}{$strSection}{$strName}{reference} =
+ ${$oLastManifestRef}{$strSection}{$strName}{reference};
+ }
+ # Otherwise the reference is to the previous backup
+ else
+ {
+ ${$oBackupManifestRef}{$strSection}{$strName}{reference} =
+ ${$oLastManifestRef}{backup}{label};
+ }
+
+ # Copy the checksum from previous manifest
+ if (defined(${$oLastManifestRef}{$strSection}{$strName}{checksum}))
+ {
+ ${$oBackupManifestRef}{$strSection}{$strName}{checksum} =
+ ${$oLastManifestRef}{$strSection}{$strName}{checksum};
+ }
+
+ # Build the manifest reference list - not used for processing but is useful for debugging
+ my $strReference = ${$oBackupManifestRef}{$strSection}{$strName}{reference};
+
+ if (!defined(${$oBackupManifestRef}{backup}{reference}))
+ {
+ ${$oBackupManifestRef}{backup}{reference} = $strReference;
+ }
+ else
+ {
+ if (${$oBackupManifestRef}{backup}{reference} !~ /^$strReference|,$strReference/)
+ {
+ ${$oBackupManifestRef}{backup}{reference} .= ",${strReference}";
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ # Warn if any files in the current backup are in the future
+ if ($bTimeInFuture)
+ {
+ &log(WARN, "some files have timestamps in the future - they will be copied to prevent possible race conditions");
+ }
+
+ # Record the time when copying will start
+ ${$oBackupManifestRef}{backup}{'timestamp-copy-start'} = timestamp_string_get(undef, $lTimeBegin + 1);
+ }
+
}
####################################################################################################################################
@@ -967,7 +1013,7 @@ sub backup_file
foreach $strSectionPath (sort(keys $oBackupManifestRef))
{
# Skip non-path sections
- if ($strSectionPath !~ /\:path$/)
+ if ($strSectionPath !~ /\:path$/ || $strSectionPath =~ /^backup\:path$/)
{
next;
}
@@ -985,8 +1031,6 @@ sub backup_file
$strBackupDestinationPath = 'base';
$strSectionFile = 'base:file';
- ${$oBackupManifestRef}{'backup:path'}{base} = $strDbClusterPath;
-
# Create the archive log directory
$oFile->path_create(PATH_BACKUP_TMP, 'base/pg_xlog');
}
@@ -999,8 +1043,6 @@ sub backup_file
$strBackupDestinationPath = "tablespace/${strTablespaceName}";
$strSectionFile = "tablespace:${strTablespaceName}:file";
- ${$oBackupManifestRef}{'backup:path'}{"tablespace:${strTablespaceName}"} = $strBackupSourcePath;
-
# Create the tablespace directory and link
if ($bPathCreate)
{
@@ -1356,7 +1398,7 @@ sub backup
${oBackupManifest}{'backup:option'}{'checksum'} = !$bNoChecksum ? 'y' : 'n';
# Find the previous backup based on the type
- my %oLastManifest;
+ my %oLastManifest = undef;
my $strBackupLastPath = backup_type_find($strType, $oFile->path_get(PATH_BACKUP_CLUSTER));
diff --git a/lib/BackRest/File.pm b/lib/BackRest/File.pm
index 4d10b6f9b..44446ae8e 100644
--- a/lib/BackRest/File.pm
+++ b/lib/BackRest/File.pm
@@ -37,7 +37,7 @@ our @EXPORT = qw(PATH_ABSOLUTE PATH_DB PATH_DB_ABSOLUTE PATH_BACKUP PATH_BACKUP_
PIPE_STDIN PIPE_STDOUT PIPE_STDERR
- OP_FILE_LIST OP_FILE_EXISTS OP_FILE_HASH OP_FILE_REMOVE OP_FILE_MANIFEST OP_FILE_COMPRESS
+ OP_FILE_WAIT OP_FILE_LIST OP_FILE_EXISTS OP_FILE_HASH OP_FILE_REMOVE OP_FILE_MANIFEST OP_FILE_COMPRESS
OP_FILE_MOVE OP_FILE_COPY OP_FILE_COPY_OUT OP_FILE_COPY_IN OP_FILE_PATH_CREATE);
####################################################################################################################################
@@ -85,6 +85,7 @@ use constant
####################################################################################################################################
use constant
{
+ OP_FILE_WAIT => 'File->wait',
OP_FILE_LIST => 'File->list',
OP_FILE_EXISTS => 'File->exists',
OP_FILE_HASH => 'File->hash',
@@ -951,6 +952,54 @@ sub list
return @stryFileList;
}
+####################################################################################################################################
+# WAIT
+#
+# Wait until the next second. This is done in the file object because it must be performed on whichever side the db is on, local or
+# remote. This function is used to make sure that no files are copied in the same second as the manifest is created. The reason is
+# that the db might modify they file again in the same second as the copy and that change will not be visible to a subsequent
+# incremental backup using timestamp/size to determine deltas.
+####################################################################################################################################
+sub wait
+{
+ my $self = shift;
+ my $strPathType = shift;
+
+ # Set operation and debug strings
+ my $strOperation = OP_FILE_WAIT;
+ my $strDebug = "${strPathType}";
+ &log(DEBUG, "${strOperation}: ${strDebug}");
+
+ # Second when the function was called
+ my $lTimeBegin;
+
+ # Run remotely
+ if ($self->is_remote($strPathType))
+ {
+ # Add remote info to debug string
+ $strDebug = "${strOperation}: remote: ${strDebug}";
+ &log(TRACE, "${strOperation}: remote");
+
+ # Execute the command
+ $lTimeBegin = $self->{oRemote}->command_execute($strOperation, undef, true, $strDebug);
+ }
+ # Run locally
+ else
+ {
+ # Wait the remainder of the current second
+ $lTimeBegin = gettimeofday();
+ my $lSleepMs = ceil(((int($lTimeBegin) + 1) - $lTimeBegin) * 1000);
+
+ usleep($lSleepMs * 1000);
+
+ &log(TRACE, "${strOperation}: slept ${lSleepMs}ms: begin ${lTimeBegin}, end " . gettimeofday());
+
+ $lTimeBegin = int($lTimeBegin);
+ }
+
+ return $lTimeBegin;
+}
+
####################################################################################################################################
# MANIFEST
#
@@ -963,10 +1012,6 @@ sub manifest
my $strPathType = shift;
my $strPath = shift;
my $oManifestHashRef = shift;
- my $bPause = shift; # Wait until next second before returning?
-
- # Set defaults
- $bPause = defined($bPause) ? ($bPause ? true : false) : false;
# Set operation variables
my $strPathOp = $self->path_get($strPathType, $strPath);
@@ -983,7 +1028,6 @@ sub manifest
my %oParamHash;
$oParamHash{path} = $strPathOp;
- $oParamHash{pause} = $bPause ? 'y' : 'n';
# Add remote info to debug string
my $strRemote = 'remote (' . $self->{oRemote}->command_param_string(\%oParamHash) . ')';
@@ -997,33 +1041,6 @@ sub manifest
else
{
$self->manifest_recurse($strPathType, $strPathOp, undef, 0, $oManifestHashRef, $strDebug);
-
- # If pause is requested then sleep into the next clock second. The manifest is being built to determine which files to
- # copy, but sometimes the files can be modified after the manifest is built but before a second has elapsed. In this case
- # there is a small window where an earlier version of the file might be copied and a later version of the file will have
- # the same size/timestamp. By waiting this race condition is eliminated. Waiting a partial second must be done on the db
- # side to be correct (which is why pause is not in the backup code). The wait could also be a full second but that has an
- # impact on how long it takes to run unit tests, and this is simple enough.
- if ($bPause)
- {
- my $lTimeBegin = gettimeofday();
- my $lSleepMs = ceil(((int($lTimeBegin) + 1) - $lTimeBegin) * 1000);
-
- usleep($lSleepMs * 1000);
-
- &log(TRACE, "${strOperation}: slept ${lSleepMs}ms after manifest: begin ${lTimeBegin}, end " . gettimeofday());
-
- # Now we'll test and make sure that there are no files with modification times in the future.
- foreach my $strName (sort(keys ${$oManifestHashRef}{name}))
- {
- if (defined(${$oManifestHashRef}{name}{$strName}{modification_time}) &&
- ${$oManifestHashRef}{name}{$strName}{modification_time} > int($lTimeBegin))
- {
- ${$oManifestHashRef}{name}{$strName}{modification_time} = int($lTimeBegin);
- ${$oManifestHashRef}{name}{$strName}{future} = 'y';
- }
- }
- }
}
}
diff --git a/lib/BackRest/Remote.pm b/lib/BackRest/Remote.pm
index e4ef09c2d..709a6c812 100644
--- a/lib/BackRest/Remote.pm
+++ b/lib/BackRest/Remote.pm
@@ -605,10 +605,13 @@ sub command_param_string
my $strParamList;
- foreach my $strParam (sort(keys $oParamHashRef))
+ if (defined($oParamHashRef))
{
- $strParamList .= (defined($strParamList) ? ',' : '') . "${strParam}=" .
- (defined(${$oParamHashRef}{"${strParam}"}) ? ${$oParamHashRef}{"${strParam}"} : '[undef]');
+ foreach my $strParam (sort(keys $oParamHashRef))
+ {
+ $strParamList .= (defined($strParamList) ? ',' : '') . "${strParam}=" .
+ (defined(${$oParamHashRef}{"${strParam}"}) ? ${$oParamHashRef}{"${strParam}"} : '[undef]');
+ }
}
return $strParamList;
diff --git a/test/lib/BackRestTest/BackupTest.pm b/test/lib/BackRestTest/BackupTest.pm
index 531f9c37a..d0677cf63 100755
--- a/test/lib/BackRestTest/BackupTest.pm
+++ b/test/lib/BackRestTest/BackupTest.pm
@@ -666,7 +666,7 @@ sub BackRestTestBackup_CompareBackup
}
else
{
- if (${$oExpectedManifestRef}{backup}{reference} !~ /$strFileReference/)
+ if (${$oExpectedManifestRef}{backup}{reference} !~ /^$strFileReference|,$strFileReference/)
{
${$oExpectedManifestRef}{backup}{reference} .= ",${strFileReference}";
}
@@ -686,7 +686,7 @@ sub BackRestTestBackup_CompareBackup
${$oExpectedManifestRef}{backup}{'timestamp-start'} = $oActualManifest{backup}{'timestamp-start'};
${$oExpectedManifestRef}{backup}{'timestamp-stop'} = $oActualManifest{backup}{'timestamp-stop'};
- ${$oExpectedManifestRef}{backup}{'timestamp-last-modified'} = $oActualManifest{backup}{'timestamp-last-modified'};
+ ${$oExpectedManifestRef}{backup}{'timestamp-copy-start'} = $oActualManifest{backup}{'timestamp-copy-start'};
my $strTestPath = BackRestTestCommon_TestPathGet();
diff --git a/test/lib/BackRestTest/FileTest.pm b/test/lib/BackRestTest/FileTest.pm
index 1ac1b135f..7a352ec08 100755
--- a/test/lib/BackRestTest/FileTest.pm
+++ b/test/lib/BackRestTest/FileTest.pm
@@ -16,6 +16,8 @@ use Cwd 'abs_path';
use File::stat;
use Fcntl ':mode';
use Scalar::Util 'blessed';
+use Time::HiRes qw(gettimeofday usleep);
+use POSIX qw(ceil);
use lib dirname($0) . '/../lib';
use BackRest::Utility;
@@ -394,6 +396,63 @@ sub BackRestTestFile_Test
}
}
+ #-------------------------------------------------------------------------------------------------------------------------------
+ # Test wait()
+ #-------------------------------------------------------------------------------------------------------------------------------
+ if ($strTest eq 'all' || $strTest eq 'wait')
+ {
+ $iRun = 0;
+
+ &log(INFO, '--------------------------------------------------------------------------------');
+ &log(INFO, "Test File->wait()\n");
+
+ for (my $bRemote = 0; $bRemote <= 1; $bRemote++)
+ {
+ # Create the file object
+ my $oFile = new BackRest::File
+ (
+ $strStanza,
+ $strTestPath,
+ $bRemote ? 'db' : undef,
+ $bRemote ? $oRemote : undef
+ );
+
+ my $lTimeBegin = gettimeofday();
+
+ if (!BackRestTestCommon_Run(++$iRun,
+ "rmt ${bRemote}, begin ${lTimeBegin}")) {next}
+
+ # If there is not enough time to complete the test then sleep
+ if (ceil($lTimeBegin) - $lTimeBegin < .250)
+ {
+ my $lSleepMs = ceil(((int($lTimeBegin) + 1) - $lTimeBegin) * 1000);
+
+ usleep($lSleepMs * 1000);
+
+ &log(DEBUG, "slept ${lSleepMs}ms: begin ${lTimeBegin}, end " . gettimeofday());
+
+ $lTimeBegin = gettimeofday();
+ }
+
+ # Run the test
+ my $lTimeBeginCheck = $oFile->wait(PATH_DB_ABSOLUTE);
+
+ &log(DEBUG, "begin ${lTimeBegin}, check ${lTimeBeginCheck}, end " . time());
+
+ # Current time should have advanced by 1 second
+ if (time() == int($lTimeBegin))
+ {
+ confess "time was not advanced by 1 second";
+ }
+
+ # lTimeBegin and lTimeBeginCheck should be equal
+ if (int($lTimeBegin) != $lTimeBeginCheck)
+ {
+ confess 'time begin ' || int($lTimeBegin) || "and check ${lTimeBeginCheck} should be equal";
+ }
+ }
+ }
+
#-------------------------------------------------------------------------------------------------------------------------------
# Test manifest()
#-------------------------------------------------------------------------------------------------------------------------------
@@ -405,16 +464,16 @@ sub BackRestTestFile_Test
&log(INFO, "Test File->manifest()\n");
my $strManifestCompare =
- ".,d,${strUser},${strGroup},0770,,,,,\n" .
- "sub1,d,${strUser},${strGroup},0750,,,,,\n" .
- "sub1/sub2,d,${strUser},${strGroup},0750,,,,,\n" .
- "sub1/sub2/test,l,${strUser},${strGroup},,,,,../..,\n" .
- "sub1/sub2/test-hardlink.txt,f,${strUser},${strGroup},1640,1111111111,0,9,,\n" .
- "sub1/sub2/test-sub2.txt,f,${strUser},${strGroup},0666,1111111113,0,11,,\n" .
- "sub1/test,l,${strUser},${strGroup},,,,,..,\n" .
- "sub1/test-hardlink.txt,f,${strUser},${strGroup},1640,1111111111,0,9,,\n" .
- "sub1/test-sub1.txt,f,${strUser},${strGroup},0646,1111111112,0,10,,\n" .
- "test.txt,f,${strUser},${strGroup},1640,1111111111,0,9,,";
+ ".,d,${strUser},${strGroup},0770,,,,\n" .
+ "sub1,d,${strUser},${strGroup},0750,,,,\n" .
+ "sub1/sub2,d,${strUser},${strGroup},0750,,,,\n" .
+ "sub1/sub2/test,l,${strUser},${strGroup},,,,,../..\n" .
+ "sub1/sub2/test-hardlink.txt,f,${strUser},${strGroup},1640,1111111111,0,9,\n" .
+ "sub1/sub2/test-sub2.txt,f,${strUser},${strGroup},0666,1111111113,0,11,\n" .
+ "sub1/test,l,${strUser},${strGroup},,,,,..\n" .
+ "sub1/test-hardlink.txt,f,${strUser},${strGroup},1640,1111111111,0,9,\n" .
+ "sub1/test-sub1.txt,f,${strUser},${strGroup},0646,1111111112,0,10,\n" .
+ "test.txt,f,${strUser},${strGroup},1640,1111111111,0,9,";
for (my $bRemote = 0; $bRemote <= 1; $bRemote++)
{
@@ -430,11 +489,9 @@ sub BackRestTestFile_Test
for (my $bError = 0; $bError <= 1; $bError++)
{
for (my $bExists = 0; $bExists <= 1; $bExists++)
- {
- for (my $bPause = false; $bPause <= $bExists && !$bError; $bPause++)
{
if (!BackRestTestCommon_Run(++$iRun,
- "rmt ${bRemote}, exists ${bExists}, pause ${bPause}, err ${bError}")) {next}
+ "rmt ${bRemote}, exists ${bExists}, err ${bError}")) {next}
# Setup test directory
BackRestTestFile_Setup($bError);
@@ -452,7 +509,7 @@ sub BackRestTestFile_Test
system("chmod 0640 ${strTestPath}/sub1/test-sub1.txt");
system("echo 'TESTDATA__' > ${strTestPath}/sub1/sub2/test-sub2.txt");
- utime(1111111113, $bPause ? time() + 10 : 1111111113, "${strTestPath}/sub1/sub2/test-sub2.txt");
+ utime(1111111113, 1111111113, "${strTestPath}/sub1/sub2/test-sub2.txt");
system("chmod 0646 ${strTestPath}/sub1/test-sub1.txt");
system("ln ${strTestPath}/test.txt ${strTestPath}/sub1/test-hardlink.txt");
@@ -483,7 +540,7 @@ sub BackRestTestFile_Test
eval
{
- $oFile->manifest(PATH_BACKUP_ABSOLUTE, $strPath, \%oManifestHash, $bPause);
+ $oFile->manifest(PATH_BACKUP_ABSOLUTE, $strPath, \%oManifestHash);
};
# Check for an error
@@ -522,23 +579,6 @@ sub BackRestTestFile_Test
$oManifestHash{name}{"${strName}"}{inode} = 0;
}
- if ($bPause && $strName eq 'sub1/sub2/test-sub2.txt')
- {
- if (!(defined($oManifestHash{name}{$strName}{future}) &&
- $oManifestHash{name}{$strName}{future} eq 'y'))
- {
- confess "${strName} is not marked as future";
- }
-
- if ($oManifestHash{name}{$strName}{modification_time} != time() - 1)
- {
- confess "${strName} does not have future time reset to past";
- }
-
- delete($oManifestHash{name}{$strName}{future});
- $oManifestHash{name}{$strName}{modification_time} = 1111111113;
- }
-
$strManifest .=
"${strName}," .
$oManifestHash{name}{"${strName}"}{type} . ',' .
@@ -555,9 +595,7 @@ sub BackRestTestFile_Test
(defined($oManifestHash{name}{"${strName}"}{size}) ?
$oManifestHash{name}{"${strName}"}{size} : '') . ',' .
(defined($oManifestHash{name}{"${strName}"}{link_destination}) ?
- $oManifestHash{name}{"${strName}"}{link_destination} : '') . ',' .
- (defined($oManifestHash{name}{"${strName}"}{future}) ?
- $oManifestHash{name}{"${strName}"}{future} : '');
+ $oManifestHash{name}{"${strName}"}{link_destination} : '');
}
if ($strManifest ne $strManifestCompare)
@@ -566,7 +604,6 @@ sub BackRestTestFile_Test
}
}
}
- }
}
}
[parent: 43098086afd9]