diff --git a/doc/xml/release.xml b/doc/xml/release.xml index be1c60e33..1a31b449b 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -15,6 +15,14 @@ + + + + + +

Correct current history item in InfoPg to always be in position 0.

+
+

Add lstInsert() to List object.

diff --git a/src/info/infoPg.c b/src/info/infoPg.c index e5f4e1151..fd69e2fb8 100644 --- a/src/info/infoPg.c +++ b/src/info/infoPg.c @@ -40,7 +40,6 @@ struct InfoPg { MemContext *memContext; // Context that contains the infoPg List *history; // A list of InfoPgData - unsigned int indexCurrent; // Index to the history list for the db Section Info *info; // Info contents }; @@ -118,7 +117,7 @@ infoPgNew(const Storage *storage, const String *fileName, InfoPgType type) else if (type != infoPgArchive) THROW_FMT(AssertError, "invalid InfoPg type %u", type); - infoPgAdd(this, &infoPgData); + lstAdd(this->history, &infoPgData); } } MEM_CONTEXT_TEMP_END(); @@ -132,7 +131,7 @@ infoPgNew(const Storage *storage, const String *fileName, InfoPgType type) /*********************************************************************************************************************************** Add Postgres data to the history list and return the new currentIndex ***********************************************************************************************************************************/ -unsigned int +void infoPgAdd(InfoPg *this, const InfoPgData *infoPgData) { FUNCTION_DEBUG_BEGIN(logLevelDebug); @@ -143,10 +142,9 @@ infoPgAdd(InfoPg *this, const InfoPgData *infoPgData) FUNCTION_DEBUG_ASSERT(infoPgData != NULL); FUNCTION_DEBUG_END(); - lstAdd(this->history, infoPgData); - this->indexCurrent = lstSize(this->history) - 1; + lstInsert(this->history, 0, infoPgData); - FUNCTION_DEBUG_RESULT(UINT, this->indexCurrent); + FUNCTION_DEBUG_RESULT_VOID(); } /*********************************************************************************************************************************** @@ -195,7 +193,7 @@ infoPgDataCurrent(const InfoPg *this) FUNCTION_DEBUG_ASSERT(this != NULL); FUNCTION_DEBUG_END(); - FUNCTION_DEBUG_RESULT(INFO_PG_DATA, infoPgData(this, this->indexCurrent)); + FUNCTION_DEBUG_RESULT(INFO_PG_DATA, infoPgData(this, 0)); } /*********************************************************************************************************************************** diff --git a/src/info/infoPg.h b/src/info/infoPg.h index b1e8960a3..d049c9c55 100644 --- a/src/info/infoPg.h +++ b/src/info/infoPg.h @@ -43,7 +43,7 @@ InfoPg *infoPgNew(const Storage *storage, const String *fileName, InfoPgType typ /*********************************************************************************************************************************** Functions ***********************************************************************************************************************************/ -unsigned int infoPgAdd(InfoPg *this, const InfoPgData *infoPgData); +void infoPgAdd(InfoPg *this, const InfoPgData *infoPgData); /*********************************************************************************************************************************** Getters diff --git a/test/expect/mock-archive-001.log b/test/expect/mock-archive-001.log index 45e0673f3..13fe7790f 100644 --- a/test/expect/mock-archive-001.log +++ b/test/expect/mock-archive-001.log @@ -137,8 +137,6 @@ P00 DEBUG: info/info::infoNew: (fileName: {"/archive.info"}) P00 DEBUG: info/info::infoNew: => {Info} P00 DEBUG: info/info::infoIni: (this: {Info}) P00 DEBUG: info/info::infoIni: => {Ini} -P00 DEBUG: info/infoPg::infoPgAdd: (this: {InfoPg}, infoPgData: {id: 1, version: 90400, systemId: 1000000000000000094, catalogVersion: 0, controlVersion: 0}) -P00 DEBUG: info/infoPg::infoPgAdd: => 0 P00 DEBUG: info/infoPg::infoPgNew: => {InfoPg} P00 DEBUG: info/infoArchive::infoArchiveNew: => {InfoArchive} P00 DEBUG: command/archive/common::walSegmentFind: (storage: {type: posix, path: {"[TEST_PATH]/db-master/repo"}, write: false}, archiveId: {"9.4-1"}, walSegment: {"700000007000000070000000"}) @@ -181,8 +179,6 @@ P00 DEBUG: info/info::infoNew: (fileName: {"/archive.info"}) P00 DEBUG: info/info::infoNew: => {Info} P00 DEBUG: info/info::infoIni: (this: {Info}) P00 DEBUG: info/info::infoIni: => {Ini} -P00 DEBUG: info/infoPg::infoPgAdd: (this: {InfoPg}, infoPgData: {id: 1, version: 90400, systemId: 1000000000000000094, catalogVersion: 0, controlVersion: 0}) -P00 DEBUG: info/infoPg::infoPgAdd: => 0 P00 DEBUG: info/infoPg::infoPgNew: => {InfoPg} P00 DEBUG: info/infoArchive::infoArchiveNew: => {InfoArchive} P00 DEBUG: command/archive/common::walSegmentFind: (storage: {type: posix, path: {"[TEST_PATH]/db-master/repo"}, write: false}, archiveId: {"9.4-1"}, walSegment: {"000000010000000100000001"}) diff --git a/test/expect/mock-stanza-001.log b/test/expect/mock-stanza-001.log index 8b02343c0..427c606ad 100644 --- a/test/expect/mock-stanza-001.log +++ b/test/expect/mock-stanza-001.log @@ -554,10 +554,6 @@ P00 DEBUG: info/info::infoNew: (fileName: {"/archive.info"}) P00 DEBUG: info/info::infoNew: => {Info} P00 DEBUG: info/info::infoIni: (this: {Info}) P00 DEBUG: info/info::infoIni: => {Ini} -P00 DEBUG: info/infoPg::infoPgAdd: (this: {InfoPg}, infoPgData: {id: 2, version: 90400, systemId: 1000000000000000094, catalogVersion: 0, controlVersion: 0}) -P00 DEBUG: info/infoPg::infoPgAdd: => 0 -P00 DEBUG: info/infoPg::infoPgAdd: (this: {InfoPg}, infoPgData: {id: 1, version: 90300, systemId: 1000000000000000093, catalogVersion: 0, controlVersion: 0}) -P00 DEBUG: info/infoPg::infoPgAdd: => 1 P00 DEBUG: info/infoPg::infoPgNew: => {InfoPg} P00 DEBUG: info/infoArchive::infoArchiveNew: => {InfoArchive} P00 DEBUG: command/archive/common::walSegmentFind: (storage: {type: posix, path: {"[TEST_PATH]/db-master/repo"}, write: false}, archiveId: {"9.3-1"}, walSegment: {"000000010000000100000002"}) diff --git a/test/src/module/info/infoPgTest.c b/test/src/module/info/infoPgTest.c index 470d50fb4..6bac02b95 100644 --- a/test/src/module/info/infoPgTest.c +++ b/test/src/module/info/infoPgTest.c @@ -39,7 +39,6 @@ testRun(void) TEST_ASSIGN(infoPg, infoPgNew(storageLocal(), fileName, infoPgArchive), "new infoPg archive - load file"); TEST_RESULT_INT(lstSize(infoPg->history), 1, " history record added"); - TEST_RESULT_INT(infoPg->indexCurrent, 0, " current index set"); InfoPgData infoPgData = infoPgDataCurrent(infoPg); TEST_RESULT_INT(infoPgData.id, 1, " id set"); @@ -76,7 +75,6 @@ testRun(void) TEST_ASSIGN(infoPg, infoPgNew(storageLocal(), fileName, infoPgBackup), "new infoPg backup - load file"); TEST_RESULT_INT(lstSize(infoPg->history), 1, " history record added"); - TEST_RESULT_INT(infoPg->indexCurrent, 0, " current index set"); infoPgData = infoPgDataCurrent(infoPg); TEST_RESULT_INT(infoPgData.id, 1, " id set"); @@ -90,7 +88,6 @@ testRun(void) TEST_ASSIGN(infoPg, infoPgNew(storageLocal(), fileName, infoPgManifest), "new infoPg manifest - load file"); TEST_RESULT_INT(lstSize(infoPg->history), 1, "history record added"); - TEST_RESULT_INT(infoPg->indexCurrent, 0, "current index set"); infoPgData = infoPgDataCurrent(infoPg); TEST_RESULT_INT(infoPgData.id, 1, " id set"); @@ -106,7 +103,7 @@ testRun(void) infoPgData.systemId = 6365925855999999999; infoPgData.catalogVersion = 201510051; infoPgData.controlVersion = 942; - TEST_RESULT_INT(infoPgAdd(infoPg, &infoPgData), 1, "infoPgAdd - currentIndex incremented"); + TEST_RESULT_VOID(infoPgAdd(infoPg, &infoPgData), "infoPgAdd"); InfoPgData infoPgDataTest = infoPgDataCurrent(infoPg); TEST_RESULT_INT(infoPgDataTest.id, 2, " id set");