mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-14 10:13:05 +02:00
Changed file sizes are now detected and stored in the manifest.
Remove thread file minimums - they are unrealistic for a real db and hinder unit tests.
This commit is contained in:
parent
23102f19e5
commit
0df1b7c473
@ -33,7 +33,7 @@ my $bCompress;
|
||||
my $bHardLink;
|
||||
my $iThreadMax;
|
||||
my $iThreadLocalMax;
|
||||
my $iThreadThreshold = 10;
|
||||
#my $iThreadThreshold = 10;
|
||||
my $iSmallFileThreshold = 65536;
|
||||
my $bArchiveRequired;
|
||||
my $bNoStartStop;
|
||||
@ -546,7 +546,7 @@ sub archive_compress
|
||||
&log(INFO, "archive to be compressed total ${lFileTotal}, size " . file_size_format($lFileSize));
|
||||
|
||||
# Init the thread variables
|
||||
$iThreadLocalMax = thread_init(int($lFileTotal / $iThreadThreshold) + 1);
|
||||
$iThreadLocalMax = thread_init($iThreadMax);
|
||||
my $iThreadIdx = 0;
|
||||
|
||||
# Distribute files among the threads
|
||||
@ -977,7 +977,7 @@ sub backup_file
|
||||
}
|
||||
|
||||
# Build the thread queues
|
||||
$iThreadLocalMax = thread_init(int($lFileTotal / $iThreadThreshold) + 1);
|
||||
$iThreadLocalMax = thread_init($iThreadMax);
|
||||
&log(DEBUG, "actual threads ${iThreadLocalMax}/${iThreadMax}");
|
||||
|
||||
# Initialize the thread size array
|
||||
@ -1093,7 +1093,8 @@ sub backup_file
|
||||
# If command is 'checksum' then record the checksum in the manifest
|
||||
elsif ($strCommand eq 'checksum')
|
||||
{
|
||||
my $strChecksum = $strSplit[3]; # File checksum calculated by the thread
|
||||
my $strChecksum = $strSplit[3]; # File checksum calculated by the thread
|
||||
my $lFileSize = $strSplit[4]; # File size calculated by the thread
|
||||
|
||||
# Checksum must be defined
|
||||
if (!defined($strChecksum))
|
||||
@ -1101,10 +1102,17 @@ sub backup_file
|
||||
confess &log(ASSERT, 'thread checksum messages must have strChecksum defined');
|
||||
}
|
||||
|
||||
# Checksum must be defined
|
||||
if (!defined($lFileSize))
|
||||
{
|
||||
confess &log(ASSERT, 'thread checksum messages must have lFileSize defined');
|
||||
}
|
||||
|
||||
$oBackupManifest->set($strFileSection, $strFile, MANIFEST_SUBKEY_CHECKSUM, $strChecksum);
|
||||
$oBackupManifest->set($strFileSection, $strFile, MANIFEST_SUBKEY_SIZE, $lFileSize + 0);
|
||||
|
||||
# Log the checksum
|
||||
&log (DEBUG, "write checksum ${strFileSection}:${strFile} into manifest: ${strChecksum}");
|
||||
&log (DEBUG, "write checksum ${strFileSection}:${strFile} into manifest: ${strChecksum} (${lFileSize})");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1202,13 +1210,15 @@ sub backup_file_thread
|
||||
{
|
||||
# Write the checksum message into the master queue
|
||||
$oMasterQueue[$iThreadIdx]->enqueue("checksum|$oFileCopyMap{$strFile}{file_section}|" .
|
||||
"$oFileCopyMap{$strFile}{file}|${strCopyChecksum}");
|
||||
"$oFileCopyMap{$strFile}{file}|${strCopyChecksum}|${lCopySize}");
|
||||
}
|
||||
else
|
||||
{
|
||||
# Write it directly
|
||||
$oBackupManifest->set($oFileCopyMap{$strFile}{file_section}, $oFileCopyMap{$strFile}{file},
|
||||
MANIFEST_SUBKEY_CHECKSUM, $strCopyChecksum);
|
||||
$oBackupManifest->set($oFileCopyMap{$strFile}{file_section}, $oFileCopyMap{$strFile}{file},
|
||||
MANIFEST_SUBKEY_SIZE, $lCopySize + 0);
|
||||
}
|
||||
|
||||
# Output information about the file to be checksummed
|
||||
|
@ -1723,6 +1723,9 @@ sub BackRestTestBackup_Test
|
||||
BackRestTestBackup_BackupBegin($strType, $strStanza, $bRemote, "remove files during backup", true, true, 1);
|
||||
BackRestTestCommon_ExecuteEnd(TEST_MANIFEST_BUILD);
|
||||
|
||||
BackRestTestBackup_ManifestFileCreate(\%oManifest, "tablespace:2", 'tablespace2c.txt', 'TBLSPCBIGGER',
|
||||
'dfcb8679956b734706cf87259d50c88f83e80e66', $lTime);
|
||||
|
||||
BackRestTestBackup_ManifestFileRemove(\%oManifest, 'base', 'base/base2.txt', true);
|
||||
|
||||
$strBackup = BackRestTestBackup_BackupEnd($strType, $oFile, $bRemote, undef, \%oManifest, true);
|
||||
|
Loading…
Reference in New Issue
Block a user