You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-06-16 23:47:38 +02:00
Configuration rules are now pulled from the C library when present.
This commit is contained in:
@ -71,19 +71,19 @@ sub run
|
||||
true, $self->expect(), {bHostBackup => $bRemote, bCompress => false, bS3 => $bS3});
|
||||
|
||||
# Reduce log level for many tests
|
||||
my $strLogReduced = '--' . OPTION_LOG_LEVEL_CONSOLE . '=' . lc(DETAIL);
|
||||
my $strLogReduced = '--' . cfgOptionName(CFGOPT_LOG_LEVEL_CONSOLE) . '=' . lc(DETAIL);
|
||||
|
||||
# If S3 set process max to 2. This seems like the best place for parallel testing since it will help speed S3 processing
|
||||
# without slowing down the other tests too much.
|
||||
if ($bS3)
|
||||
{
|
||||
$oHostBackup->configUpdate({&CONFIG_SECTION_GLOBAL => {&OPTION_PROCESS_MAX => 2}});
|
||||
$oHostDbMaster->configUpdate({&CONFIG_SECTION_GLOBAL => {&OPTION_PROCESS_MAX => 2}});
|
||||
$oHostBackup->configUpdate({&CFGDEF_SECTION_GLOBAL => {cfgOptionName(CFGOPT_PROCESS_MAX) => 2}});
|
||||
$oHostDbMaster->configUpdate({&CFGDEF_SECTION_GLOBAL => {cfgOptionName(CFGOPT_PROCESS_MAX) => 2}});
|
||||
|
||||
# Reduce log level to detail because parallel tests do not create deterministic logs
|
||||
$oHostBackup->configUpdate({&CONFIG_SECTION_GLOBAL => {&OPTION_LOG_LEVEL_CONSOLE => lc(WARN)}});
|
||||
$oHostDbMaster->configUpdate({&CONFIG_SECTION_GLOBAL => {&OPTION_LOG_LEVEL_CONSOLE => lc(WARN)}});
|
||||
$strLogReduced = '--' . OPTION_LOG_LEVEL_CONSOLE . '=' . lc(WARN);
|
||||
$oHostBackup->configUpdate({&CFGDEF_SECTION_GLOBAL => {cfgOptionName(CFGOPT_LOG_LEVEL_CONSOLE) => lc(WARN)}});
|
||||
$oHostDbMaster->configUpdate({&CFGDEF_SECTION_GLOBAL => {cfgOptionName(CFGOPT_LOG_LEVEL_CONSOLE) => lc(WARN)}});
|
||||
$strLogReduced = '--' . cfgOptionName(CFGOPT_LOG_LEVEL_CONSOLE) . '=' . lc(WARN);
|
||||
}
|
||||
|
||||
# Get base time
|
||||
@ -257,13 +257,13 @@ sub run
|
||||
}
|
||||
|
||||
# Backup Info (with no stanzas)
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$oHostDbMaster->info('no stanzas exist');
|
||||
$oHostDbMaster->info('no stanzas exist', {strOutput => INFO_OUTPUT_JSON});
|
||||
$oHostDbMaster->info('no stanzas exist', {strOutput => CFGOPTVAL_INFO_OUTPUT_JSON});
|
||||
|
||||
# Full backup
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
my $strType = BACKUP_TYPE_FULL;
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
my $strType = CFGOPTVAL_BACKUP_TYPE_FULL;
|
||||
my $strOptionalParam = '--manifest-save-threshold=3';
|
||||
my $strTestPoint;
|
||||
|
||||
@ -279,7 +279,7 @@ sub run
|
||||
}
|
||||
|
||||
# Create the archive info file
|
||||
$oHostBackup->stanzaCreate('create required data for stanza', {strOptionalParam => '--no-' . OPTION_ONLINE});
|
||||
$oHostBackup->stanzaCreate('create required data for stanza', {strOptionalParam => '--no-' . cfgOptionName(CFGOPT_ONLINE)});
|
||||
|
||||
# Create a file link
|
||||
storageTest()->pathCreate($oHostDbMaster->dbPath() . '/pg_config', {strMode => '0700', bCreateParent => true});
|
||||
@ -325,12 +325,13 @@ sub run
|
||||
$strFullBackup = $oHostBackup->backup(
|
||||
$strType, 'create pg_stat link, pg_clog dir',
|
||||
{oExpectedManifest => \%oManifest,
|
||||
strOptionalParam => $strOptionalParam . ($bRemote ? ' --cmd-ssh=/usr/bin/ssh' : '') . ' --' . OPTION_BUFFER_SIZE .
|
||||
'=16384 --' . OPTION_CHECKSUM_PAGE . ' --' . OPTION_PROCESS_MAX . '=1',
|
||||
strRepoType => $bS3 ? undef : REPO_TYPE_CIFS, strTest => $strTestPoint, fTestDelay => 0});
|
||||
strOptionalParam => $strOptionalParam . ($bRemote ? ' --cmd-ssh=/usr/bin/ssh' : '') .
|
||||
' --' . cfgOptionName(CFGOPT_BUFFER_SIZE) . '=16384 --' . cfgOptionName(CFGOPT_CHECKSUM_PAGE) .
|
||||
' --' . cfgOptionName(CFGOPT_PROCESS_MAX) . '=1',
|
||||
strRepoType => $bS3 ? undef : CFGOPTVAL_REPO_TYPE_CIFS, strTest => $strTestPoint, fTestDelay => 0});
|
||||
|
||||
# Error on backup option to check logging
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
if (!$bRemote)
|
||||
{
|
||||
$oHostBackup->backup(
|
||||
@ -339,7 +340,7 @@ sub run
|
||||
}
|
||||
|
||||
# Test protocol timeout
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
if ($bRemote && !$bS3)
|
||||
{
|
||||
$oHostBackup->backup(
|
||||
@ -349,7 +350,7 @@ sub run
|
||||
}
|
||||
|
||||
# Stop operations and make sure the correct error occurs
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
if (!$bS3)
|
||||
{
|
||||
# Test a backup abort
|
||||
@ -404,8 +405,8 @@ sub run
|
||||
}
|
||||
|
||||
# Resume Full Backup
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strType = BACKUP_TYPE_FULL;
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strType = CFGOPTVAL_BACKUP_TYPE_FULL;
|
||||
|
||||
# These files should never be backed up (this requires the next backup to do --force)
|
||||
testFileCreate($oHostDbMaster->dbBasePath() . '/' . DB_FILE_POSTMASTERPID, 'JUNK');
|
||||
@ -461,20 +462,20 @@ sub run
|
||||
$strFullBackup = $oHostBackup->backup(
|
||||
$strType, 'resume',
|
||||
{oExpectedManifest => \%oManifest, strTest => TEST_BACKUP_RESUME,
|
||||
strOptionalParam => '--force --' . OPTION_CHECKSUM_PAGE});
|
||||
strOptionalParam => '--force --' . cfgOptionName(CFGOPT_CHECKSUM_PAGE)});
|
||||
|
||||
# Remove postmaster.pid so restore will succeed (the rest will be cleaned up by the delta)
|
||||
storageDb->remove($oHostDbMaster->dbBasePath() . '/' . DB_FILE_POSTMASTERPID);
|
||||
|
||||
# Misconfigure repo-path and check errors
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$oHostBackup->backup(
|
||||
$strType, 'invalid repo',
|
||||
{oExpectedManifest => \%oManifest, strOptionalParam => '--' . OPTION_REPO_PATH . '=/bogus_path' .
|
||||
{oExpectedManifest => \%oManifest, strOptionalParam => '--' . cfgOptionName(CFGOPT_REPO_PATH) . '=/bogus_path' .
|
||||
" ${strLogReduced}", iExpectedExitStatus => $bS3 ? ERROR_FILE_MISSING : ERROR_PATH_MISSING});
|
||||
|
||||
# Restore - tests various mode, extra files/paths, missing files/paths
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
my $bDelta = true;
|
||||
my $bForce = false;
|
||||
|
||||
@ -576,7 +577,7 @@ sub run
|
||||
}
|
||||
|
||||
# Restore - test errors when $PGDATA cannot be verified
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$bDelta = true;
|
||||
$bForce = true;
|
||||
|
||||
@ -607,8 +608,8 @@ sub run
|
||||
'restore succeeds with backup.manifest file', undef, $strLogReduced);
|
||||
|
||||
# Various broken info tests
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strType = BACKUP_TYPE_INCR;
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strType = CFGOPTVAL_BACKUP_TYPE_INCR;
|
||||
$oHostDbMaster->manifestReference(\%oManifest, $strFullBackup);
|
||||
|
||||
# Break the database version
|
||||
@ -651,8 +652,8 @@ sub run
|
||||
$oHostBackup->infoRestore(storageRepo()->pathGet(STORAGE_REPO_BACKUP . qw{/} . FILE_BACKUP_INFO));
|
||||
|
||||
# Test broken tablespace configuration
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strType = BACKUP_TYPE_INCR;
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strType = CFGOPTVAL_BACKUP_TYPE_INCR;
|
||||
my $strTblSpcPath = $oHostDbMaster->dbBasePath() . '/' . DB_PATH_PGTBLSPC;
|
||||
|
||||
# Create a directory in pg_tablespace
|
||||
@ -750,8 +751,8 @@ sub run
|
||||
testFileRemove("${strTblSpcPath}/99999");
|
||||
|
||||
# Incr backup
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strType = BACKUP_TYPE_INCR;
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strType = CFGOPTVAL_BACKUP_TYPE_INCR;
|
||||
|
||||
# Add tablespace 1
|
||||
$oHostDbMaster->manifestTablespaceCreate(\%oManifest, 1);
|
||||
@ -775,8 +776,8 @@ sub run
|
||||
$strType, 'add tablespace 1', {oExpectedManifest => \%oManifest, strOptionalParam => '--test'});
|
||||
|
||||
# Resume Incr Backup
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strType = BACKUP_TYPE_INCR;
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strType = CFGOPTVAL_BACKUP_TYPE_INCR;
|
||||
|
||||
# Create resumable backup from last backup
|
||||
$strResumePath =
|
||||
@ -813,11 +814,11 @@ sub run
|
||||
$strBackup = $oHostBackup->backup(
|
||||
$strType, 'resume and add tablespace 2',
|
||||
{oExpectedManifest => \%oManifest, strTest => TEST_BACKUP_RESUME,
|
||||
strOptionalParam => '--' . OPTION_PROCESS_MAX . '=1'});
|
||||
strOptionalParam => '--' . cfgOptionName(CFGOPT_PROCESS_MAX) . '=1'});
|
||||
|
||||
# Resume Diff Backup
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strType = BACKUP_TYPE_DIFF;
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strType = CFGOPTVAL_BACKUP_TYPE_DIFF;
|
||||
|
||||
# Drop tablespace 11
|
||||
$oHostDbMaster->manifestTablespaceDrop(\%oManifest, 11);
|
||||
@ -831,11 +832,11 @@ sub run
|
||||
$strBackup = $oHostBackup->backup(
|
||||
$strType, 'cannot resume - new diff',
|
||||
{oExpectedManifest => \%oManifest, strTest => TEST_BACKUP_NORESUME,
|
||||
strOptionalParam => "$strLogReduced --" . OPTION_PROCESS_MAX . '=1'});
|
||||
strOptionalParam => "$strLogReduced --" . cfgOptionName(CFGOPT_PROCESS_MAX) . '=1'});
|
||||
|
||||
# Resume Diff Backup
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strType = BACKUP_TYPE_DIFF;
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strType = CFGOPTVAL_BACKUP_TYPE_DIFF;
|
||||
|
||||
# Create resumable backup from last backup
|
||||
$strResumePath = storageRepo()->pathGet('backup/' . $self->stanza() . "/${strBackup}");
|
||||
@ -846,10 +847,10 @@ sub run
|
||||
$strBackup = $oHostBackup->backup(
|
||||
$strType, 'cannot resume - disabled / no repo link',
|
||||
{oExpectedManifest => \%oManifest, strTest => TEST_BACKUP_NORESUME,
|
||||
strOptionalParam => "--no-resume ${strLogReduced} --" . OPTION_PROCESS_MAX . '=1'});
|
||||
strOptionalParam => "--no-resume ${strLogReduced} --" . cfgOptionName(CFGOPT_PROCESS_MAX) . '=1'});
|
||||
|
||||
# Restore
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$bDelta = false;
|
||||
$bForce = false;
|
||||
|
||||
@ -870,7 +871,7 @@ sub run
|
||||
'remap all paths', undef, $strLogReduced);
|
||||
|
||||
# Restore (make sure file in root tablespace path is not deleted by --delta)
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$bDelta = true;
|
||||
|
||||
$oHostDbMaster->restore(
|
||||
@ -883,8 +884,8 @@ sub run
|
||||
}
|
||||
|
||||
# Incr Backup
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strType = BACKUP_TYPE_INCR;
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strType = CFGOPTVAL_BACKUP_TYPE_INCR;
|
||||
$oHostDbMaster->manifestReference(\%oManifest, $strBackup);
|
||||
|
||||
$oHostDbMaster->manifestFileCreate(
|
||||
@ -902,11 +903,11 @@ sub run
|
||||
|
||||
$strBackup = $oHostBackup->backup(
|
||||
$strType, 'add files and remove tablespace 2',
|
||||
{oExpectedManifest => \%oManifest, strOptionalParam => "$strLogReduced --" . OPTION_PROCESS_MAX . '=1'});
|
||||
{oExpectedManifest => \%oManifest, strOptionalParam => "$strLogReduced --" . cfgOptionName(CFGOPT_PROCESS_MAX) . '=1'});
|
||||
|
||||
# Incr Backup
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strType = BACKUP_TYPE_INCR;
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strType = CFGOPTVAL_BACKUP_TYPE_INCR;
|
||||
$oHostDbMaster->manifestReference(\%oManifest, $strBackup);
|
||||
|
||||
# Delete the backup.info and make sure the backup fails - the user must then run a stanza-create --force
|
||||
@ -926,16 +927,16 @@ sub run
|
||||
|
||||
# Fail on attempt to create the stanza data since force was not used
|
||||
$oHostBackup->stanzaCreate('fail on backup directory missing backup.info',
|
||||
{iExpectedExitStatus => ERROR_FILE_MISSING, strOptionalParam => '--no-' . OPTION_ONLINE});
|
||||
{iExpectedExitStatus => ERROR_FILE_MISSING, strOptionalParam => '--no-' . cfgOptionName(CFGOPT_ONLINE)});
|
||||
|
||||
# Use force to create the stanza
|
||||
$oHostBackup->stanzaCreate('create required data for stanza',
|
||||
{strOptionalParam => '--no-' . OPTION_ONLINE . ' --' . OPTION_FORCE});
|
||||
{strOptionalParam => '--no-' . cfgOptionName(CFGOPT_ONLINE) . ' --' . cfgOptionName(CFGOPT_FORCE)});
|
||||
}
|
||||
else
|
||||
{
|
||||
$oHostBackup->stanzaCreate('create required data for stanza',
|
||||
{strOptionalParam => '--no-' . OPTION_ONLINE . ' --' . OPTION_FORCE});
|
||||
{strOptionalParam => '--no-' . cfgOptionName(CFGOPT_ONLINE) . ' --' . cfgOptionName(CFGOPT_FORCE)});
|
||||
}
|
||||
|
||||
# Perform the backup
|
||||
@ -943,25 +944,25 @@ sub run
|
||||
$strType, 'update files', {oExpectedManifest => \%oManifest, strOptionalParam => $strLogReduced});
|
||||
|
||||
# Diff Backup
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strType = BACKUP_TYPE_DIFF;
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strType = CFGOPTVAL_BACKUP_TYPE_DIFF;
|
||||
$oHostDbMaster->manifestReference(\%oManifest, $strFullBackup, true);
|
||||
|
||||
$strBackup = $oHostBackup->backup(
|
||||
$strType, 'updates since last full', {oExpectedManifest => \%oManifest,
|
||||
strOptionalParam => "$strLogReduced --" . OPTION_PROCESS_MAX . '=1'});
|
||||
strOptionalParam => "$strLogReduced --" . cfgOptionName(CFGOPT_PROCESS_MAX) . '=1'});
|
||||
|
||||
# Incr Backup
|
||||
#
|
||||
# Remove a file from the db after the manifest has been built but before files are copied. The file will not be shown
|
||||
# as removed in the log because it had not changed since the last backup so it will only be referenced. This test also
|
||||
# checks that everything works when there are no jobs to run.
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strType = BACKUP_TYPE_INCR;
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strType = CFGOPTVAL_BACKUP_TYPE_INCR;
|
||||
$oHostDbMaster->manifestReference(\%oManifest, $strBackup);
|
||||
|
||||
# Enable compression to ensure a warning is raised
|
||||
$oHostBackup->configUpdate({&CONFIG_SECTION_GLOBAL => {&OPTION_COMPRESS => 'y'}});
|
||||
$oHostBackup->configUpdate({&CFGDEF_SECTION_GLOBAL => {cfgOptionName(CFGOPT_COMPRESS) => 'y'}});
|
||||
|
||||
my $oBackupExecute = $oHostBackup->backupBegin(
|
||||
$strType, 'remove files - but won\'t affect manifest',
|
||||
@ -976,10 +977,10 @@ sub run
|
||||
#
|
||||
# Remove base2.txt and changed tablespace2c.txt during the backup. The removed file should be logged and the changed
|
||||
# file should have the new, larger size logged and in the manifest.
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$oHostDbMaster->manifestReference(\%oManifest, $strFullBackup, true);
|
||||
|
||||
$strType = BACKUP_TYPE_DIFF;
|
||||
$strType = CFGOPTVAL_BACKUP_TYPE_DIFF;
|
||||
|
||||
$oHostDbMaster->manifestFileRemove(\%oManifest, MANIFEST_TARGET_PGDATA, 'base/16384/17000');
|
||||
|
||||
@ -991,13 +992,13 @@ sub run
|
||||
# Enable hardlinks (except for s3) to ensure a warning is raised
|
||||
if (!$bS3)
|
||||
{
|
||||
$oHostBackup->configUpdate({&CONFIG_SECTION_GLOBAL => {&OPTION_HARDLINK => 'y'}});
|
||||
$oHostBackup->configUpdate({&CFGDEF_SECTION_GLOBAL => {cfgOptionName(CFGOPT_HARDLINK) => 'y'}});
|
||||
}
|
||||
|
||||
$oBackupExecute = $oHostBackup->backupBegin(
|
||||
$strType, 'remove files during backup',
|
||||
{oExpectedManifest => \%oManifest, strTest => TEST_MANIFEST_BUILD, fTestDelay => 1,
|
||||
strOptionalParam => "$strLogReduced --" . OPTION_PROCESS_MAX . '=1'});
|
||||
strOptionalParam => "$strLogReduced --" . cfgOptionName(CFGOPT_PROCESS_MAX) . '=1'});
|
||||
|
||||
$oHostDbMaster->manifestFileCreate(
|
||||
\%oManifest, MANIFEST_TARGET_PGTBLSPC . '/2', '32768/tablespace2c.txt', 'TBLSPCBIGGER',
|
||||
@ -1008,8 +1009,8 @@ sub run
|
||||
$strBackup = $oHostBackup->backupEnd($strType, $oBackupExecute, {oExpectedManifest => \%oManifest});
|
||||
|
||||
# Full Backup
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strType = BACKUP_TYPE_FULL;
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strType = CFGOPTVAL_BACKUP_TYPE_FULL;
|
||||
|
||||
# Now the compression and hardlink changes will take effect
|
||||
$oManifest{&MANIFEST_SECTION_BACKUP_OPTION}{&MANIFEST_KEY_COMPRESS} = JSON::PP::true;
|
||||
@ -1032,17 +1033,17 @@ sub run
|
||||
$strType, 'update file', {oExpectedManifest => \%oManifest, strOptionalParam => $strLogReduced});
|
||||
|
||||
# Backup Info
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$oHostDbMaster->info('normal output', {strStanza => $oHostDbMaster->stanza()});
|
||||
$oHostBackup->info('normal output', {strStanza => $oHostBackup->stanza(), strOutput => INFO_OUTPUT_JSON});
|
||||
$oHostBackup->info('normal output', {strStanza => $oHostBackup->stanza(), strOutput => CFGOPTVAL_INFO_OUTPUT_JSON});
|
||||
|
||||
# Call expire
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$oHostBackup->expire({iRetentionFull => 1});
|
||||
|
||||
# Diff Backup
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
$strType = BACKUP_TYPE_DIFF;
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$strType = CFGOPTVAL_BACKUP_TYPE_DIFF;
|
||||
|
||||
$oHostDbMaster->manifestReference(\%oManifest, $strFullBackup);
|
||||
|
||||
@ -1057,10 +1058,10 @@ sub run
|
||||
|
||||
$strBackup = $oHostBackup->backup(
|
||||
$strType, 'add file', {oExpectedManifest => \%oManifest,
|
||||
strOptionalParam => "${strLogReduced} --" . OPTION_CHECKSUM_PAGE});
|
||||
strOptionalParam => "${strLogReduced} --" . cfgOptionName(CFGOPT_CHECKSUM_PAGE)});
|
||||
|
||||
# Selective Restore
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$bDelta = true;
|
||||
|
||||
# Remove mapping for tablespace 1
|
||||
@ -1075,8 +1076,8 @@ sub run
|
||||
{&MANIFEST_SUBKEY_CHECKSUM});
|
||||
|
||||
$oHostDbMaster->restore(
|
||||
OPTION_DEFAULT_RESTORE_SET, \%oManifest, \%oRemapHash, $bDelta, $bForce, undef, undef, undef, undef, undef, undef,
|
||||
'selective restore 16384', undef, "${strLogReduced} --db-include=16384");
|
||||
cfgRuleOptionDefault(CFGCMD_RESTORE, CFGOPT_SET), \%oManifest, \%oRemapHash, $bDelta, $bForce, undef, undef, undef,
|
||||
undef, undef, undef, 'selective restore 16384', undef, "${strLogReduced} --db-include=16384");
|
||||
|
||||
# Restore checksum values for next test
|
||||
$oManifest{&MANIFEST_SECTION_TARGET_FILE}{'pg_data/base/32768/33000'}{&MANIFEST_SUBKEY_CHECKSUM} =
|
||||
@ -1092,23 +1093,22 @@ sub run
|
||||
delete($oManifest{&MANIFEST_SECTION_TARGET_FILE}{'pg_data/base/16384/17000'}{&MANIFEST_SUBKEY_CHECKSUM});
|
||||
|
||||
$oHostDbMaster->restore(
|
||||
OPTION_DEFAULT_RESTORE_SET, \%oManifest, \%oRemapHash, $bDelta, $bForce, undef, undef, undef, undef, undef, undef,
|
||||
'selective restore 32768', undef, "${strLogReduced} --db-include=32768");
|
||||
cfgRuleOptionDefault(CFGCMD_RESTORE, CFGOPT_SET), \%oManifest, \%oRemapHash, $bDelta, $bForce, undef, undef, undef,
|
||||
undef, undef, undef, 'selective restore 32768', undef, "${strLogReduced} --db-include=32768");
|
||||
|
||||
$oManifest{&MANIFEST_SECTION_TARGET_FILE}{'pg_data/base/16384/17000'}{&MANIFEST_SUBKEY_CHECKSUM} =
|
||||
'7579ada0808d7f98087a0a586d0df9de009cdc33';
|
||||
|
||||
$oHostDbMaster->restore(
|
||||
OPTION_DEFAULT_RESTORE_SET, \%oManifest, \%oRemapHash,
|
||||
$bDelta, $bForce, undef, undef, undef, undef, undef, undef,
|
||||
'error on invalid id', ERROR_DB_MISSING, '--log-level-console=warn --db-include=7777');
|
||||
cfgRuleOptionDefault(CFGCMD_RESTORE, CFGOPT_SET), \%oManifest, \%oRemapHash, $bDelta, $bForce, undef, undef, undef,
|
||||
undef, undef, undef, 'error on invalid id', ERROR_DB_MISSING, '--log-level-console=warn --db-include=7777');
|
||||
|
||||
$oHostDbMaster->restore(
|
||||
OPTION_DEFAULT_RESTORE_SET, \%oManifest, \%oRemapHash, $bDelta, $bForce, undef, undef, undef, undef, undef, undef,
|
||||
'error on system id', ERROR_DB_INVALID, '--log-level-console=warn --db-include=1');
|
||||
cfgRuleOptionDefault(CFGCMD_RESTORE, CFGOPT_SET), \%oManifest, \%oRemapHash, $bDelta, $bForce, undef, undef, undef,
|
||||
undef, undef, undef, 'error on system id', ERROR_DB_INVALID, '--log-level-console=warn --db-include=1');
|
||||
|
||||
# Compact Restore
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
$bDelta = false;
|
||||
|
||||
executeTest('rm -rf ' . $oHostDbMaster->dbBasePath(2) . "/*");
|
||||
@ -1120,33 +1120,33 @@ sub run
|
||||
delete($oRemapHash{&MANIFEST_TARGET_PGTBLSPC . '/2'});
|
||||
|
||||
$oHostDbMaster->restore(
|
||||
OPTION_DEFAULT_RESTORE_SET, \%oManifest, \%oRemapHash, $bDelta, $bForce, undef, undef, undef, undef, undef, undef,
|
||||
'no tablespace remap - error when tablespace dir does not exist', ERROR_PATH_MISSING,
|
||||
cfgRuleOptionDefault(CFGCMD_RESTORE, CFGOPT_SET), \%oManifest, \%oRemapHash, $bDelta, $bForce, undef, undef, undef,
|
||||
undef, undef, undef, 'no tablespace remap - error when tablespace dir does not exist', ERROR_PATH_MISSING,
|
||||
"${strLogReduced} --tablespace-map-all=../../tablespace", false);
|
||||
|
||||
storageTest()->pathCreate($oHostDbMaster->dbBasePath(2) . '/tablespace', {strMode => '0700'});
|
||||
|
||||
$oHostDbMaster->restore(
|
||||
OPTION_DEFAULT_RESTORE_SET, \%oManifest, undef, $bDelta, $bForce, undef, undef, undef, undef, undef, undef,
|
||||
'no tablespace remap', undef, "--tablespace-map-all=../../tablespace ${strLogReduced}", false);
|
||||
cfgRuleOptionDefault(CFGCMD_RESTORE, CFGOPT_SET), \%oManifest, undef, $bDelta, $bForce, undef, undef, undef, undef,
|
||||
undef, undef, 'no tablespace remap', undef, "--tablespace-map-all=../../tablespace ${strLogReduced}", false);
|
||||
|
||||
$oManifest{&MANIFEST_SECTION_BACKUP_TARGET}{'pg_tblspc/2'}{&MANIFEST_SUBKEY_PATH} = '../../tablespace/ts2';
|
||||
$oManifest{&MANIFEST_SECTION_TARGET_LINK}{'pg_data/pg_tblspc/2'}{&MANIFEST_SUBKEY_DESTINATION} = '../../tablespace/ts2';
|
||||
|
||||
# Backup Info (with an empty stanza)
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
forceStorageMode(storageRepo(), 'backup', 'g+w');
|
||||
storageRepo()->pathCreate(storageRepo()->pathGet('backup/db_empty'), {strMode => '0770'});
|
||||
|
||||
$oHostBackup->info('normal output');
|
||||
$oHostDbMaster->info('normal output', {strOutput => INFO_OUTPUT_JSON});
|
||||
$oHostDbMaster->info('normal output', {strOutput => CFGOPTVAL_INFO_OUTPUT_JSON});
|
||||
$oHostBackup->info('bogus stanza', {strStanza => BOGUS});
|
||||
$oHostDbMaster->info('bogus stanza', {strStanza => BOGUS, strOutput => INFO_OUTPUT_JSON});
|
||||
$oHostDbMaster->info('bogus stanza', {strStanza => BOGUS, strOutput => CFGOPTVAL_INFO_OUTPUT_JSON});
|
||||
|
||||
# Dump out history path at the end to verify all history files are being recorded. This test is only performed locally
|
||||
# because for some reason sort order is different when this command is executed via ssh (even though the content of the
|
||||
# directory is identical).
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
if (!$bRemote)
|
||||
{
|
||||
executeTest('ls -1R ' . storageRepo()->pathGet('backup/' . $self->stanza() . '/' . PATH_BACKUP_HISTORY),
|
||||
@ -1154,7 +1154,7 @@ sub run
|
||||
}
|
||||
|
||||
# Test config file validation
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
if ($bRemote)
|
||||
{
|
||||
# Save off config file and add an invalid option to the remote (DB master) and confirm no warning thrown
|
||||
@ -1184,12 +1184,12 @@ sub run
|
||||
}
|
||||
|
||||
# Test backup from standby warning that standby not configured so option reset
|
||||
#-----------------------------------------------------------------------------------------------------------------------
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
if (!defined($oHostDbStandby))
|
||||
{
|
||||
$strBackup = $oHostBackup->backup(
|
||||
$strType, 'option backup-standby reset - backup performed from master', {oExpectedManifest => \%oManifest,
|
||||
strOptionalParam => '--log-level-console=info --' . OPTION_BACKUP_STANDBY});
|
||||
strOptionalParam => '--log-level-console=info --' . cfgOptionName(CFGOPT_BACKUP_STANDBY)});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user