mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
Remove obsolete Perl archive code.
This should have been removed in a1c13a50
but was missed.
This commit is contained in:
parent
82df7e6f3b
commit
158e439689
@ -1,128 +0,0 @@
|
||||
####################################################################################################################################
|
||||
# ARCHIVE GET FILE MODULE
|
||||
####################################################################################################################################
|
||||
package pgBackRest::Archive::Get::File;
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => qw(all);
|
||||
use Carp qw(confess);
|
||||
use English '-no_match_vars';
|
||||
|
||||
use Exporter qw(import);
|
||||
our @EXPORT = qw();
|
||||
use File::Basename qw(basename dirname);
|
||||
|
||||
use pgBackRest::Archive::Common;
|
||||
use pgBackRest::Archive::Info;
|
||||
use pgBackRest::Db;
|
||||
use pgBackRest::Common::Exception;
|
||||
use pgBackRest::Common::Lock;
|
||||
use pgBackRest::Common::Log;
|
||||
use pgBackRest::Config::Config;
|
||||
use pgBackRest::Protocol::Helper;
|
||||
use pgBackRest::Protocol::Storage::Helper;
|
||||
use pgBackRest::Storage::Helper;
|
||||
|
||||
####################################################################################################################################
|
||||
# Given a specific database version and system-id, find a file in the archive. If no database info was passed, the current database
|
||||
# will be used.
|
||||
####################################################################################################################################
|
||||
sub archiveGetCheck
|
||||
{
|
||||
# Assign function parameters, defaults, and log debug info
|
||||
my
|
||||
(
|
||||
$strOperation,
|
||||
$strDbVersion,
|
||||
$ullDbSysId,
|
||||
$strFile,
|
||||
$bCheck,
|
||||
) =
|
||||
logDebugParam
|
||||
(
|
||||
__PACKAGE__ . '::archiveGetCheck', \@_,
|
||||
{name => 'strDbVersion', required => false},
|
||||
{name => 'ullDbSysId', required => false},
|
||||
{name => 'strFile', required => false},
|
||||
{name => 'bCheck', required => false, default => true},
|
||||
);
|
||||
|
||||
my @stryArchiveId = ();
|
||||
my $strArchiveId;
|
||||
my $strArchiveFile;
|
||||
my $strCipherPass;
|
||||
|
||||
# If the dbVersion/dbSysId are not passed, then we need to retrieve the database information
|
||||
if (!defined($strDbVersion) || !defined($ullDbSysId) )
|
||||
{
|
||||
# get DB info for comparison
|
||||
($strDbVersion, my $iControlVersion, my $iCatalogVersion, $ullDbSysId) = dbMasterGet()->info();
|
||||
}
|
||||
|
||||
# Get db info from the repo
|
||||
if (!isRepoLocal())
|
||||
{
|
||||
($strArchiveId, $strArchiveFile, $strCipherPass) = protocolGet(CFGOPTVAL_REMOTE_TYPE_BACKUP)->cmdExecute(
|
||||
OP_ARCHIVE_GET_CHECK, [$strDbVersion, $ullDbSysId, $strFile, $bCheck], true);
|
||||
}
|
||||
else
|
||||
{
|
||||
my $oArchiveInfo = new pgBackRest::Archive::Info(storageRepo()->pathGet(STORAGE_REPO_ARCHIVE), true);
|
||||
|
||||
# Check that the archive info is compatible with the database if required (not required for archive-get)
|
||||
if ($bCheck)
|
||||
{
|
||||
push(@stryArchiveId, $oArchiveInfo->check($strDbVersion, $ullDbSysId));
|
||||
}
|
||||
# Else if the database version and system-id are in the info history list then get a list of corresponding archiveIds
|
||||
else
|
||||
{
|
||||
@stryArchiveId = $oArchiveInfo->archiveIdList($strDbVersion, $ullDbSysId);
|
||||
}
|
||||
|
||||
# Default the returned archiveId to the newest in the event the WAL segment is not found then the most recent archiveID will
|
||||
# be returned. If none were found, then the preceding calls will error.
|
||||
$strArchiveId = $stryArchiveId[0];
|
||||
|
||||
# If a file was passed to look for, then look for the file starting in the newest matching archiveId to the oldest
|
||||
if (defined($strFile))
|
||||
{
|
||||
foreach my $strId (@stryArchiveId)
|
||||
{
|
||||
# Then if it is a WAL segment, try to find it
|
||||
if (walIsSegment($strFile))
|
||||
{
|
||||
$strArchiveFile = walSegmentFind(storageRepo(), $strId, $strFile);
|
||||
}
|
||||
# Else if not a WAL segment, see if it exists in the archive dir
|
||||
elsif (storageRepo()->exists(STORAGE_REPO_ARCHIVE . "/${strId}/${strFile}"))
|
||||
{
|
||||
$strArchiveFile = $strFile;
|
||||
}
|
||||
|
||||
# If the file was found, then return the archiveId where it was found
|
||||
if (defined($strArchiveFile))
|
||||
{
|
||||
$strArchiveId = $strId;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Get the encryption passphrase to read/write files (undefined if the repo is not encrypted)
|
||||
$strCipherPass = $oArchiveInfo->cipherPassSub();
|
||||
}
|
||||
|
||||
# Return from function and log return values if any
|
||||
return logDebugReturn
|
||||
(
|
||||
$strOperation,
|
||||
{name => 'strArchiveId', value => $strArchiveId},
|
||||
{name => 'strArchiveFile', value => $strArchiveFile},
|
||||
{name => 'strCipherPass', value => $strCipherPass, redact => true}
|
||||
);
|
||||
}
|
||||
|
||||
push @EXPORT, qw(archiveGetCheck);
|
||||
|
||||
1;
|
@ -14,7 +14,6 @@ use pgBackRest::Backup::File;
|
||||
use pgBackRest::Common::Log;
|
||||
use pgBackRest::Common::Io::Buffered;
|
||||
use pgBackRest::Common::Wait;
|
||||
use pgBackRest::Archive::Get::File;
|
||||
use pgBackRest::Config::Config;
|
||||
use pgBackRest::Db;
|
||||
use pgBackRest::Protocol::Command::Minion;
|
||||
@ -72,9 +71,6 @@ sub init
|
||||
# Create anonymous subs for each command
|
||||
my $hCommandMap =
|
||||
{
|
||||
# ArchiveGet commands
|
||||
&OP_ARCHIVE_GET_CHECK => sub {archiveGetCheck(@{shift()})},
|
||||
|
||||
# Db commands
|
||||
&OP_DB_CONNECT => sub {$oDb->connect()},
|
||||
&OP_DB_EXECUTE_SQL => sub {$oDb->executeSql(@{shift()})},
|
||||
|
@ -245,123 +245,6 @@ static const EmbeddedModule embeddedModule[] =
|
||||
"\n"
|
||||
"1;\n"
|
||||
},
|
||||
{
|
||||
.name = "pgBackRest/Archive/Get/File.pm",
|
||||
.data =
|
||||
"\n\n\n"
|
||||
"package pgBackRest::Archive::Get::File;\n"
|
||||
"\n"
|
||||
"use strict;\n"
|
||||
"use warnings FATAL => qw(all);\n"
|
||||
"use Carp qw(confess);\n"
|
||||
"use English '-no_match_vars';\n"
|
||||
"\n"
|
||||
"use Exporter qw(import);\n"
|
||||
"our @EXPORT = qw();\n"
|
||||
"use File::Basename qw(basename dirname);\n"
|
||||
"\n"
|
||||
"use pgBackRest::Archive::Common;\n"
|
||||
"use pgBackRest::Archive::Info;\n"
|
||||
"use pgBackRest::Db;\n"
|
||||
"use pgBackRest::Common::Exception;\n"
|
||||
"use pgBackRest::Common::Lock;\n"
|
||||
"use pgBackRest::Common::Log;\n"
|
||||
"use pgBackRest::Config::Config;\n"
|
||||
"use pgBackRest::Protocol::Helper;\n"
|
||||
"use pgBackRest::Protocol::Storage::Helper;\n"
|
||||
"use pgBackRest::Storage::Helper;\n"
|
||||
"\n\n\n\n\n"
|
||||
"sub archiveGetCheck\n"
|
||||
"{\n"
|
||||
"\n"
|
||||
"my\n"
|
||||
"(\n"
|
||||
"$strOperation,\n"
|
||||
"$strDbVersion,\n"
|
||||
"$ullDbSysId,\n"
|
||||
"$strFile,\n"
|
||||
"$bCheck,\n"
|
||||
") =\n"
|
||||
"logDebugParam\n"
|
||||
"(\n"
|
||||
"__PACKAGE__ . '::archiveGetCheck', \\@_,\n"
|
||||
"{name => 'strDbVersion', required => false},\n"
|
||||
"{name => 'ullDbSysId', required => false},\n"
|
||||
"{name => 'strFile', required => false},\n"
|
||||
"{name => 'bCheck', required => false, default => true},\n"
|
||||
");\n"
|
||||
"\n"
|
||||
"my @stryArchiveId = ();\n"
|
||||
"my $strArchiveId;\n"
|
||||
"my $strArchiveFile;\n"
|
||||
"my $strCipherPass;\n"
|
||||
"\n\n"
|
||||
"if (!defined($strDbVersion) || !defined($ullDbSysId) )\n"
|
||||
"{\n"
|
||||
"\n"
|
||||
"($strDbVersion, my $iControlVersion, my $iCatalogVersion, $ullDbSysId) = dbMasterGet()->info();\n"
|
||||
"}\n"
|
||||
"\n\n"
|
||||
"if (!isRepoLocal())\n"
|
||||
"{\n"
|
||||
"($strArchiveId, $strArchiveFile, $strCipherPass) = protocolGet(CFGOPTVAL_REMOTE_TYPE_BACKUP)->cmdExecute(\n"
|
||||
"OP_ARCHIVE_GET_CHECK, [$strDbVersion, $ullDbSysId, $strFile, $bCheck], true);\n"
|
||||
"}\n"
|
||||
"else\n"
|
||||
"{\n"
|
||||
"my $oArchiveInfo = new pgBackRest::Archive::Info(storageRepo()->pathGet(STORAGE_REPO_ARCHIVE), true);\n"
|
||||
"\n\n"
|
||||
"if ($bCheck)\n"
|
||||
"{\n"
|
||||
"push(@stryArchiveId, $oArchiveInfo->check($strDbVersion, $ullDbSysId));\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"else\n"
|
||||
"{\n"
|
||||
"@stryArchiveId = $oArchiveInfo->archiveIdList($strDbVersion, $ullDbSysId);\n"
|
||||
"}\n"
|
||||
"\n\n\n"
|
||||
"$strArchiveId = $stryArchiveId[0];\n"
|
||||
"\n\n"
|
||||
"if (defined($strFile))\n"
|
||||
"{\n"
|
||||
"foreach my $strId (@stryArchiveId)\n"
|
||||
"{\n"
|
||||
"\n"
|
||||
"if (walIsSegment($strFile))\n"
|
||||
"{\n"
|
||||
"$strArchiveFile = walSegmentFind(storageRepo(), $strId, $strFile);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"elsif (storageRepo()->exists(STORAGE_REPO_ARCHIVE . \"/${strId}/${strFile}\"))\n"
|
||||
"{\n"
|
||||
"$strArchiveFile = $strFile;\n"
|
||||
"}\n"
|
||||
"\n\n"
|
||||
"if (defined($strArchiveFile))\n"
|
||||
"{\n"
|
||||
"$strArchiveId = $strId;\n"
|
||||
"last;\n"
|
||||
"}\n"
|
||||
"}\n"
|
||||
"}\n"
|
||||
"\n\n"
|
||||
"$strCipherPass = $oArchiveInfo->cipherPassSub();\n"
|
||||
"}\n"
|
||||
"\n\n"
|
||||
"return logDebugReturn\n"
|
||||
"(\n"
|
||||
"$strOperation,\n"
|
||||
"{name => 'strArchiveId', value => $strArchiveId},\n"
|
||||
"{name => 'strArchiveFile', value => $strArchiveFile},\n"
|
||||
"{name => 'strCipherPass', value => $strCipherPass, redact => true}\n"
|
||||
");\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"push @EXPORT, qw(archiveGetCheck);\n"
|
||||
"\n"
|
||||
"1;\n"
|
||||
},
|
||||
{
|
||||
.name = "pgBackRest/Archive/Info.pm",
|
||||
.data =
|
||||
@ -11224,7 +11107,6 @@ static const EmbeddedModule embeddedModule[] =
|
||||
"use pgBackRest::Common::Log;\n"
|
||||
"use pgBackRest::Common::Io::Buffered;\n"
|
||||
"use pgBackRest::Common::Wait;\n"
|
||||
"use pgBackRest::Archive::Get::File;\n"
|
||||
"use pgBackRest::Config::Config;\n"
|
||||
"use pgBackRest::Db;\n"
|
||||
"use pgBackRest::Protocol::Command::Minion;\n"
|
||||
@ -11271,8 +11153,6 @@ static const EmbeddedModule embeddedModule[] =
|
||||
"my $hCommandMap =\n"
|
||||
"{\n"
|
||||
"\n"
|
||||
"&OP_ARCHIVE_GET_CHECK => sub {archiveGetCheck(@{shift()})},\n"
|
||||
"\n\n"
|
||||
"&OP_DB_CONNECT => sub {$oDb->connect()},\n"
|
||||
"&OP_DB_EXECUTE_SQL => sub {$oDb->executeSql(@{shift()})},\n"
|
||||
"&OP_DB_INFO => sub {$oDb->info(@{shift()})},\n"
|
||||
|
@ -606,10 +606,6 @@ unit:
|
||||
command/archive/get/get: full
|
||||
command/archive/get/protocol: full
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------------
|
||||
- name: archive-get-perl
|
||||
total: 1
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------------------------------
|
||||
- name: archive-push
|
||||
total: 4
|
||||
|
@ -1,194 +0,0 @@
|
||||
####################################################################################################################################
|
||||
# Archive Get and Base Tests
|
||||
####################################################################################################################################
|
||||
package pgBackRestTest::Module::Command::CommandArchiveGetPerlTest;
|
||||
use parent 'pgBackRestTest::Env::HostEnvTest';
|
||||
|
||||
####################################################################################################################################
|
||||
# Perl includes
|
||||
####################################################################################################################################
|
||||
use strict;
|
||||
use warnings FATAL => qw(all);
|
||||
use Carp qw(confess);
|
||||
|
||||
use Storable qw(dclone);
|
||||
|
||||
use pgBackRest::Archive::Common;
|
||||
use pgBackRest::Archive::Get::File;
|
||||
use pgBackRest::Archive::Info;
|
||||
use pgBackRest::Common::Exception;
|
||||
use pgBackRest::Common::Log;
|
||||
use pgBackRest::Config::Config;
|
||||
use pgBackRest::DbVersion;
|
||||
use pgBackRest::Manifest;
|
||||
use pgBackRest::LibC qw(:crypto);
|
||||
use pgBackRest::Protocol::Storage::Helper;
|
||||
use pgBackRest::Storage::Helper;
|
||||
|
||||
use pgBackRestTest::Env::HostEnvTest;
|
||||
use pgBackRestTest::Common::ExecuteTest;
|
||||
use pgBackRestTest::Common::RunTest;
|
||||
|
||||
####################################################################################################################################
|
||||
# initModule
|
||||
####################################################################################################################################
|
||||
sub initModule
|
||||
{
|
||||
my $self = shift;
|
||||
|
||||
$self->{strDbPath} = $self->testPath() . '/db';
|
||||
$self->{strLockPath} = $self->testPath() . '/lock';
|
||||
$self->{strRepoPath} = $self->testPath() . '/repo';
|
||||
$self->{strArchivePath} = "$self->{strRepoPath}/archive/" . $self->stanza();
|
||||
$self->{strBackupPath} = "$self->{strRepoPath}/backup/" . $self->stanza();
|
||||
$self->{strSpoolPath} = "$self->{strArchivePath}/in";
|
||||
}
|
||||
|
||||
####################################################################################################################################
|
||||
# initTest
|
||||
####################################################################################################################################
|
||||
sub initTest
|
||||
{
|
||||
my $self = shift;
|
||||
|
||||
# Clear cache from the previous test
|
||||
storageRepoCacheClear();
|
||||
|
||||
# Load options
|
||||
$self->configTestClear();
|
||||
$self->optionTestSet(CFGOPT_STANZA, $self->stanza());
|
||||
$self->optionTestSet(CFGOPT_REPO_PATH, $self->testPath() . '/repo');
|
||||
$self->optionTestSet(CFGOPT_PG_PATH, $self->{strDbPath});
|
||||
$self->optionTestSet(CFGOPT_LOG_PATH, $self->testPath());
|
||||
$self->optionTestSet(CFGOPT_LOCK_PATH, $self->{strLockPath});
|
||||
$self->configTestLoad(CFGCMD_ARCHIVE_GET);
|
||||
|
||||
# Create archive info path
|
||||
storageTest()->pathCreate($self->{strArchivePath}, {bIgnoreExists => true, bCreateParent => true});
|
||||
|
||||
# Create backup info path
|
||||
storageTest()->pathCreate($self->{strBackupPath}, {bIgnoreExists => true, bCreateParent => true});
|
||||
|
||||
# Create spool path
|
||||
storageTest()->pathCreate($self->{strSpoolPath}, {bIgnoreExists => true, bCreateParent => true});
|
||||
|
||||
# Create pg_control path
|
||||
storageTest()->pathCreate($self->{strDbPath} . '/' . DB_PATH_GLOBAL, {bCreateParent => true});
|
||||
|
||||
# Generate pg_control file
|
||||
$self->controlGenerate($self->{strDbPath}, PG_VERSION_94);
|
||||
}
|
||||
|
||||
####################################################################################################################################
|
||||
# run
|
||||
####################################################################################################################################
|
||||
sub run
|
||||
{
|
||||
my $self = shift;
|
||||
|
||||
# Define test file
|
||||
my $strFileContent = 'TESTDATA';
|
||||
my $strFileHash = cryptoHashOne('sha1', $strFileContent);
|
||||
my $iFileSize = length($strFileContent);
|
||||
|
||||
my $strDestinationPath = $self->{strDbPath} . "/pg_xlog";
|
||||
my $strDestinationFile = $strDestinationPath . "/RECOVERYXLOG";
|
||||
my $strWalSegment = '000000010000000100000001';
|
||||
my $strArchivePath;
|
||||
|
||||
################################################################################################################################
|
||||
if ($self->begin("Archive::Common::archiveGetCheck()"))
|
||||
{
|
||||
# Create and save archive.info file
|
||||
my $oArchiveInfo = new pgBackRest::Archive::Info(storageRepo()->pathGet(STORAGE_REPO_ARCHIVE), false,
|
||||
{bLoad => false, bIgnoreMissing => true});
|
||||
$oArchiveInfo->create(PG_VERSION_92, $self->dbSysId(PG_VERSION_92), false);
|
||||
$oArchiveInfo->dbSectionSet(PG_VERSION_93, $self->dbSysId(PG_VERSION_93), $oArchiveInfo->dbHistoryIdGet(false) + 1);
|
||||
$oArchiveInfo->dbSectionSet(PG_VERSION_92, $self->dbSysId(PG_VERSION_92), $oArchiveInfo->dbHistoryIdGet(false) + 1);
|
||||
$oArchiveInfo->dbSectionSet(PG_VERSION_94, $self->dbSysId(PG_VERSION_94), $oArchiveInfo->dbHistoryIdGet(false) + 10);
|
||||
$oArchiveInfo->save();
|
||||
|
||||
# db-version, db-sys-id passed but combination doesn't exist in archive.info history
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$self->testException(sub {archiveGetCheck(
|
||||
PG_VERSION_95, $self->dbSysId(PG_VERSION_94), undef, false)}, ERROR_ARCHIVE_MISMATCH,
|
||||
"unable to retrieve the archive id for database version '" . PG_VERSION_95 . "' and system-id '" .
|
||||
$self->dbSysId(PG_VERSION_94) . "'");
|
||||
|
||||
# db-version, db-sys-id and wal passed all undefined
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
my ($strArchiveId, $strArchiveFile, $strCipherPass) = archiveGetCheck(undef, undef, undef, false);
|
||||
$self->testResult(sub {($strArchiveId eq PG_VERSION_94 . '-13') && !defined($strArchiveFile) && !defined($strCipherPass)},
|
||||
true, 'undef db-version, db-sys-id and wal returns only current db archive-id');
|
||||
|
||||
# db-version defined, db-sys-id and wal undefined
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
($strArchiveId, $strArchiveFile, $strCipherPass) = archiveGetCheck(PG_VERSION_92, undef, undef, false);
|
||||
$self->testResult(sub {($strArchiveId eq PG_VERSION_94 . '-13') && !defined($strArchiveFile) && !defined($strCipherPass)},
|
||||
true, 'old db-version, db-sys-id and wal undefined returns only current db archive-id');
|
||||
|
||||
# db-version undefined, db-sys-id defined and wal undefined
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
($strArchiveId, $strArchiveFile, $strCipherPass) = archiveGetCheck(
|
||||
undef, $self->dbSysId(PG_VERSION_93), undef, false);
|
||||
$self->testResult(sub {($strArchiveId eq PG_VERSION_94 . '-13') && !defined($strArchiveFile) && !defined($strCipherPass)},
|
||||
true, 'undef db-version, old db-sys-id and wal undef returns only current db archive-id');
|
||||
|
||||
# old db-version, db-sys-id and wal undefined, check = true (default)
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
($strArchiveId, $strArchiveFile, $strCipherPass) = archiveGetCheck(PG_VERSION_92, undef, undef);
|
||||
$self->testResult(sub {($strArchiveId eq PG_VERSION_94 . '-13') && !defined($strArchiveFile) && !defined($strCipherPass)},
|
||||
true, 'old db-version, db-sys-id and wal undefined, check = true returns only current db archive-id');
|
||||
|
||||
# old db-version, old db-sys-id and wal undefined, check = true (default)
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$self->testException(sub {archiveGetCheck(
|
||||
PG_VERSION_93, $self->dbSysId(PG_VERSION_93), undef)}, ERROR_ARCHIVE_MISMATCH,
|
||||
"WAL segment version " . PG_VERSION_93 . " does not match archive version " . PG_VERSION_94 . "\n" .
|
||||
"WAL segment system-id " . $self->dbSysId(PG_VERSION_93) . " does not match archive system-id " .
|
||||
$self->dbSysId(PG_VERSION_94) . "\nHINT: are you archiving to the correct stanza?");
|
||||
|
||||
# db-version, db-sys-id undefined, wal requested is stored in old archive
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strArchivePath = $self->{strArchivePath} . "/" . PG_VERSION_92 . "-1/";
|
||||
my $strWalMajorPath = "${strArchivePath}/" . substr($strWalSegment, 0, 16);
|
||||
my $strWalSegmentName = "${strWalSegment}-${strFileHash}";
|
||||
|
||||
storageRepo()->pathCreate($strWalMajorPath, {bCreateParent => true});
|
||||
storageRepo()->put("${strWalMajorPath}/${strWalSegmentName}");
|
||||
|
||||
($strArchiveId, $strArchiveFile, $strCipherPass) = archiveGetCheck(undef, undef, $strWalSegment, false);
|
||||
|
||||
$self->testResult(sub {($strArchiveId eq PG_VERSION_94 . '-13') && !defined($strArchiveFile) && !defined($strCipherPass)},
|
||||
true, 'undef db-version, db-sys-id with a requested wal not in current db archive returns only current db archive-id');
|
||||
|
||||
# Pass db-version and db-sys-id where WAL is actually located
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
($strArchiveId, $strArchiveFile, $strCipherPass) =
|
||||
archiveGetCheck(PG_VERSION_92, $self->dbSysId(PG_VERSION_92), $strWalSegment, false);
|
||||
|
||||
$self->testResult(
|
||||
sub {($strArchiveId eq PG_VERSION_92 . '-1') && ($strArchiveFile eq $strWalSegmentName) && !defined($strCipherPass)},
|
||||
true, 'db-version, db-sys-id with a requested wal in requested db archive');
|
||||
|
||||
# Put same WAL segment in more recent archive for same DB
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strArchivePath = $self->{strArchivePath} . "/" . PG_VERSION_92 . "-3/";
|
||||
$strWalMajorPath = "${strArchivePath}/" . substr($strWalSegment, 0, 16);
|
||||
$strWalSegmentName = "${strWalSegment}-${strFileHash}";
|
||||
|
||||
# Store with actual data that will match the hash check
|
||||
storageRepo()->pathCreate($strWalMajorPath, {bCreateParent => true});
|
||||
storageRepo()->put("${strWalMajorPath}/${strWalSegmentName}", $strFileContent);
|
||||
|
||||
($strArchiveId, $strArchiveFile, $strCipherPass) =
|
||||
archiveGetCheck(PG_VERSION_92, $self->dbSysId(PG_VERSION_92), $strWalSegment, false);
|
||||
|
||||
# Using the returned values, confirm the correct file is read
|
||||
$self->testResult(sub {cryptoHashOne('sha1', ${storageRepo()->get($self->{strArchivePath} . "/" . $strArchiveId . "/" .
|
||||
substr($strWalSegment, 0, 16) . "/" . $strArchiveFile)})}, $strFileHash,
|
||||
'check correct WAL archiveID when in multiple locations');
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in New Issue
Block a user