1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-09-16 09:06:18 +02:00

Remove never-used infoBackupCheckPg() function.

Contributed by Cynthia Shang.
This commit is contained in:
Cynthia Shang
2019-07-17 16:55:21 -04:00
committed by David Steele
parent 3bdba4933d
commit d1dd6add48
3 changed files with 1 additions and 74 deletions

View File

@@ -12,7 +12,6 @@ Backup Info Handler
#include "common/ini.h"
#include "common/log.h"
#include "common/memContext.h"
#include "common/ini.h"
#include "common/object.h"
#include "common/regExp.h"
#include "common/type/json.h"
@@ -154,48 +153,6 @@ infoBackupNewLoad(const Storage *storage, const String *fileName, CipherType cip
FUNCTION_LOG_RETURN(INFO_BACKUP, this);
}
/***********************************************************************************************************************************
Checks the backup info file's DB section against the PG version, system id, catolog and constrol version passed in and returns
the history id of the current PG database.
***********************************************************************************************************************************/
unsigned int
infoBackupCheckPg(
const InfoBackup *this,
unsigned int pgVersion,
uint64_t pgSystemId,
uint32_t pgCatalogVersion,
uint32_t pgControlVersion)
{
FUNCTION_LOG_BEGIN(logLevelTrace);
FUNCTION_LOG_PARAM(INFO_BACKUP, this);
FUNCTION_LOG_PARAM(UINT, pgVersion);
FUNCTION_LOG_PARAM(UINT64, pgSystemId);
FUNCTION_LOG_PARAM(UINT32, pgCatalogVersion);
FUNCTION_LOG_PARAM(UINT32, pgControlVersion);
FUNCTION_LOG_END();
ASSERT(this != NULL);
InfoPgData backupPg = infoPgDataCurrent(this->infoPg);
if (backupPg.version != pgVersion || backupPg.systemId != pgSystemId)
THROW(BackupMismatchError, strPtr(strNewFmt(
"database version = %s, system-id %" PRIu64 " does not match backup version = %s, system-id = %" PRIu64 "\n"
"HINT: is this the correct stanza?",
strPtr(pgVersionToStr(pgVersion)), pgSystemId, strPtr(pgVersionToStr(backupPg.version)), backupPg.systemId)));
if (backupPg.catalogVersion != pgCatalogVersion || backupPg.controlVersion != pgControlVersion)
{
THROW(BackupMismatchError, strPtr(strNewFmt(
"database control-version = %" PRIu32 ", catalog-version %" PRIu32
" does not match backup control-version = %" PRIu32 ", catalog-version = %" PRIu32 "\n"
"HINT: this may be a symptom of database or repository corruption!",
pgControlVersion, pgCatalogVersion, backupPg.controlVersion, backupPg.catalogVersion)));
}
FUNCTION_LOG_RETURN(UINT, backupPg.id);
}
/***********************************************************************************************************************************
Save to file
***********************************************************************************************************************************/

View File

@@ -65,8 +65,6 @@ InfoBackup *infoBackupNewLoad(
/***********************************************************************************************************************************
Functions
***********************************************************************************************************************************/
unsigned int infoBackupCheckPg(
const InfoBackup *this, unsigned int pgVersion, uint64_t pgSystemId, uint32_t pgCatalogVersion, uint32_t pgControlVersion);
// Remove a backup from the current section
void infoBackupDataDelete(const InfoBackup *this, const String *backupDeleteLabel);
void infoBackupSave(

View File

@@ -20,7 +20,7 @@ testRun(void)
InfoBackup *infoBackup = NULL;
// *****************************************************************************************************************************
if (testBegin("infoBackupNewLoad(), infoBackupDataTotal(), infoBackupCheckPg(), infoBackupFree()"))
if (testBegin("infoBackupNewLoad(), infoBackupDataTotal(), infoBackupFree()"))
{
// File missing
//--------------------------------------------------------------------------------------------------------------------------
@@ -59,34 +59,6 @@ testRun(void)
TEST_RESULT_PTR(infoBackup->backup, NULL, " backupCurrent NULL");
TEST_RESULT_INT(infoBackupDataTotal(infoBackup), 0, " infoBackupDataTotal returns 0");
// infoBackupCheckPg
//--------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_INT(infoBackupCheckPg(infoBackup, 90400, 6569239123849665679, 201409291, 942), 1, "check PG data");
TEST_ERROR_FMT(
infoBackupCheckPg(infoBackup, 90500, 6569239123849665679, 201409291, 942), BackupMismatchError,
"database version = 9.5, system-id 6569239123849665679 does not match "
"backup version = 9.4, system-id = 6569239123849665679\n"
"HINT: is this the correct stanza?");
TEST_ERROR_FMT(
infoBackupCheckPg(infoBackup, 90400, 6569239123849665999, 201409291, 942), BackupMismatchError,
"database version = 9.4, system-id 6569239123849665999 does not match "
"backup version = 9.4, system-id = 6569239123849665679\n"
"HINT: is this the correct stanza?");
TEST_ERROR_FMT(
infoBackupCheckPg(infoBackup, 90400, 6569239123849665679, 201409291, 941), BackupMismatchError,
"database control-version = 941, catalog-version 201409291"
" does not match backup control-version = 942, catalog-version = 201409291\n"
"HINT: this may be a symptom of database or repository corruption!");
TEST_ERROR_FMT(
infoBackupCheckPg(infoBackup, 90400, 6569239123849665679, 201509291, 942), BackupMismatchError,
"database control-version = 942, catalog-version 201509291"
" does not match backup control-version = 942, catalog-version = 201409291\n"
"HINT: this may be a symptom of database or repository corruption!");
// Free
//--------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_VOID(infoBackupFree(infoBackup), "infoBackupFree() - free backup info");