Skip to content

Commit

Permalink
Allow delta option to be specified in the pgBackRest configuration file.
Browse files Browse the repository at this point in the history
This option was previously allowed on the command-line only for no particular reason that we could determine.

Being able to specify it in the config file seems like a good idea and won't change current usage.

Contributed by Cynthia Shang.
  • Loading branch information
cmwshang authored and dwsteele committed Sep 18, 2018
1 parent b6b2c91 commit bf06915
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 29 deletions.
25 changes: 13 additions & 12 deletions build/lib/pgBackRestBuild/Config/Data.pm
Expand Up @@ -695,18 +695,6 @@ my %hConfigDefine =
&CFGDEF_NEGATE => false,
},

&CFGOPT_DELTA =>
{
&CFGDEF_TYPE => CFGDEF_TYPE_BOOLEAN,
&CFGDEF_COMMAND =>
{
&CFGCMD_RESTORE =>
{
&CFGDEF_DEFAULT => false,
}
}
},

&CFGOPT_FORCE =>
{
&CFGDEF_TYPE => CFGDEF_TYPE_BOOLEAN,
Expand Down Expand Up @@ -1116,6 +1104,19 @@ my %hConfigDefine =
}
},

&CFGOPT_DELTA =>
{
&CFGDEF_SECTION => CFGDEF_SECTION_GLOBAL,
&CFGDEF_TYPE => CFGDEF_TYPE_BOOLEAN,
&CFGDEF_COMMAND =>
{
&CFGCMD_RESTORE =>
{
&CFGDEF_DEFAULT => false,
}
}
},

&CFGOPT_COMPRESS =>
{
&CFGDEF_SECTION => CFGDEF_SECTION_GLOBAL,
Expand Down
18 changes: 9 additions & 9 deletions doc/xml/reference.xml
Expand Up @@ -677,6 +677,15 @@
<example>db_main</example>
</config-key>

<!-- CONFIG - RESTORE SECTION - DELTA OPTION -->
<config-key id="delta" name="Delta">
<summary>Restore using delta.</summary>

<text>By default the <postgres/> data and tablespace directories are expected to be present but empty. This option performs a delta restore using checksums.</text>

<example>y</example>
</config-key>

<!-- CONFIG - RESTORE SECTION - LINK-ALL KEY -->
<config-key id="link-all" name="Link All">
<summary>Restore all symlinks.</summary>
Expand Down Expand Up @@ -1030,15 +1039,6 @@
<example>20150131-153358F_20150131-153401I</example>
</option>

<!-- OPERATION - RESTORE COMMAND - DELTA OPTION -->
<option id="delta" name="Delta">
<summary>Restore using delta.</summary>

<text>By default the <postgres/> data and tablespace directories are expected to be present but empty. This option performs a delta restore using checksums.</text>

<example>y</example>
</option>

<!-- OPERATION - RESTORE COMMAND - FORCE OPTION -->
<option id="force" name="Force">
<summary>Force a restore.</summary>
Expand Down
8 changes: 8 additions & 0 deletions doc/xml/release.xml
Expand Up @@ -45,6 +45,14 @@
<release-item>
<p>Improve support for special characters in filenames.</p>
</release-item>

<release-item>
<release-item-contributor-list>
<release-item-contributor id="cynthia.shang"/>
</release-item-contributor-list>

<p>Allow <br-option>delta</br-option> option to be specified in the <backrest/> configuration file.</p>
</release-item>
</release-improvement-list>

<release-development-list>
Expand Down
17 changes: 9 additions & 8 deletions src/config/define.auto.c
Expand Up @@ -974,13 +974,21 @@ static ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
(
CFGDEFDATA_OPTION_NAME("delta")
CFGDEFDATA_OPTION_REQUIRED(true)
CFGDEFDATA_OPTION_SECTION(cfgDefSectionCommandLine)
CFGDEFDATA_OPTION_SECTION(cfgDefSectionGlobal)
CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeBoolean)
CFGDEFDATA_OPTION_INTERNAL(false)

CFGDEFDATA_OPTION_INDEX_TOTAL(1)
CFGDEFDATA_OPTION_SECURE(false)

CFGDEFDATA_OPTION_HELP_SECTION("restore")
CFGDEFDATA_OPTION_HELP_SUMMARY("Restore using delta.")
CFGDEFDATA_OPTION_HELP_DESCRIPTION
(
"By default the PostgreSQL data and tablespace directories are expected to be present but empty. This option performs "
"a delta restore using checksums."
)

CFGDEFDATA_OPTION_COMMAND_LIST
(
CFGDEFDATA_OPTION_COMMAND(cfgDefCmdRestore)
Expand All @@ -993,13 +1001,6 @@ static ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST
CFGDEFDATA_OPTION_OPTIONAL_COMMAND(cfgDefCmdRestore)

CFGDEFDATA_OPTION_OPTIONAL_DEFAULT("0")

CFGDEFDATA_OPTION_OPTIONAL_HELP_SUMMARY("Restore using delta.")
CFGDEFDATA_OPTION_OPTIONAL_HELP_DESCRIPTION
(
"By default the PostgreSQL data and tablespace directories are expected to be present but empty. This option "
"performs a delta restore using checksums."
)
)
)
)
Expand Down
8 changes: 8 additions & 0 deletions src/config/parse.auto.c
Expand Up @@ -258,6 +258,14 @@ static const struct option optionList[] =
.name = "delta",
.val = PARSE_OPTION_FLAG | cfgOptDelta,
},
{
.name = "no-delta",
.val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDelta,
},
{
.name = "reset-delta",
.val = PARSE_OPTION_FLAG | PARSE_RESET_FLAG | cfgOptDelta,
},

// exclude option
// -----------------------------------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit bf06915

Please sign in to comment.