pgbackrest.git / summary / log / commit / refs
commit 9efd5cd0bb40c5dc2fcac2e21c9b62e554b94db6
Author: David Steele <david@pgmasters.net>
Commit: GitHub <noreply@github.com>
Date: Thu Jul 06 16:46:31 2023 +0000
Add timezone offset to info command date/time output.
This makes it easier to use timestamps from the info command directly in PostgreSQL recovery settings, especially the --target option.
.cirrus.yml | 3 +-
doc/xml/release.xml | 19 +++++++
src/command/info/info.c | 64 +++++++++++++++++-----
test/src/module/command/infoTest.c | 106 ++++++++++++++++++++++++-------------
4 files changed, 141 insertions(+), 51 deletions(-)
diff --git a/.cirrus.yml b/.cirrus.yml
index 17676e33a..d8b443681 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -76,7 +76,8 @@ macos_ventura_task:
- brew install -q pkg-config openssl@1.1 libpq libxml2 libyaml meson
script:
- - cd .. && ${CIRRUS_WORKING_DIR}/test/test.pl --min-gen --vm-max=2 --no-coverage --no-valgrind --module=command --test=backup
+ - cd ..
+ - ${CIRRUS_WORKING_DIR}/test/test.pl --min-gen --vm-max=2 --no-coverage --no-valgrind --module=command --test=backup --test=info
debug_script:
- ls -lah ${CIRRUS_WORKING_DIR}
diff --git a/doc/xml/release.xml b/doc/xml/release.xml
index b0d4e9a0b..03029fef3 100644
--- a/doc/xml/release.xml
+++ b/doc/xml/release.xml
@@ -56,6 +56,20 @@
</release-bug-list>
<release-improvement-list>
+ <release-item>
+ <github-issue id="2093"/>
+ <github-pull-request id="2095"/>
+
+ <release-item-contributor-list>
+ <release-item-ideator id="philip.hurst"/>
+ <release-item-contributor id="david.steele"/>
+ <release-item-reviewer id="stefan.fercot"/>
+ <release-item-reviewer id="philip.hurst"/>
+ </release-item-contributor-list>
+
+ <p>Add timezone offset to <cmd>info</cmd> command date/time output.</p>
+ </release-item>
+
<release-item>
<commit subject="Refactor allow list processing in config/parse module."/>
<commit subject="Centralize error handling for unsupported features.">
@@ -12923,6 +12937,11 @@
<contributor-id type="github">psuderevsky</contributor-id>
</contributor>
+ <contributor id="philip.hurst">
+ <contributor-name-display>Philip Hurst</contributor-name-display>
+ <contributor-id type="github">philrhurst</contributor-id>
+ </contributor>
+
<contributor id="pierre.ducroquet">
<contributor-name-display>Pierre Ducroquet</contributor-name-display>
<contributor-id type="github">PierreDucroquet</contributor-id>
diff --git a/src/command/info/info.c b/src/command/info/info.c
index 9754ce095..3ce2b2fa2 100644
--- a/src/command/info/info.c
+++ b/src/command/info/info.c
@@ -815,6 +815,51 @@ stanzaInfoList(List *stanzaRepoList, const String *const backupLabel, const unsi
/***********************************************************************************************************************************
Format the text output for archive and backups for a database group of a stanza
***********************************************************************************************************************************/
+// Helper to format date/time with timezone offset
+static String *
+formatTextBackupDateTime(const time_t epoch)
+{
+ FUNCTION_TEST_BEGIN();
+ FUNCTION_TEST_PARAM(TIME, epoch);
+ FUNCTION_TEST_END();
+
+ // Construct date/time
+ String *const result = strNew();
+ struct tm timePart;
+ char timeBuffer[20];
+
+ strftime(timeBuffer, sizeof(timeBuffer), "%Y-%m-%d %H:%M:%S", localtime_r(&epoch, &timePart));
+ strCatZ(result, timeBuffer);
+
+ // Add timezone offset. Since this is not directly available in Posix-compliant APIs, use the difference between gmtime_r() and
+ // localtime_r to determine the offset. Handle minute offsets when present.
+ struct tm timePartGm;
+
+ gmtime_r(&epoch, &timePartGm);
+
+ timePart.tm_isdst = -1;
+ timePartGm.tm_isdst = -1;
+ time_t offset = mktime(&timePart) - mktime(&timePartGm);
+
+ if (offset >= 0)
+ strCatChr(result, '+');
+ else
+ {
+ offset *= -1;
+ strCatChr(result, '-');
+ }
+
+ const unsigned int minute = (unsigned int)offset / 60;
+ const unsigned int hour = minute / 60;
+
+ strCatFmt(result, "%02u", hour);
+
+ if (minute % 60 != 0)
+ strCatFmt(result, ":%02u", minute - (hour * 60));
+
+ FUNCTION_TEST_RETURN(STRING, result);
+}
+
static void
formatTextBackup(const DbGroup *dbGroup, String *resultStr)
{
@@ -843,21 +888,16 @@ formatTextBackup(const DbGroup *dbGroup, String *resultStr)
resultStr, "\n %s backup: %s\n", strZ(varStr(kvGet(backupInfo, BACKUP_KEY_TYPE_VAR))),
strZ(varStr(kvGet(backupInfo, BACKUP_KEY_LABEL_VAR))));
- // Get and format the backup start/stop time
- KeyValue *timestampInfo = varKv(kvGet(backupInfo, BACKUP_KEY_TIMESTAMP_VAR));
-
- struct tm timePart;
- char timeBufferStart[20];
- char timeBufferStop[20];
- time_t timeStart = (time_t)varUInt64(kvGet(timestampInfo, KEY_START_VAR));
- time_t timeStop = (time_t)varUInt64(kvGet(timestampInfo, KEY_STOP_VAR));
+ // Get and format backup start/stop time
+ const KeyValue *const timestampInfo = varKv(kvGet(backupInfo, BACKUP_KEY_TIMESTAMP_VAR));
- strftime(timeBufferStart, sizeof(timeBufferStart), "%Y-%m-%d %H:%M:%S", localtime_r(&timeStart, &timePart));
- strftime(timeBufferStop, sizeof(timeBufferStop), "%Y-%m-%d %H:%M:%S", localtime_r(&timeStop, &timePart));
-
- strCatFmt(resultStr, " timestamp start/stop: %s / %s\n", timeBufferStart, timeBufferStop);
+ strCatFmt(
+ resultStr, " timestamp start/stop: %s / %s\n",
+ strZ(formatTextBackupDateTime((time_t)varUInt64(kvGet(timestampInfo, KEY_START_VAR)))),
+ strZ(formatTextBackupDateTime((time_t)varUInt64(kvGet(timestampInfo, KEY_STOP_VAR)))));
strCatZ(resultStr, " wal start/stop: ");
+ // Get and format WAL start/stop
KeyValue *archiveBackupInfo = varKv(kvGet(backupInfo, KEY_ARCHIVE_VAR));
if (kvGet(archiveBackupInfo, KEY_START_VAR) != NULL && kvGet(archiveBackupInfo, KEY_STOP_VAR) != NULL)
diff --git a/test/src/module/command/infoTest.c b/test/src/module/command/infoTest.c
index f5a82baa7..86b2bd088 100644
--- a/test/src/module/command/infoTest.c
+++ b/test/src/module/command/infoTest.c
@@ -600,13 +600,13 @@ testRun(void)
" wal archive min/max (9.4): 000000010000000000000002/000000030000000000000001\n"
"\n"
" full backup: 20181116-154756F\n"
- " timestamp start/stop: 2018-11-16 15:47:56 / 2018-11-16 15:48:09\n"
+ " timestamp start/stop: 2018-11-16 15:47:56+00 / 2018-11-16 15:48:09+00\n"
" wal start/stop: n/a\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo1: backup set size: 3MB, backup size: 3KB\n"
"\n"
" full backup: 20201116-154900F\n"
- " timestamp start/stop: 2020-11-16 15:47:56 / 2020-11-16 15:48:00\n"
+ " timestamp start/stop: 2020-11-16 15:47:56+00 / 2020-11-16 15:48:00+00\n"
" wal start/stop: 000000030000000000000001 / 000000030000000000000001\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo1: backup set size: 3MB, backup size: 3KB\n",
@@ -1494,20 +1494,20 @@ testRun(void)
" wal archive min/max (9.4): 000000010000000000000002/000000020000000000000003\n"
"\n"
" full backup: 20181119-152138F\n"
- " timestamp start/stop: 2018-11-19 15:21:38 / 2018-11-19 15:21:39\n"
+ " timestamp start/stop: 2018-11-19 15:21:38+00 / 2018-11-19 15:21:39+00\n"
" wal start/stop: 000000010000000000000002 / 000000010000000000000002\n"
" database size: 19.2MB, database backup size: 19.2MB\n"
" repo1: backup set size: 2.3MB, backup size: 2.3MB\n"
"\n"
" diff backup: 20181119-152138F_20181119-152152D\n"
- " timestamp start/stop: 2018-11-19 15:21:52 / 2018-11-19 15:21:55\n"
+ " timestamp start/stop: 2018-11-19 15:21:52+00 / 2018-11-19 15:21:55+00\n"
" wal start/stop: 000000010000000000000003 / 000000020000000000000003\n"
" database size: 19.2MB, database backup size: 8.2KB\n"
" repo1: backup set size: 2.3MB, backup size: 346B\n"
" backup reference list: 20181119-152138F\n"
"\n"
" incr backup: 20181119-152138F_20181119-152155I\n"
- " timestamp start/stop: 2018-11-19 15:21:55 / 2018-11-19 15:21:57\n"
+ " timestamp start/stop: 2018-11-19 15:21:55+00 / 2018-11-19 15:21:57+00\n"
" wal start/stop: n/a\n"
" database size: 19.2MB, database backup size: 8.2KB\n"
" repo1: backup set size: 2.3MB, backup size: 346B\n"
@@ -1517,20 +1517,20 @@ testRun(void)
" wal archive min/max (9.5): 000000010000000000000002/000000010000000000000005\n"
"\n"
" full backup: 20201116-155000F\n"
- " timestamp start/stop: 2020-11-16 15:50:00 / 2020-11-16 15:50:02\n"
+ " timestamp start/stop: 2020-11-16 15:50:00+00 / 2020-11-16 15:50:02+00\n"
" wal start/stop: 000000010000000000000002 / 000000010000000000000003\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo1: backup set size: 3MB, backup size: 3KB\n"
"\n"
" full backup: 20201116-200000F\n"
- " timestamp start/stop: 2020-11-16 20:00:00 / 2020-11-16 20:00:05\n"
+ " timestamp start/stop: 2020-11-16 20:00:00+00 / 2020-11-16 20:00:05+00\n"
" wal start/stop: 000000010000000000000004 / 000000010000000000000004\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo2: backup set size: 3MB, backup size: 3KB\n"
" error(s) detected during backup\n"
"\n"
" incr backup: 20201116-155000F_20201119-152100I\n"
- " timestamp start/stop: 2020-11-19 15:21:00 / 2020-11-19 15:21:03\n"
+ " timestamp start/stop: 2020-11-19 15:21:00+00 / 2020-11-19 15:21:03+00\n"
" wal start/stop: 000000010000000000000005 / 000000010000000000000005\n"
" database size: 19.2MB, database backup size: 8.2KB\n"
" repo1: backup size: 346B\n"
@@ -1559,7 +1559,7 @@ testRun(void)
" wal archive min/max (9.4): 000000010000000000000001/000000010000000000000002\n"
"\n"
" full backup: 20201110-100000F\n"
- " timestamp start/stop: 2020-11-10 10:00:00 / 2020-11-10 10:00:02\n"
+ " timestamp start/stop: 2020-11-10 10:00:00+00 / 2020-11-10 10:00:02+00\n"
" wal start/stop: 000000010000000000000001 / 000000010000000000000002\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo2: backup set size: 3MB, backup size: 3KB\n",
@@ -1639,6 +1639,9 @@ testRun(void)
hrnCfgArgRawZ(argList2, cfgOptRepo, "1");
HRN_CFG_LOAD(cfgCmdInfo, argList2);
+ // Switch to America/New_York to test + timezone offset without minutes
+ setenv("TZ", "America/New_York", true);
+
TEST_RESULT_STR_Z(
infoRender(),
"stanza: stanza1\n"
@@ -1649,7 +1652,7 @@ testRun(void)
" wal archive min/max (9.4): 000000010000000000000002/000000020000000000000003\n"
"\n"
" incr backup: 20181119-152138F_20181119-152155I\n"
- " timestamp start/stop: 2018-11-19 15:21:55 / 2018-11-19 15:21:57\n"
+ " timestamp start/stop: 2018-11-19 10:21:55-05 / 2018-11-19 10:21:57-05\n"
" wal start/stop: n/a\n"
" lsn start/stop: 285/89000028 / 285/89001F88\n"
" database size: 19.2MB, database backup size: 8.2KB\n"
@@ -1665,6 +1668,9 @@ testRun(void)
" error list: base/16384/17000\n",
"text - backup set requested");
+ // Reset timezone
+ setenv("TZ", "UTC", true);
+
hrnCfgArgRawZ(argList2, cfgOptOutput, "json");
HRN_CFG_LOAD(cfgCmdInfo, argList2);
@@ -1796,7 +1802,7 @@ testRun(void)
" wal archive min/max (9.4): 000000010000000000000002/000000020000000000000003\n"
"\n"
" full backup: 20181119-152138F\n"
- " timestamp start/stop: 2018-11-19 15:21:38 / 2018-11-19 15:21:39\n"
+ " timestamp start/stop: 2018-11-19 15:21:38+00 / 2018-11-19 15:21:39+00\n"
" wal start/stop: 000000010000000000000002 / 000000010000000000000002\n"
" database size: 19.2MB, database backup size: 19.2MB\n"
" repo1: backup set size: 2.3MB, backup size: 2.3MB\n"
@@ -1805,13 +1811,13 @@ testRun(void)
" wal archive min/max (9.5): 000000010000000000000002/000000010000000000000005\n"
"\n"
" full backup: 20201116-155000F\n"
- " timestamp start/stop: 2020-11-16 15:50:00 / 2020-11-16 15:50:02\n"
+ " timestamp start/stop: 2020-11-16 15:50:00+00 / 2020-11-16 15:50:02+00\n"
" wal start/stop: 000000010000000000000002 / 000000010000000000000003\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo1: backup set size: 3MB, backup size: 3KB\n"
"\n"
" full backup: 20201116-200000F\n"
- " timestamp start/stop: 2020-11-16 20:00:00 / 2020-11-16 20:00:05\n"
+ " timestamp start/stop: 2020-11-16 20:00:00+00 / 2020-11-16 20:00:05+00\n"
" wal start/stop: 000000010000000000000004 / 000000010000000000000004\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo2: backup set size: 3MB, backup size: 3KB\n"
@@ -1826,6 +1832,9 @@ testRun(void)
hrnCfgArgRawZ(argList2, cfgOptSet, "20201116-200000F");
HRN_CFG_LOAD(cfgCmdInfo, argList2);
+ // Switch to Asia/Kolkata to test - timezone offset with 30 minutes
+ setenv("TZ", "Asia/Kolkata", true);
+
TEST_RESULT_STR_Z(
infoRender(),
"stanza: stanza1\n"
@@ -1838,7 +1847,7 @@ testRun(void)
" wal archive min/max (9.5): 000000010000000000000002/000000010000000000000005\n"
"\n"
" full backup: 20201116-200000F\n"
- " timestamp start/stop: 2020-11-16 20:00:00 / 2020-11-16 20:00:05\n"
+ " timestamp start/stop: 2020-11-17 01:30:00+05:30 / 2020-11-17 01:30:05+05:30\n"
" wal start/stop: 000000010000000000000004 / 000000010000000000000004\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo2: backup set size: 3MB, backup size: 3KB\n"
@@ -1852,6 +1861,9 @@ testRun(void)
" error list: base/16384/17000\n",
"text - multi-repo, backup set requested, found on repo2, report stanza and db over all repos");
+ // Reset timezone
+ setenv("TZ", "UTC", true);
+
hrnCfgArgRawZ(argList2, cfgOptOutput, "json");
HRN_CFG_LOAD(cfgCmdInfo, argList2);
@@ -2031,6 +2043,9 @@ testRun(void)
TEST_MANIFEST_PATH_DEFAULT,
.comment = "write manifest with checksum errors and no links");
+ // Switch to Pacific/Chatham to test + timezone offset with 45 minutes
+ setenv("TZ", "Pacific/Chatham", true);
+
TEST_RESULT_STR_Z(
infoRender(),
"stanza: stanza1\n"
@@ -2041,7 +2056,7 @@ testRun(void)
" wal archive min/max (9.4): 000000010000000000000002/000000020000000000000003\n"
"\n"
" incr backup: 20181119-152138F_20181119-152155I\n"
- " timestamp start/stop: 2018-11-19 15:21:55 / 2018-11-19 15:21:57\n"
+ " timestamp start/stop: 2018-11-20 05:06:55+13:45 / 2018-11-20 05:06:57+13:45\n"
" wal start/stop: n/a\n"
" lsn start/stop: 285/89000028 / 285/89001F88\n"
" database size: 19.2MB, database backup size: 8.2KB\n"
@@ -2051,6 +2066,9 @@ testRun(void)
" error list: base/16384/17000, base/32768/33000\n",
"text - backup set requested, no links");
+ // Reset timezone
+ setenv("TZ", "UTC", true);
+
hrnCfgArgRawZ(argList2, cfgOptOutput, "json");
HRN_CFG_LOAD(cfgCmdInfo, argList2);
@@ -2203,6 +2221,9 @@ testRun(void)
TEST_MANIFEST_PATH_DEFAULT,
.comment = " rewrite same manifest without checksum errors");
+ // Switch to America/St_Johns to test - timezone offset with 30 minutes
+ setenv("TZ", "America/St_Johns", true);
+
TEST_RESULT_STR_Z(
infoRender(),
"stanza: stanza1\n"
@@ -2213,7 +2234,7 @@ testRun(void)
" wal archive min/max (9.4): 000000010000000000000002/000000020000000000000003\n"
"\n"
" incr backup: 20181119-152138F_20181119-152155I\n"
- " timestamp start/stop: 2018-11-19 15:21:55 / 2018-11-19 15:21:57\n"
+ " timestamp start/stop: 2018-11-19 11:51:55-03:30 / 2018-11-19 11:51:57-03:30\n"
" wal start/stop: n/a\n"
" lsn start/stop: 285/89000028 / 285/89001F88\n"
" database size: 19.2MB, database backup size: 8.2KB\n"
@@ -2222,6 +2243,9 @@ testRun(void)
" database list: none\n",
"text - backup set requested, no db and no checksum error");
+ // Reset timezone
+ setenv("TZ", "UTC", true);
+
hrnCfgArgRawZ(argList2, cfgOptOutput, "json");
HRN_CFG_LOAD(cfgCmdInfo, argList2);
@@ -2356,7 +2380,7 @@ testRun(void)
" wal archive min/max (9.5): 000000010000000000000002/000000010000000000000005\n"
"\n"
" incr backup: 20201116-155000F_20201119-152100I\n"
- " timestamp start/stop: 2020-11-19 15:21:00 / 2020-11-19 15:21:03\n"
+ " timestamp start/stop: 2020-11-19 15:21:00+00 / 2020-11-19 15:21:03+00\n"
" wal start/stop: 000000010000000000000005 / 000000010000000000000005\n"
" database size: 19.2MB, database backup size: 8.2KB\n"
" repo1: backup size: 346B\n"
@@ -2488,20 +2512,20 @@ testRun(void)
" wal archive min/max (9.4): 000000010000000000000002/000000020000000000000003\n"
"\n"
" full backup: 20181119-152138F\n"
- " timestamp start/stop: 2018-11-19 15:21:38 / 2018-11-19 15:21:39\n"
+ " timestamp start/stop: 2018-11-19 15:21:38+00 / 2018-11-19 15:21:39+00\n"
" wal start/stop: 000000010000000000000002 / 000000010000000000000002\n"
" database size: 19.2MB, database backup size: 19.2MB\n"
" repo1: backup set size: 2.3MB, backup size: 2.3MB\n"
"\n"
" diff backup: 20181119-152138F_20181119-152152D\n"
- " timestamp start/stop: 2018-11-19 15:21:52 / 2018-11-19 15:21:55\n"
+ " timestamp start/stop: 2018-11-19 15:21:52+00 / 2018-11-19 15:21:55+00\n"
" wal start/stop: 000000010000000000000003 / 000000020000000000000003\n"
" database size: 19.2MB, database backup size: 8.2KB\n"
" repo1: backup set size: 2.3MB, backup size: 346B\n"
" backup reference list: 20181119-152138F\n"
"\n"
" incr backup: 20181119-152138F_20181119-152155I\n"
- " timestamp start/stop: 2018-11-19 15:21:55 / 2018-11-19 15:21:57\n"
+ " timestamp start/stop: 2018-11-19 15:21:55+00 / 2018-11-19 15:21:57+00\n"
" wal start/stop: n/a\n"
" database size: 19.2MB, database backup size: 8.2KB\n"
" repo1: backup set size: 2.3MB, backup size: 346B\n"
@@ -2511,13 +2535,13 @@ testRun(void)
" wal archive min/max (9.5): 000000010000000000000002/000000010000000000000005\n"
"\n"
" full backup: 20201116-155000F\n"
- " timestamp start/stop: 2020-11-16 15:50:00 / 2020-11-16 15:50:02\n"
+ " timestamp start/stop: 2020-11-16 15:50:00+00 / 2020-11-16 15:50:02+00\n"
" wal start/stop: 000000010000000000000002 / 000000010000000000000003\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo1: backup set size: 3MB, backup size: 3KB\n"
"\n"
" incr backup: 20201116-155000F_20201119-152100I\n"
- " timestamp start/stop: 2020-11-19 15:21:00 / 2020-11-19 15:21:03\n"
+ " timestamp start/stop: 2020-11-19 15:21:00+00 / 2020-11-19 15:21:03+00\n"
" wal start/stop: 000000010000000000000005 / 000000010000000000000005\n"
" database size: 19.2MB, database backup size: 8.2KB\n"
" repo1: backup size: 346B\n"
@@ -2545,20 +2569,20 @@ testRun(void)
" wal archive min/max (9.4): none present\n"
"\n"
" full backup: 20181119-152138F\n"
- " timestamp start/stop: 2018-11-19 15:21:38 / 2018-11-19 15:21:39\n"
+ " timestamp start/stop: 2018-11-19 15:21:38+00 / 2018-11-19 15:21:39+00\n"
" wal start/stop: 000000010000000000000002 / 000000010000000000000002\n"
" database size: 19.2MB, database backup size: 19.2MB\n"
" repo1: backup set size: 2.3MB, backup size: 2.3MB\n"
"\n"
" diff backup: 20181119-152138F_20181119-152152D\n"
- " timestamp start/stop: 2018-11-19 15:21:52 / 2018-11-19 15:21:55\n"
+ " timestamp start/stop: 2018-11-19 15:21:52+00 / 2018-11-19 15:21:55+00\n"
" wal start/stop: 000000010000000000000003 / 000000020000000000000003\n"
" database size: 19.2MB, database backup size: 8.2KB\n"
" repo1: backup set size: 2.3MB, backup size: 346B\n"
" backup reference list: 20181119-152138F\n"
"\n"
" incr backup: 20181119-152138F_20181119-152155I\n"
- " timestamp start/stop: 2018-11-19 15:21:55 / 2018-11-19 15:21:57\n"
+ " timestamp start/stop: 2018-11-19 15:21:55+00 / 2018-11-19 15:21:57+00\n"
" wal start/stop: n/a\n"
" database size: 19.2MB, database backup size: 8.2KB\n"
" repo1: backup set size: 2.3MB, backup size: 346B\n"
@@ -2568,13 +2592,13 @@ testRun(void)
" wal archive min/max (9.5): 000000010000000000000002/000000010000000000000005\n"
"\n"
" full backup: 20201116-155000F\n"
- " timestamp start/stop: 2020-11-16 15:50:00 / 2020-11-16 15:50:02\n"
+ " timestamp start/stop: 2020-11-16 15:50:00+00 / 2020-11-16 15:50:02+00\n"
" wal start/stop: 000000010000000000000002 / 000000010000000000000003\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo1: backup set size: 3MB, backup size: 3KB\n"
"\n"
" incr backup: 20201116-155000F_20201119-152100I\n"
- " timestamp start/stop: 2020-11-19 15:21:00 / 2020-11-19 15:21:03\n"
+ " timestamp start/stop: 2020-11-19 15:21:00+00 / 2020-11-19 15:21:03+00\n"
" wal start/stop: 000000010000000000000005 / 000000010000000000000005\n"
" database size: 19.2MB, database backup size: 8.2KB\n"
" repo1: backup size: 346B\n"
@@ -2691,7 +2715,7 @@ testRun(void)
"20210112-192538F={\"backrest-format\":5,\"backrest-version\":\"2.25\","
"\"backup-archive-start\":\"000000010000000000000006\",\"backup-archive-stop\":\"000000010000000000000006\","
"\"backup-info-repo-size\":3159000,\"backup-info-repo-size-delta\":3100,\"backup-info-size\":26897000,"
- "\"backup-info-size-delta\":26897020,\"backup-timestamp-start\":1610479538,\"backup-timestamp-stop\":1610479540,"
+ "\"backup-info-size-delta\":26897020,\"backup-timestamp-start\":1687010984,\"backup-timestamp-stop\":1687011000,"
"\"backup-type\":\"full\",\"db-id\":2,\"option-archive-check\":true,\"option-archive-copy\":true,"
"\"option-backup-standby\":true,\"option-checksum-page\":false,\"option-compress\":false,\"option-hardlink\":true,"
"\"option-online\":true}\n"
@@ -2714,6 +2738,9 @@ testRun(void)
storageRepoIdxWrite(0), STORAGE_REPO_ARCHIVE
"/9.5-2/0000000100000000/000000010000000000000006-47dff2b7552a9d66e4bae1a762488a6885e7082c.gz");
+ // Switch to America/New_York to test + timezone offset without minutes
+ setenv("TZ", "America/New_York", true);
+
TEST_RESULT_STR_Z(
infoRender(),
"stanza: stanza3\n"
@@ -2728,13 +2755,13 @@ testRun(void)
" wal archive min/max (9.4): 000000010000000000000001/000000010000000000000003\n"
"\n"
" full backup: 20201110-100000F\n"
- " timestamp start/stop: 2020-11-10 10:00:00 / 2020-11-10 10:00:02\n"
+ " timestamp start/stop: 2020-11-10 05:00:00-05 / 2020-11-10 05:00:02-05\n"
" wal start/stop: 000000010000000000000001 / 000000010000000000000002\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo2: backup set size: 3MB, backup size: 3KB\n"
"\n"
" full backup: 20201212-192538F\n"
- " timestamp start/stop: 2020-12-12 19:25:38 / 2020-12-12 19:25:40\n"
+ " timestamp start/stop: 2020-12-12 14:25:38-05 / 2020-12-12 14:25:40-05\n"
" wal start/stop: 000000010000000000000002 / 000000010000000000000003\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo1: backup set size: 3MB, backup size: 3KB\n"
@@ -2743,12 +2770,15 @@ testRun(void)
" wal archive min/max (9.5): 000000010000000000000006/000000010000000000000006\n"
"\n"
" full backup: 20210112-192538F\n"
- " timestamp start/stop: 2021-01-12 19:25:38 / 2021-01-12 19:25:40\n"
+ " timestamp start/stop: 2023-06-17 10:09:44-04 / 2023-06-17 10:10:00-04\n"
" wal start/stop: 000000010000000000000006 / 000000010000000000000006\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo1: backup set size: 3MB, backup size: 3KB\n",
"text - multi-repo, database mismatch, repo2 stanza-upgrade needed");
+ // Reset timezone
+ setenv("TZ", "UTC", true);
+
hrnCfgArgRawZ(argList2, cfgOptOutput, "json");
HRN_CFG_LOAD(cfgCmdInfo, argList2);
@@ -2872,8 +2902,8 @@ testRun(void)
"\"prior\":null,"
"\"reference\":null,"
"\"timestamp\":{"
- "\"start\":1610479538,"
- "\"stop\":1610479540"
+ "\"start\":1687010984,"
+ "\"stop\":1687011000"
"},"
"\"type\":\"full\""
"}"
@@ -2997,7 +3027,7 @@ testRun(void)
" wal archive min/max (9.4): 000000010000000000000001/000000010000000000000002\n"
"\n"
" full backup: 20201110-100000F\n"
- " timestamp start/stop: 2020-11-10 10:00:00 / 2020-11-10 10:00:02\n"
+ " timestamp start/stop: 2020-11-10 10:00:00+00 / 2020-11-10 10:00:02+00\n"
" wal start/stop: 000000010000000000000001 / 000000010000000000000002\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo2: backup set size: 3MB, backup size: 3KB\n",
@@ -3172,7 +3202,7 @@ testRun(void)
" wal archive min/max (9.5): 000000010000000000000001/000000010000000000000002\n"
"\n"
" full backup: 20201116-155010F\n"
- " timestamp start/stop: 2020-11-16 15:50:10 / 2020-11-16 15:50:12\n"
+ " timestamp start/stop: 2020-11-16 15:50:10+00 / 2020-11-16 15:50:12+00\n"
" wal start/stop: 000000010000000000000001 / 000000010000000000000002\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo2: backup set size: 3MB, backup size: 3KB\n"
@@ -3181,7 +3211,7 @@ testRun(void)
" wal archive min/max (9.4): 000000010000000000000002/000000010000000000000003\n"
"\n"
" full backup: 20201116-155000F\n"
- " timestamp start/stop: 2020-11-16 15:50:00 / 2020-11-16 15:50:02\n"
+ " timestamp start/stop: 2020-11-16 15:50:00+00 / 2020-11-16 15:50:02+00\n"
" wal start/stop: 000000010000000000000002 / 000000010000000000000003\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo1: backup set size: 3MB, backup size: 3KB\n",
@@ -3237,7 +3267,7 @@ testRun(void)
" wal archive min/max (9.4): none present\n"
"\n"
" full backup: 20201116-155010F\n"
- " timestamp start/stop: 2020-11-16 15:50:10 / 2020-11-16 15:50:12\n"
+ " timestamp start/stop: 2020-11-16 15:50:10+00 / 2020-11-16 15:50:12+00\n"
" wal start/stop: 000000010000000000000001 / 000000010000000000000002\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo2: backup set size: 3MB, backup size: 3KB\n"
@@ -3246,7 +3276,7 @@ testRun(void)
" wal archive min/max (9.4): 000000010000000000000002/000000010000000000000003\n"
"\n"
" full backup: 20201116-155000F\n"
- " timestamp start/stop: 2020-11-16 15:50:00 / 2020-11-16 15:50:02\n"
+ " timestamp start/stop: 2020-11-16 15:50:00+00 / 2020-11-16 15:50:02+00\n"
" wal start/stop: 000000010000000000000002 / 000000010000000000000003\n"
" database size: 25.7MB, database backup size: 25.7MB\n"
" repo1: backup set size: 3MB, backup size: 3KB\n",
[parent: 762498f4cd5f]