You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-11-27 22:18:40 +02:00
Add Perl interface to C storage layer.
Maintaining the storage layer/drivers in two languages is burdensome. Since the integration tests require the Perl storage layer/drivers we'll need them even after the core code is migrated to C. Create an interface layer so the Perl code can be removed and new storage drivers/features introduced without adding Perl equivalents. The goal is to move the integration tests to C so this interface will eventually be removed. That being the case, the interface was designed for maximum compatibility to ease the transition. The result looks a bit hacky but we'll improve it as needed until it can be retired.
This commit is contained in:
@@ -36,6 +36,8 @@ use pgBackRestTest::Env::Host::HostBaseTest;
|
||||
use pgBackRestTest::Env::Host::HostBackupTest;
|
||||
use pgBackRestTest::Env::Host::HostDbTest;
|
||||
use pgBackRestTest::Env::HostEnvTest;
|
||||
use pgBackRestTest::Common::Storage;
|
||||
use pgBackRestTest::Common::StoragePosix;
|
||||
|
||||
####################################################################################################################################
|
||||
# run
|
||||
@@ -270,7 +272,7 @@ sub run
|
||||
executeTest("sudo chmod 400 ${strDir}");
|
||||
|
||||
$strComment = 'confirm master manifest->build executed';
|
||||
$oHostDbMaster->check($strComment, {iTimeout => 5, iExpectedExitStatus => ERROR_FILE_OPEN});
|
||||
$oHostDbMaster->check($strComment, {iTimeout => 5, iExpectedExitStatus => ERROR_PATH_OPEN});
|
||||
executeTest("sudo rmdir ${strDir}");
|
||||
|
||||
# Providing a sufficient archive-timeout, verify that the check command runs successfully now with valid
|
||||
@@ -503,10 +505,10 @@ sub run
|
||||
my $strComment = 'confirm standby manifest->build executed';
|
||||
|
||||
# If there is an invalid host, the final error returned from check will be the inability to resolve the name which is
|
||||
# a read error instead of an open error
|
||||
# an open error instead of a read error
|
||||
if (!$oHostDbStandby->bogusHost())
|
||||
{
|
||||
$oHostDbStandby->check($strComment, {iTimeout => 5, iExpectedExitStatus => ERROR_FILE_OPEN});
|
||||
$oHostDbStandby->check($strComment, {iTimeout => 5, iExpectedExitStatus => ERROR_PATH_OPEN});
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -746,13 +748,19 @@ sub run
|
||||
{
|
||||
my ($strSHA1, $lSize) = storageTest()->hashSize($strDb1TablePath);
|
||||
|
||||
# Create a zeroed sparse file in the test directory that is the same size as the filenode.map
|
||||
# Create a zeroed sparse file in the test directory that is the same size as the filenode.map. We need to use the
|
||||
# posix driver directly to do this because handles cannot be passed back from the C code.
|
||||
my $oStorageTrunc = new pgBackRestTest::Common::Storage($self->testPath(), new pgBackRestTest::Common::StoragePosix());
|
||||
|
||||
my $strTestTable = $self->testPath() . "/testtable";
|
||||
my $oDestinationFileIo = storageTest()->openWrite($strTestTable);
|
||||
my $oDestinationFileIo = $oStorageTrunc->openWrite($strTestTable);
|
||||
$oDestinationFileIo->open();
|
||||
|
||||
# Truncate to the original size which will create a sparse file.
|
||||
truncate($oDestinationFileIo->handle(), $lSize);
|
||||
if (!truncate($oDestinationFileIo->handle(), $lSize))
|
||||
{
|
||||
confess "unable to truncate '$strTestTable' with handle " . $oDestinationFileIo->handle();
|
||||
}
|
||||
$oDestinationFileIo->close();
|
||||
|
||||
# Confirm the test filenode.map and the database test1 filenode.map are zeroed
|
||||
|
||||
Reference in New Issue
Block a user