pgbackrest.git / summary / log / commit / refs
commit 33e3d316d63a41cd64d217abe30786cfb48bf09e
Author: Cynthia Shang <cynthia.shang@crunchydata.com>
Commit: David Steele <david@pgmasters.net>
Date: Wed Jun 26 23:52:04 2019 +0000
Reverse loop in infoPgSave() to be consistent with infoPgNewLoad().
Contributed by Cynthia Shang.
src/info/infoPg.c | 4 ++--
test/src/module/info/infoPgTest.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/info/infoPg.c b/src/info/infoPg.c
index 255610585..211073558 100644
--- a/src/info/infoPg.c
+++ b/src/info/infoPg.c
@@ -192,8 +192,8 @@ infoPgSave(
iniSet(ini, INFO_SECTION_DB_STR, varStr(INFO_KEY_DB_SYSTEM_ID_VAR), jsonFromUInt64(pgData.systemId));
iniSet(ini, INFO_SECTION_DB_STR, varStr(INFO_KEY_DB_VERSION_VAR), jsonFromStr(pgVersionToStr(pgData.version)));
- // Set the db history section
- for (unsigned int pgDataIdx = 0; pgDataIdx < infoPgDataTotal(this); pgDataIdx++)
+ // Set the db history section in reverse so oldest history is first instead of last to be consistent with load
+ for (unsigned int pgDataIdx = infoPgDataTotal(this) - 1; (int)pgDataIdx >= 0; pgDataIdx--)
{
InfoPgData pgData = infoPgData(this, pgDataIdx);
diff --git a/test/src/module/info/infoPgTest.c b/test/src/module/info/infoPgTest.c
index c32b72bd2..91fef2dcf 100644
--- a/test/src/module/info/infoPgTest.c
+++ b/test/src/module/info/infoPgTest.c
@@ -10,7 +10,7 @@ void
testRun(void)
{
// *****************************************************************************************************************************
- if (testBegin("infoPgNewLoad(), infoPgFree(), infoPgDataCurrent(), infoPgDataToLog(), infoPgAdd(), infoPgIni()"))
+ if (testBegin("infoPgNewLoad(), infoPgFree(), infoPgDataCurrent(), infoPgDataToLog(), infoPgAdd(), infoPgIni(), infoPgSave()"))
{
String *content = NULL;
String *fileName = strNewFmt("%s/test.ini", testPath());
@@ -108,12 +108,12 @@ testRun(void)
// Save the file and verify it
ini = iniNew();
- TEST_RESULT_VOID(infoPgSave(infoPg, ini, storageLocalWrite(), fileName2, cipherTypeNone, NULL), "save file");
+ TEST_RESULT_VOID(infoPgSave(infoPg, ini, storageLocalWrite(), fileName2, cipherTypeNone, NULL), "infoPgSave");
TEST_RESULT_BOOL(
bufEq(
storageGetNP(storageNewReadNP(storageLocal(), fileName)),
storageGetNP(storageNewReadNP(storageLocal(), fileName2))),
- true, "files are equal");
+ true, " saved files are equal");
TEST_RESULT_INT(lstSize(infoPg->history), 2, "history record added");
[parent: 4bffa0c5bb7d]