diff --git a/bin/pg_backrest.pl b/bin/pg_backrest.pl index 940774bb5..cf7cdda73 100755 --- a/bin/pg_backrest.pl +++ b/bin/pg_backrest.pl @@ -447,11 +447,11 @@ if (operation_get() eq OP_RESTORE) # Do the restore new BackRest::Restore ( - config_key_load(CONFIG_SECTION_STANZA, CONFIG_KEY_PATH), + config_key_load(CONFIG_SECTION_STANZA, CONFIG_KEY_PATH, true), param_get(PARAM_SET), config_section_load(CONFIG_SECTION_TABLESPACE_MAP), $oFile, - undef, #param_get(PARAM_THREAD), + config_key_load(CONFIG_SECTION_RESTORE, CONFIG_KEY_THREAD_MAX, true), param_get(PARAM_DELTA), param_get(PARAM_FORCE), param_get(PARAM_TYPE), diff --git a/lib/BackRest/Config.pm b/lib/BackRest/Config.pm index 573f1d2c0..b335e7b37 100644 --- a/lib/BackRest/Config.pm +++ b/lib/BackRest/Config.pm @@ -345,6 +345,26 @@ sub config_key_load return $strValue; } +#################################################################################################################################### +# CONFIG_KEY_SET +#################################################################################################################################### +sub config_key_set +{ + my $strSection = shift; + my $strKey = shift; + my $strValue = shift; + + # Make sure all parameters are defined + if (!defined($strSection) || !defined($strKey) || !defined($strValue)) + { + confess &log(ASSERT, 'section, key and value must all be defined'); + } + + # Set the value + $strSection = param_get(PARAM_STANZA) . ':' . $strSection; + + $oConfig{$strSection}{$strKey} = $strValue; +} #################################################################################################################################### # CONFIG_VALID @@ -357,7 +377,7 @@ sub config_valid my $strSection; my $oSectionHashRef; - # Check recovery:option section + # Check [stanza]:recovery:option section $strSection = param_get(PARAM_STANZA) . ':' . CONFIG_SECTION_RECOVERY_OPTION; $oSectionHashRef = $oConfig{$strSection}; @@ -379,6 +399,18 @@ sub config_valid } } } + + # Default thread-max + if (!defined(config_key_load(CONFIG_SECTION_BACKUP, CONFIG_KEY_THREAD_MAX))) + { + config_key_set(CONFIG_SECTION_BACKUP, CONFIG_KEY_THREAD_MAX, 1); + } + + if (!defined(config_key_load(CONFIG_SECTION_RESTORE, CONFIG_KEY_THREAD_MAX))) + { + config_key_set(CONFIG_SECTION_RESTORE, CONFIG_KEY_THREAD_MAX, + config_key_load(CONFIG_SECTION_BACKUP, CONFIG_KEY_THREAD_MAX, true)); + } } #################################################################################################################################### diff --git a/test/lib/BackRestTest/BackupTest.pm b/test/lib/BackRestTest/BackupTest.pm index 1013954a2..ea01784bc 100755 --- a/test/lib/BackRestTest/BackupTest.pm +++ b/test/lib/BackRestTest/BackupTest.pm @@ -1007,7 +1007,7 @@ sub BackRestTestBackup_Restore ($bDelta ? ' delta' : '') . ($bForce ? ', force' : '') . ($strBackup ne 'latest' ? ", backup '${strBackup}'" : '') . - ($strType ? ", type '${strType}' " : '') . + ($strType ? ", type '${strType}'" : '') . ($strTarget ? ", target '${strTarget}'" : '') . ($strTargetTimeline ? ", timeline '${strTargetTimeline}'" : '') . (defined($bTargetExclusive) && $bTargetExclusive ? ', exclusive' : '') .