You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-15 01:04:37 +02:00
Move not found error into walSegmentFind().
This error is also needed in backup so move it here to centralize it.
This commit is contained in:
@ -371,6 +371,16 @@ walSegmentFind(const Storage *storage, const String *archiveId, const String *wa
|
|||||||
}
|
}
|
||||||
MEM_CONTEXT_TEMP_END();
|
MEM_CONTEXT_TEMP_END();
|
||||||
|
|
||||||
|
if (result == NULL && timeout != 0)
|
||||||
|
{
|
||||||
|
THROW_FMT(
|
||||||
|
ArchiveTimeoutError,
|
||||||
|
"WAL segment %s was not archived before the %" PRIu64 "ms timeout\n"
|
||||||
|
"HINT: check the archive_command to ensure that all options are correct (especially --stanza).\n"
|
||||||
|
"HINT: check the PostgreSQL server log for errors.",
|
||||||
|
strPtr(walSegment), timeout);
|
||||||
|
}
|
||||||
|
|
||||||
FUNCTION_LOG_RETURN(STRING, result);
|
FUNCTION_LOG_RETURN(STRING, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,23 +135,11 @@ checkPrimary(const DbGetResult dbGroup)
|
|||||||
TimeMSec archiveTimeout = (TimeMSec)(cfgOptionDbl(cfgOptArchiveTimeout) * MSEC_PER_SEC);
|
TimeMSec archiveTimeout = (TimeMSec)(cfgOptionDbl(cfgOptArchiveTimeout) * MSEC_PER_SEC);
|
||||||
const String *walSegmentFile = walSegmentFind(storageRepo(), archiveId, walSegment, archiveTimeout);
|
const String *walSegmentFile = walSegmentFind(storageRepo(), archiveId, walSegment, archiveTimeout);
|
||||||
|
|
||||||
if (walSegmentFile != NULL)
|
|
||||||
{
|
|
||||||
LOG_INFO_FMT(
|
LOG_INFO_FMT(
|
||||||
"WAL segment %s successfully archived to '%s'", strPtr(walSegment),
|
"WAL segment %s successfully archived to '%s'", strPtr(walSegment),
|
||||||
strPtr(storagePathP(storageRepo(), strNewFmt(STORAGE_REPO_ARCHIVE "/%s/%s", strPtr(archiveId),
|
strPtr(storagePathP(storageRepo(), strNewFmt(STORAGE_REPO_ARCHIVE "/%s/%s", strPtr(archiveId),
|
||||||
strPtr(walSegmentFile)))));
|
strPtr(walSegmentFile)))));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
THROW_FMT(
|
|
||||||
ArchiveTimeoutError,
|
|
||||||
"WAL segment %s was not archived before the %" PRIu64 "ms timeout\n"
|
|
||||||
"HINT: check the archive_command to ensure that all options are correct (especially --stanza).\n"
|
|
||||||
"HINT: check the PostgreSQL server log for errors.",
|
|
||||||
strPtr(walSegment), archiveTimeout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FUNCTION_LOG_RETURN_VOID();
|
FUNCTION_LOG_RETURN_VOID();
|
||||||
}
|
}
|
||||||
|
@ -221,9 +221,11 @@ testRun(void)
|
|||||||
|
|
||||||
storagePathCreateP(storageTest, strNew("archive/db/9.6-2/1234567812345678"));
|
storagePathCreateP(storageTest, strNew("archive/db/9.6-2/1234567812345678"));
|
||||||
TEST_RESULT_PTR(walSegmentFind(storageRepo(), strNew("9.6-2"), strNew("123456781234567812345678"), 0), NULL, "no segment");
|
TEST_RESULT_PTR(walSegmentFind(storageRepo(), strNew("9.6-2"), strNew("123456781234567812345678"), 0), NULL, "no segment");
|
||||||
TEST_RESULT_PTR(
|
TEST_ERROR(
|
||||||
walSegmentFind(storageRepo(), strNew("9.6-2"), strNew("123456781234567812345678"), 500), NULL,
|
walSegmentFind(storageRepo(), strNew("9.6-2"), strNew("123456781234567812345678"), 100), ArchiveTimeoutError,
|
||||||
"no segment after 500ms");
|
"WAL segment 123456781234567812345678 was not archived before the 100ms timeout\n"
|
||||||
|
"HINT: check the archive_command to ensure that all options are correct (especially --stanza).\n"
|
||||||
|
"HINT: check the PostgreSQL server log for errors.");
|
||||||
|
|
||||||
// Check timeout by making the wal segment appear after 250ms
|
// Check timeout by making the wal segment appear after 250ms
|
||||||
HARNESS_FORK_BEGIN()
|
HARNESS_FORK_BEGIN()
|
||||||
|
Reference in New Issue
Block a user