1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-07 00:35:37 +02:00

Improve PostgreSQL version identification.

Previously, catalog versions were fixed for all versions which made maintaining the catalog versions during PostgreSQL beta and release candidate cycles very painful. A version of pgBackRest which was functionally compatible was rendered useless by a catalog version bump in PostgreSQL.

Instead use only the control version to identify a PostgreSQL version when possible. Some older versions require a catalog version to positively identify a PostgreSQL version, so include them when required.

Since the catalog number is required to work with tablespaces it will need to be stored. There's already a copy of it in backup.info so use that (even though we have been ignoring it in the C versions).
This commit is contained in:
David Steele
2020-09-18 16:55:26 -04:00
committed by GitHub
parent 94475bfbe6
commit 927d9adbee
26 changed files with 259 additions and 270 deletions

View File

@ -444,14 +444,14 @@ testRun(void)
InfoArchive *archiveInfo = infoArchiveNew(PG_VERSION_96, 6569239123849665679, NULL);
InfoPgData archivePg = infoPgData(infoArchivePg(archiveInfo), infoPgDataCurrentId(infoArchivePg(archiveInfo)));
InfoBackup *backupInfo = infoBackupNew(PG_VERSION_96, 6569239123849665679, NULL);
InfoBackup *backupInfo = infoBackupNew(PG_VERSION_96, 6569239123849665679, pgCatalogTestVersion(PG_VERSION_96), NULL);
InfoPgData backupPg = infoPgData(infoBackupPg(backupInfo), infoPgDataCurrentId(infoBackupPg(backupInfo)));
TEST_RESULT_VOID(checkStanzaInfo(&archivePg, &backupPg), "stanza info files match");
// Create a corrupted backup file - system id
// -------------------------------------------------------------------------------------------------------------------------
backupInfo = infoBackupNew(PG_VERSION_96, 6569239123849665999, NULL);
backupInfo = infoBackupNew(PG_VERSION_96, 6569239123849665999, pgCatalogTestVersion(PG_VERSION_96), NULL);
backupPg = infoPgData(infoBackupPg(backupInfo), infoPgDataCurrentId(infoBackupPg(backupInfo)));
TEST_ERROR_FMT(
@ -462,7 +462,7 @@ testRun(void)
// Create a corrupted backup file - system id and version
// -------------------------------------------------------------------------------------------------------------------------
backupInfo = infoBackupNew(PG_VERSION_95, 6569239123849665999, NULL);
backupInfo = infoBackupNew(PG_VERSION_95, 6569239123849665999, pgCatalogTestVersion(PG_VERSION_95), NULL);
backupPg = infoPgData(infoBackupPg(backupInfo), infoPgDataCurrentId(infoBackupPg(backupInfo)));
TEST_ERROR_FMT(
@ -473,7 +473,7 @@ testRun(void)
// Create a corrupted backup file - version
// -------------------------------------------------------------------------------------------------------------------------
backupInfo = infoBackupNew(PG_VERSION_95, 6569239123849665679, NULL);
backupInfo = infoBackupNew(PG_VERSION_95, 6569239123849665679, pgCatalogTestVersion(PG_VERSION_95), NULL);
backupPg = infoPgData(infoBackupPg(backupInfo), infoPgDataCurrentId(infoBackupPg(backupInfo)));
TEST_ERROR_FMT(
@ -484,7 +484,7 @@ testRun(void)
// Create a corrupted backup file - db id
// -------------------------------------------------------------------------------------------------------------------------
infoBackupPgSet(backupInfo, PG_VERSION_96, 6569239123849665679);
infoBackupPgSet(backupInfo, PG_VERSION_96, 6569239123849665679, pgCatalogTestVersion(PG_VERSION_96));
backupPg = infoPgData(infoBackupPg(backupInfo), infoPgDataCurrentId(infoBackupPg(backupInfo)));
TEST_ERROR_FMT(