mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-18 04:58:51 +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:
parent
1378d9c58b
commit
81295fd388
@ -371,6 +371,16 @@ walSegmentFind(const Storage *storage, const String *archiveId, const String *wa
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -135,22 +135,10 @@ checkPrimary(const DbGetResult dbGroup)
|
||||
TimeMSec archiveTimeout = (TimeMSec)(cfgOptionDbl(cfgOptArchiveTimeout) * MSEC_PER_SEC);
|
||||
const String *walSegmentFile = walSegmentFind(storageRepo(), archiveId, walSegment, archiveTimeout);
|
||||
|
||||
if (walSegmentFile != NULL)
|
||||
{
|
||||
LOG_INFO_FMT(
|
||||
"WAL segment %s successfully archived to '%s'", strPtr(walSegment),
|
||||
strPtr(storagePathP(storageRepo(), strNewFmt(STORAGE_REPO_ARCHIVE "/%s/%s", strPtr(archiveId),
|
||||
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);
|
||||
}
|
||||
LOG_INFO_FMT(
|
||||
"WAL segment %s successfully archived to '%s'", strPtr(walSegment),
|
||||
strPtr(storagePathP(storageRepo(), strNewFmt(STORAGE_REPO_ARCHIVE "/%s/%s", strPtr(archiveId),
|
||||
strPtr(walSegmentFile)))));
|
||||
}
|
||||
|
||||
FUNCTION_LOG_RETURN_VOID();
|
||||
|
@ -221,9 +221,11 @@ testRun(void)
|
||||
|
||||
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"), 500), NULL,
|
||||
"no segment after 500ms");
|
||||
TEST_ERROR(
|
||||
walSegmentFind(storageRepo(), strNew("9.6-2"), strNew("123456781234567812345678"), 100), ArchiveTimeoutError,
|
||||
"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
|
||||
HARNESS_FORK_BEGIN()
|
||||
|
Loading…
x
Reference in New Issue
Block a user