1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-03 00:26:59 +02:00

Fix backup labels in mock/all resume integration tests.

These were not getting updated to match the directory name when the manifests were copied.

The Perl code didn't care but the C code expects labels to be set correctly.
This commit is contained in:
David Steele
2019-12-06 11:48:41 -05:00
parent 5395aa0c92
commit e632c60525

View File

@ -440,8 +440,9 @@ sub run
# Resume by copying the valid full backup over the last aborted full backup if it exists, or by creating a new path # Resume by copying the valid full backup over the last aborted full backup if it exists, or by creating a new path
my $strResumeBackup = (storageRepo()->list( my $strResumeBackup = (storageRepo()->list(
STORAGE_REPO_BACKUP, {strExpression => backupRegExpGet(true, true, true), strSortOrder => 'reverse'}))[0]; STORAGE_REPO_BACKUP, {strExpression => backupRegExpGet(true, true, true), strSortOrder => 'reverse'}))[0];
my $strResumePath = storageRepo()->pathGet('backup/' . $self->stanza() . '/' . my $strResumeLabel = $strResumeBackup ne $strFullBackup ?
($strResumeBackup ne $strFullBackup ? $strResumeBackup : backupLabel(storageRepo(), $strType, undef, time()))); $strResumeBackup : backupLabel(storageRepo(), $strType, undef, time());
my $strResumePath = storageRepo()->pathGet('backup/' . $self->stanza() . '/' . $strResumeLabel);
forceStorageRemove(storageRepo(), $strResumePath, {bRecurse => true}); forceStorageRemove(storageRepo(), $strResumePath, {bRecurse => true});
forceStorageMove(storageRepo(), 'backup/' . $self->stanza() . "/${strFullBackup}", $strResumePath); forceStorageMove(storageRepo(), 'backup/' . $self->stanza() . "/${strFullBackup}", $strResumePath);
@ -458,8 +459,9 @@ sub run
$oHostBackup->manifestMunge( $oHostBackup->manifestMunge(
basename($strResumePath), basename($strResumePath),
{&MANIFEST_SECTION_TARGET_FILE => {&MANIFEST_SECTION_BACKUP => {&MANIFEST_KEY_LABEL => $strResumeLabel},
{(&MANIFEST_TARGET_PGDATA . '/' . &DB_FILE_PGVERSION) => {&MANIFEST_SUBKEY_CHECKSUM => undef}}}, &MANIFEST_SECTION_TARGET_FILE =>
{(&MANIFEST_TARGET_PGDATA . '/' . &DB_FILE_PGVERSION) => {&MANIFEST_SUBKEY_CHECKSUM => undef}}},
false); false);
# Remove the main manifest so the backup appears aborted # Remove the main manifest so the backup appears aborted
@ -869,9 +871,8 @@ sub run
$strType = CFGOPTVAL_BACKUP_TYPE_INCR; $strType = CFGOPTVAL_BACKUP_TYPE_INCR;
# Create resumable backup from last backup # Create resumable backup from last backup
$strResumePath = $strResumeLabel = backupLabel(storageRepo(), $strType, substr($strBackup, 0, 16), time());
storageRepo()->pathGet('backup/' . $self->stanza() . '/' . $strResumePath = storageRepo()->pathGet('backup/' . $self->stanza() . '/' . $strResumeLabel);
backupLabel(storageRepo(), $strType, substr($strBackup, 0, 16), time()));
forceStorageRemove(storageRepo(), $strResumePath); forceStorageRemove(storageRepo(), $strResumePath);
forceStorageMove(storageRepo(), 'backup/' . $self->stanza() . "/${strBackup}", $strResumePath); forceStorageMove(storageRepo(), 'backup/' . $self->stanza() . "/${strBackup}", $strResumePath);
@ -891,6 +892,10 @@ sub run
storageRepo()->put("${strResumePath}/pg_data/badchecksum.txt", 'BDDCHECKSUM'); storageRepo()->put("${strResumePath}/pg_data/badchecksum.txt", 'BDDCHECKSUM');
} }
# Write correct label into resumable manifest
$oHostBackup->manifestMunge(
basename($strResumePath), {&MANIFEST_SECTION_BACKUP => {&MANIFEST_KEY_LABEL => $strResumeLabel}},false);
# Change contents/size of a db file to make sure it recopies (and does not resume) # Change contents/size of a db file to make sure it recopies (and does not resume)
$oHostDbMaster->manifestFileCreate( $oHostDbMaster->manifestFileCreate(
\%oManifest, MANIFEST_TARGET_PGDATA, 'changesize.txt', 'SIZE+MORE', '3905d5be2ec8d67f41435dab5e0dcda3ae47455d', $lTime, \%oManifest, MANIFEST_TARGET_PGDATA, 'changesize.txt', 'SIZE+MORE', '3905d5be2ec8d67f41435dab5e0dcda3ae47455d', $lTime,