mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-03-03 14:52:21 +02:00
The expire command now checks if a stop file is present.
This check has always been missing but it was not noticed because expire is not usually run independently of backup, which does the check correctly.
This commit is contained in:
parent
a5b2630d7c
commit
483838233f
@ -14,6 +14,16 @@
|
||||
<release-list>
|
||||
<release date="XXXX-XX-XX" version="2.27dev" title="UNDER DEVELOPMENT">
|
||||
<release-core-list>
|
||||
<release-bug-list>
|
||||
<release-item>
|
||||
<release-item-contributor-list>
|
||||
<release-item-contributor id="cynthia.shang"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>The <cmd>expire</cmd> command now checks if a stop file is present.</p>
|
||||
</release-item>
|
||||
</release-bug-list>
|
||||
|
||||
<release-feature-list>
|
||||
<release-item>
|
||||
<release-item-contributor-list>
|
||||
|
@ -5,6 +5,7 @@ Expire Command
|
||||
|
||||
#include "command/archive/common.h"
|
||||
#include "command/backup/common.h"
|
||||
#include "command/control/common.h"
|
||||
#include "common/type/list.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/regExp.h"
|
||||
@ -644,6 +645,9 @@ cmdExpire(void)
|
||||
// Verify the repo is local
|
||||
repoIsLocalVerify();
|
||||
|
||||
// Test for stop file
|
||||
lockStopTest();
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
{
|
||||
// Load the backup.info
|
||||
|
@ -489,6 +489,21 @@ testRun(void)
|
||||
TEST_ERROR_FMT(
|
||||
cmdExpire(), HostInvalidError, "expire command must be run on the repository host");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("check stop file");
|
||||
|
||||
argList = strLstDup(argListAvoidWarn);
|
||||
harnessCfgLoad(cfgCmdExpire, argList);
|
||||
|
||||
// Create the stop file
|
||||
TEST_RESULT_VOID(
|
||||
storagePutP(
|
||||
storageNewWriteP(storageLocalWrite(), lockStopFileName(cfgOptionStr(cfgOptStanza))), BUFSTRDEF("")),
|
||||
"create stop file");
|
||||
TEST_ERROR_FMT(cmdExpire(), StopError, "stop file exists for stanza db");
|
||||
TEST_RESULT_VOID(
|
||||
storageRemoveP(storageLocalWrite(), lockStopFileName(cfgOptionStr(cfgOptStanza))), "remove the stop file");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("retention-archive not set");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user