1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-03-03 14:52:21 +02:00

Add Manifest->addFile().

Some files need to be added to the manifest after the initial build.  This is currently done in only one place but usage will expand in the future so the functionality has been encapsulated in addFile().
This commit is contained in:
David Steele 2016-05-14 10:39:56 -04:00
parent 77b01e980f
commit 9b5a27f657
2 changed files with 42 additions and 10 deletions

View File

@ -862,16 +862,8 @@ sub process
"file does not match actual checksum of '${strCopyChecksum}'", ERROR_CHECKSUM);
}
# Set manifest values
$oBackupManifest->set(MANIFEST_SECTION_TARGET_FILE, $strFileLog, MANIFEST_SUBKEY_USER,
$oBackupManifest->get(MANIFEST_SECTION_TARGET_PATH, $strPathLog, MANIFEST_SUBKEY_USER));
$oBackupManifest->set(MANIFEST_SECTION_TARGET_FILE, $strFileLog, MANIFEST_SUBKEY_GROUP,
$oBackupManifest->get(MANIFEST_SECTION_TARGET_PATH, $strPathLog, MANIFEST_SUBKEY_GROUP));
$oBackupManifest->set(MANIFEST_SECTION_TARGET_FILE, $strFileLog, MANIFEST_SUBKEY_MODE, '0700');
$oBackupManifest->set(MANIFEST_SECTION_TARGET_FILE, $strFileLog, MANIFEST_SUBKEY_TIMESTAMP, $lModificationTime);
$oBackupManifest->set(MANIFEST_SECTION_TARGET_FILE, $strFileLog, MANIFEST_SUBKEY_SIZE, $lCopySize);
$oBackupManifest->set(MANIFEST_SECTION_TARGET_FILE, $strFileLog, MANIFEST_SUBKEY_CHECKSUM, $strCopyChecksum);
$oBackupManifest->buildDefault();
# Add file to manifest
$oBackupManifest->fileAdd($strFileLog, $lModificationTime, $lCopySize, $strCopyChecksum);
}
}
}

View File

@ -838,6 +838,46 @@ sub linkCheck
}
}
####################################################################################################################################
# fileAdd
#
# Add files to the manifest that were generated after the initial manifest build, e.g. backup_label, tablespace_map, and copied WAL
# files. Since the files were not in the original cluster the user, group, and mode must be defaulted.
####################################################################################################################################
sub fileAdd
{
my $self = shift;
# Assign function parameters, defaults, and log debug info
my
(
$strOperation,
$strManifestFile,
$lModificationTime,
$lSize,
$strChecksum
) =
logDebugParam
(
__PACKAGE__ . '->fileAdd', \@_,
{name => 'strManifestFile'},
{name => 'lModificationTime'},
{name => 'lSize'},
{name => 'lChecksum'}
);
# Set manifest values
$self->set(MANIFEST_SECTION_TARGET_FILE, $strManifestFile, MANIFEST_SUBKEY_USER,
$self->get(MANIFEST_SECTION_TARGET_PATH, MANIFEST_TARGET_PGDATA, MANIFEST_SUBKEY_USER));
$self->set(MANIFEST_SECTION_TARGET_FILE, $strManifestFile, MANIFEST_SUBKEY_GROUP,
$self->get(MANIFEST_SECTION_TARGET_PATH, MANIFEST_TARGET_PGDATA, MANIFEST_SUBKEY_GROUP));
$self->set(MANIFEST_SECTION_TARGET_FILE, $strManifestFile, MANIFEST_SUBKEY_MODE, '0600');
$self->set(MANIFEST_SECTION_TARGET_FILE, $strManifestFile, MANIFEST_SUBKEY_TIMESTAMP, $lModificationTime);
$self->set(MANIFEST_SECTION_TARGET_FILE, $strManifestFile, MANIFEST_SUBKEY_SIZE, $lSize);
$self->set(MANIFEST_SECTION_TARGET_FILE, $strManifestFile, MANIFEST_SUBKEY_CHECKSUM, $strChecksum);
$self->buildDefault();
}
####################################################################################################################################
# buildDefault
#