1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00

Remove incompletely implemented online option from the check command.

Offline operation runs counter to the purpose of this command, which is to check if archiving and backups are working correctly.

Reported by Jason O'Donnell.
This commit is contained in:
David Steele 2018-08-12 19:24:21 -04:00
parent cb6821e853
commit 3434240097
8 changed files with 38 additions and 61 deletions

View File

@ -751,7 +751,6 @@ my %hConfigDefine =
&CFGDEF_COMMAND =>
{
&CFGCMD_BACKUP => {},
&CFGCMD_CHECK => {},
&CFGCMD_STANZA_CREATE => {},
&CFGCMD_STANZA_UPGRADE => {},
}
@ -1917,14 +1916,16 @@ my %hConfigDefine =
&CFGDEF_SECTION => CFGDEF_SECTION_GLOBAL,
&CFGDEF_TYPE => CFGDEF_TYPE_BOOLEAN,
&CFGDEF_DEFAULT => true,
&CFGDEF_DEPEND =>
{
&CFGDEF_DEPEND_OPTION => CFGOPT_ONLINE,
&CFGDEF_DEPEND_LIST => [true],
},
&CFGDEF_COMMAND =>
{
&CFGCMD_BACKUP => {},
&CFGCMD_BACKUP =>
{
&CFGDEF_DEPEND =>
{
&CFGDEF_DEPEND_OPTION => CFGOPT_ONLINE,
&CFGDEF_DEPEND_LIST => [true],
},
},
&CFGCMD_CHECK => {},
},
},

View File

@ -955,17 +955,6 @@
Note that <code>pg_create_restore_point('pgBackRest Archive Check')</code> and <code>pg_switch_xlog()</code>/<code>pg_switch_wal()</code> are called to force <postgres/> to archive a WAL segment. Restore points are only supported in <postgres/> &gt;= 9.1 so for older versions the <cmd>check</cmd> command may fail if there has been no write activity since the last log rotation, therefore it is recommended that activity be generated by the user if there have been no writes since the last WAL switch before running the <cmd>check</cmd> command.</text>
<option-list>
<!-- ======================================================================================================= -->
<option id="online" name="Online">
<summary>Check an online cluster.</summary>
<text>Specifying --no-online prevents <backrest/> from connecting to <postgres/> and will disable some checks.</text>
<example>n</example>
</option>
</option-list>
<command-example-list>
<command-example>
<text><code-block title="">

View File

@ -22,6 +22,14 @@
<p>Fix issue where errors raised in C were not logged when called from Perl. <backrest/> properly terminated with the correct error code but lacked an error message to aid in debugging.</p>
</release-item>
<release-item>
<release-item-contributor-list>
<release-item-ideator id="jason.odonnell"/>
</release-item-contributor-list>
<p>Remove incompletely implemented <br-option>online</br-option> option from the <cmd>check</cmd> command. Offline operation runs counter to the purpose of this command, which is to check if archiving and backups are working correctly.</p>
</release-item>
</release-bug-list>
<release-feature-list>

View File

@ -95,9 +95,9 @@ sub process
$oBackupManifest->numericSet(MANIFEST_SECTION_BACKUP_DB, MANIFEST_KEY_CONTROL, undef, $iControlVersion);
$oBackupManifest->numericSet(MANIFEST_SECTION_BACKUP_DB, MANIFEST_KEY_SYSTEM_ID, undef, $ullDbSysId);
$oBackupManifest->build(storageDb({iRemoteIdx => $iRemoteIdx}),
cfgOption(cfgOptionIdFromIndex(CFGOPT_PG_PATH, $iRemoteIdx)), undef, cfgOption(CFGOPT_ONLINE),
$oDb->tablespaceMapGet());
$oBackupManifest->build(
storageDb({iRemoteIdx => $iRemoteIdx}), cfgOption(cfgOptionIdFromIndex(CFGOPT_PG_PATH, $iRemoteIdx)), undef,
cfgOptionValid(CFGOPT_ONLINE) && cfgOption(CFGOPT_ONLINE), $oDb->tablespaceMapGet());
return true;
}

View File

@ -90,14 +90,9 @@ sub process
$self->stanzaUpgrade();
}
# Process stanza delete
elsif (cfgCommandTest(CFGCMD_STANZA_DELETE))
{
$self->stanzaDelete();
}
# Else error if any other command is found
else
{
confess &log(ASSERT, "stanza->process() called with invalid command: " . cfgCommandName(cfgCommandGet()));
$self->stanzaDelete();
}
# Return from function and log return values if any

