You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-06-29 00:21:56 +02:00
Ensure latest db-id is selected on when matching archive.info to backup.info.
This provides correct matching in the event there are system-id and db-version duplicates (e.g. after reverting a pg_upgrade). Fixed by Cynthia Shang. Reported by Adam K. Sumner.
This commit is contained in:
committed by
David Steele
parent
00f58ec8c0
commit
bacc08792d
@ -20,6 +20,15 @@
|
||||
|
||||
<p>Fixed inability to restore a single database contained in a tablespace using --db-include.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<release-item-contributor-list>
|
||||
<release-item-ideator id="sumner.adam.k"/>
|
||||
<release-item-contributor id="shang.cynthia"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>Ensure latest <id>db-id</id> is selected on when matching <file>archive.info</file> to <file>backup.info</file>. This provides correct matching in the event there are <id>system-id</id> and <id>db-version</id> duplicates (e.g. after reverting a <id>pg_upgrade</id>).</p>
|
||||
</release-item>
|
||||
</release-bug-list>
|
||||
|
||||
<release-feature-list>
|
||||
@ -4037,6 +4046,11 @@
|
||||
<contributor-id type="github">Underhunden</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="sumner.adam.k">
|
||||
<contributor-name-display>Adam K. Sumner</contributor-name-display>
|
||||
<contributor-id type="github">Flamacue</contributor-id>
|
||||
</contributor>
|
||||
|
||||
<contributor id="uspen">
|
||||
<contributor-name-display>Uspen</contributor-name-display>
|
||||
<contributor-id type="github">uspen</contributor-id>
|
||||
|
@ -667,7 +667,8 @@ sub backupArchiveDbHistoryId
|
||||
my $ullDbSysIdArchive = $$hDbListArchive{$iDbIdArchive}{&INFO_SYSTEM_ID};
|
||||
|
||||
# Get the db-id from backup info history that corresponds to the archive db-version and db-system-id
|
||||
foreach my $iDbIdBackup (keys %{$hDbListBackup})
|
||||
# Sort from newest (highest db-id) to oldest
|
||||
foreach my $iDbIdBackup (sort {$b <=> $a} keys %{$hDbListBackup})
|
||||
{
|
||||
if ($$hDbListBackup{$iDbIdBackup}{&INFO_SYSTEM_ID} == $ullDbSysIdArchive &&
|
||||
$$hDbListBackup{$iDbIdBackup}{&INFO_DB_VERSION} eq $strDbVersionArchive)
|
||||
|
@ -186,6 +186,18 @@ sub run
|
||||
$strArchiveId = &PG_VERSION_93 . "-" . $iHistoryId;
|
||||
$self->testResult(sub {$oBackupInfo->backupArchiveDbHistoryId($strArchiveId,
|
||||
storageRepo()->pathGet(STORAGE_REPO_ARCHIVE))}, "[undef]", 'same db system-id but different version');
|
||||
|
||||
# First and last version and ullsystemid same in backup.info but only 1st in archive info - return last
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$iHistoryId = $oBackupInfo->dbHistoryIdGet(true)+1;
|
||||
$oBackupInfo->dbSectionSet(
|
||||
PG_VERSION_93, $i93ControlVersion, $i93CatalogVersion, $self->dbSysId(PG_VERSION_93), $iHistoryId);
|
||||
|
||||
$oBackupInfo->save();
|
||||
|
||||
$strArchiveId = &PG_VERSION_93 . "-1";
|
||||
$self->testResult(sub {$oBackupInfo->backupArchiveDbHistoryId($strArchiveId,
|
||||
storageRepo()->pathGet(STORAGE_REPO_ARCHIVE))}, $iHistoryId, 'duplicate 1st and last version/sysid - last chosen');
|
||||
}
|
||||
|
||||
################################################################################################################################
|
||||
|
Reference in New Issue
Block a user