You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-13 01:00:23 +02:00
Allow pg-path1 to be optional for synchronous archive-push.
If the WAL path is absolute then pg1-path should be optional but in fact it was required to load pg_control. Skip the pg_control check when pg1-path is not specified. The check against the stanza version/system-id remains to protect the repo from corruption.
This commit is contained in:
@ -133,7 +133,7 @@ testRun(void)
|
||||
"1={\"db-id\":5555555555555555555,\"db-version\":\"9.4\"}\n"));
|
||||
|
||||
TEST_ERROR(
|
||||
archivePushCheck(cipherTypeNone, NULL), ArchiveMismatchError,
|
||||
archivePushCheck(true, cipherTypeNone, NULL), ArchiveMismatchError,
|
||||
"PostgreSQL version 9.6, system-id 18072658121562454734 do not match stanza version 9.4, system-id 5555555555555555555"
|
||||
"\nHINT: are you archiving to the correct stanza?");
|
||||
|
||||
@ -148,7 +148,7 @@ testRun(void)
|
||||
"1={\"db-id\":5555555555555555555,\"db-version\":\"9.6\"}\n"));
|
||||
|
||||
TEST_ERROR(
|
||||
archivePushCheck(cipherTypeNone, NULL), ArchiveMismatchError,
|
||||
archivePushCheck(true, cipherTypeNone, NULL), ArchiveMismatchError,
|
||||
"PostgreSQL version 9.6, system-id 18072658121562454734 do not match stanza version 9.6, system-id 5555555555555555555"
|
||||
"\nHINT: are you archiving to the correct stanza?");
|
||||
|
||||
@ -163,7 +163,7 @@ testRun(void)
|
||||
"1={\"db-id\":18072658121562454734,\"db-version\":\"9.6\"}\n"));
|
||||
|
||||
ArchivePushCheckResult result = {0};
|
||||
TEST_ASSIGN(result, archivePushCheck(cipherTypeNone, NULL), "get archive check result");
|
||||
TEST_ASSIGN(result, archivePushCheck(true, cipherTypeNone, NULL), "get archive check result");
|
||||
|
||||
TEST_RESULT_UINT(result.pgVersion, PG_VERSION_96, "check pg version");
|
||||
TEST_RESULT_UINT(result.pgSystemId, 0xFACEFACEFACEFACE, "check pg system id");
|
||||
@ -290,12 +290,16 @@ testRun(void)
|
||||
|
||||
TEST_ERROR(cmdArchivePush(), ArchiveDuplicateError, "WAL file '000000010000000100000001' already exists in the archive");
|
||||
|
||||
// Save it to a new file instead
|
||||
argListTemp = strLstDup(argList);
|
||||
strLstAddZ(argListTemp, "pg_wal/000000010000000100000002");
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("WAL with absolute path and no pg1-path");
|
||||
|
||||
argListTemp = strLstNew();
|
||||
strLstAddZ(argListTemp, "--" CFGOPT_STANZA "=test");
|
||||
strLstAdd(argListTemp, strNewFmt("--" CFGOPT_REPO1_PATH "=%s/repo", testPath()));
|
||||
strLstAdd(argListTemp, strNewFmt("%s/pg/pg_wal/000000010000000100000002", testPath()));
|
||||
harnessCfgLoad(cfgCmdArchivePush, argListTemp);
|
||||
|
||||
storagePutP(storageNewWriteP(storagePgWrite(), strNew("pg_wal/000000010000000100000002")), walBuffer2);
|
||||
TEST_RESULT_VOID(storagePutP(storageNewWriteP(storageTest, strNew("pg/pg_wal/000000010000000100000002")), walBuffer2), "write WAL");
|
||||
|
||||
TEST_RESULT_VOID(cmdArchivePush(), "push the WAL segment");
|
||||
harnessLogResult("P00 INFO: pushed WAL file '000000010000000100000002' to the archive");
|
||||
@ -433,6 +437,18 @@ testRun(void)
|
||||
|
||||
TEST_ERROR(cmdArchivePush(), HostInvalidError, "archive-push command must be run on the PostgreSQL host");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("pg1-path must be set when async");
|
||||
|
||||
argList = strLstNew();
|
||||
strLstAddZ(argList, "--" CFGOPT_SPOOL_PATH "=/spool");
|
||||
strLstAddZ(argList, "--" CFGOPT_STANZA "=test2");
|
||||
strLstAddZ(argList, "--" CFGOPT_ARCHIVE_ASYNC);
|
||||
strLstAddZ(argList, "/000000010000000100000001");
|
||||
harnessCfgLoadRole(cfgCmdArchivePush, cfgCmdRoleAsync, argList);
|
||||
|
||||
TEST_ERROR(cmdArchivePush(), OptionRequiredError, "'archive-push' command in async mode requires option 'pg1-path'");
|
||||
|
||||
// Call with a bogus exe name so the async process will error out and we can make sure timeouts work
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
argList = strLstNew();
|
||||
|
Reference in New Issue
Block a user