View File

@ -279,13 +279,18 @@ static ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_OPTIONAL_LIST
(
CFGDEFDATA_OPTION_OPTIONAL_DEPEND_LIST
(
cfgDefOptOnline,
"1"
)
CFGDEFDATA_OPTION_OPTIONAL_DEFAULT("1")
CFGDEFDATA_OPTION_OPTIONAL_COMMAND_OVERRRIDE
(
CFGDEFDATA_OPTION_OPTIONAL_COMMAND(cfgDefCmdBackup)
CFGDEFDATA_OPTION_OPTIONAL_DEPEND_LIST
(
cfgDefOptOnline,
"1"
)
)
)
)
@ -1601,7 +1606,6 @@ static ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_COMMAND_LIST
(
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdBackup)
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdCheck)
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdStanzaCreate)
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdStanzaUpgrade)
)
@ -1626,17 +1630,6 @@ static ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
)
)
CFGDEFDATA_OPTION_OPTIONAL_COMMAND_OVERRRIDE
(
CFGDEFDATA_OPTION_OPTIONAL_COMMAND(cfgDefCmdCheck)
CFGDEFDATA_OPTION_OPTIONAL_HELP_SUMMARY("Check an online cluster.")
CFGDEFDATA_OPTION_OPTIONAL_HELP_DESCRIPTION
(
"Specifying --no-online prevents pgBackRest from connecting to PostgreSQL and will disable some checks."
)
)
CFGDEFDATA_OPTION_OPTIONAL_COMMAND_OVERRRIDE
(
CFGDEFDATA_OPTION_OPTIONAL_COMMAND(cfgDefCmdStanzaCreate)

View File

@ -4535,9 +4535,9 @@ static const EmbeddedModule embeddedModule[] =
"$oBackupManifest->numericSet(MANIFEST_SECTION_BACKUP_DB, MANIFEST_KEY_CONTROL, undef, $iControlVersion);\n"
"$oBackupManifest->numericSet(MANIFEST_SECTION_BACKUP_DB, MANIFEST_KEY_SYSTEM_ID, undef, $ullDbSysId);\n"
"\n"
"$oBackupManifest->build(storageDb({iRemoteIdx => $iRemoteIdx}),\n"
"cfgOption(cfgOptionIdFromIndex(CFGOPT_PG_PATH, $iRemoteIdx)), undef, cfgOption(CFGOPT_ONLINE),\n"
"$oDb->tablespaceMapGet());\n"
"$oBackupManifest->build(\n"
"storageDb({iRemoteIdx => $iRemoteIdx}), cfgOption(cfgOptionIdFromIndex(CFGOPT_PG_PATH, $iRemoteIdx)), undef,\n"
"cfgOptionValid(CFGOPT_ONLINE) && cfgOption(CFGOPT_ONLINE), $oDb->tablespaceMapGet());\n"
"\n"
"return true;\n"
"}\n"
@ -16713,14 +16713,9 @@ static const EmbeddedModule embeddedModule[] =
"$self->stanzaUpgrade();\n"
"}\n"
"\n"
"elsif (cfgCommandTest(CFGCMD_STANZA_DELETE))\n"
"{\n"
"$self->stanzaDelete();\n"
"}\n"
"\n"
"else\n"
"{\n"
"confess &log(ASSERT, \"stanza->process() called with invalid command: \" . cfgCommandName(cfgCommandGet()));\n"
"$self->stanzaDelete();\n"
"}\n"
"\n\n"
"return logDebugReturn\n"

View File

@ -107,15 +107,11 @@ sub run
################################################################################################################################
if ($self->begin("Stanza::process()"))
{
#---------------------------------------------------------------------------------------------------------------------------
$self->configTestLoad(CFGCMD_CHECK);
$self->optionTestSetBool(CFGOPT_ONLINE, false);
$self->configTestLoad(CFGCMD_STANZA_CREATE);
my $oStanza = new pgBackRest::Stanza();
$self->testException(sub {$oStanza->process()}, ERROR_ASSERT,
"stanza->process() called with invalid command: " . cfgCommandName(CFGCMD_CHECK));
#---------------------------------------------------------------------------------------------------------------------------
$self->configTestLoad(CFGCMD_STANZA_CREATE);
rmdir($self->{strArchivePath});
rmdir($self->{strBackupPath});
$self->testResult(sub {$oStanza->process()}, 0, 'parent paths recreated successfully');