1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-18 04:58:51 +02:00

Add ClockError for unexpected clock skew and timezone changes.

A distinct result code should help debugging of clock skew and timezone issues.
This commit is contained in:
David Steele 2022-05-05 10:19:11 -04:00 committed by GitHub
parent b6bfd9f99d
commit 5f8c9cd66a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 3 deletions

View File

@ -184,6 +184,19 @@
<p>Add hint to check the log on <cmd>archive-get</cmd>/<cmd>archive-push</cmd> async error.</p>
</release-item>
<release-item>
<github-pull-request id="1739"/>
<release-item-contributor-list>
<release-item-ideator id="greg.sabino.mullane"/>
<release-item-contributor id="david.steele"/>
<release-item-reviewer id="greg.sabino.mullane"/>
<release-item-reviewer id="stefan.fercot"/>
</release-item-contributor-list>
<p>Add <code>ClockError</code> for unexpected clock skew and timezone changes.</p>
</release-item>
<release-item>
<github-pull-request id="1738"/>

View File

@ -109,6 +109,9 @@ command: 104
# Unable to authenticate or authorize
access: 105
# Unexpected clock skew or timezone change
clock: 106
# This error should not be thrown directly -- it serves as a parent for the C errors
runtime: 122

View File

@ -112,7 +112,7 @@ backupLabelCreate(BackupType type, const String *backupLabelPrior, time_t timest
if (strCmp(result, backupLabelLatest) <= 0)
{
THROW_FMT(
FormatError,
ClockError,
"new backup label '%s' is not later than latest backup label '%s'\n"
"HINT: has the timezone changed?\n"
"HINT: is there clock skew?",

View File

@ -86,6 +86,7 @@ ERROR_DEFINE(102, ExecuteError, false, RuntimeError);
ERROR_DEFINE(103, RepoInvalidError, false, RuntimeError);
ERROR_DEFINE(104, CommandError, false, RuntimeError);
ERROR_DEFINE(105, AccessError, false, RuntimeError);
ERROR_DEFINE(106, ClockError, false, RuntimeError);
ERROR_DEFINE(122, RuntimeError, false, RuntimeError);
ERROR_DEFINE(123, InvalidError, false, RuntimeError);
ERROR_DEFINE(124, UnhandledError, false, RuntimeError);
@ -175,6 +176,7 @@ static const ErrorType *errorTypeList[] =
&RepoInvalidError,
&CommandError,
&AccessError,
&ClockError,
&RuntimeError,
&InvalidError,
&UnhandledError,

View File

@ -88,6 +88,7 @@ ERROR_DECLARE(ExecuteError);
ERROR_DECLARE(RepoInvalidError);
ERROR_DECLARE(CommandError);
ERROR_DECLARE(AccessError);
ERROR_DECLARE(ClockError);
ERROR_DECLARE(RuntimeError);
ERROR_DECLARE(InvalidError);
ERROR_DECLARE(UnhandledError);

View File

@ -1458,7 +1458,7 @@ testRun(void)
strNewFmt(STORAGE_REPO_BACKUP "/%s", strZ(backupLabelFormat(backupTypeFull, NULL, timestamp + 1)))));
TEST_ERROR(
backupLabelCreate(backupTypeFull, NULL, timestamp), FormatError,
backupLabelCreate(backupTypeFull, NULL, timestamp), ClockError,
"new backup label '20191203-193413F' is not later than latest backup label '20191203-193413F'\n"
"HINT: has the timezone changed?\n"
"HINT: is there clock skew?");
@ -1472,7 +1472,7 @@ testRun(void)
strZ(backupLabelFormat(backupTypeFull, NULL, timestamp + 3600)))));
TEST_ERROR(
backupLabelCreate(backupTypeFull, NULL, timestamp), FormatError,
backupLabelCreate(backupTypeFull, NULL, timestamp), ClockError,
"new backup label '20191203-193413F' is not later than latest backup label '20191203-203412F'\n"
"HINT: has the timezone changed?\n"
"HINT: is there clock skew?");