1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-05 15:41:11 +03:00

Remove support for PostgreSQL 9.4.

Per our policy to support five EOL versions of PostgreSQL, 9.4 is no longer supported by pgBackRest. Remove all logic associated with 9.4 and update the tests.

This includes a small fix in infoPg.c to allow backup.info files with old versions to be saved. This allows expire to function when old versions are present. Even though those older versions cannot be used, they can be expired.

Tests for 9.4 are left in the expire/info tests to demonstrate that these commands work with old versions present.
This commit is contained in:
David Steele
2024-10-21 13:56:04 +03:00
committed by GitHub
parent 89c9baba72
commit 48f511dad3
43 changed files with 345 additions and 527 deletions

View File

@ -24,7 +24,7 @@ testRun(void)
// *****************************************************************************************************************************
if (testBegin("pgVersionFromStr() and pgVersionToStr()"))
{
TEST_ERROR(pgVersionFromStr(STRDEF("9.4.4")), AssertError, "version 9.4.4 format is invalid");
TEST_ERROR(pgVersionFromStr(STRDEF("9.6.4")), AssertError, "version 9.6.4 format is invalid");
TEST_ERROR(pgVersionFromStr(STRDEF("abc")), AssertError, "version abc format is invalid");
TEST_ERROR(pgVersionFromStr(NULL), AssertError, "assertion 'version != NULL' failed");
@ -34,7 +34,7 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_STR_Z(pgVersionToStr(PG_VERSION_11), "11", "infoPgVersionToString 11");
TEST_RESULT_STR_Z(pgVersionToStr(PG_VERSION_96), "9.6", "infoPgVersionToString 9.6");
TEST_RESULT_STR_Z(pgVersionToStr(94456), "9.44", "infoPgVersionToString 94456");
TEST_RESULT_STR_Z(pgVersionToStr(96456), "9.64", "infoPgVersionToString 96456");
}
// *****************************************************************************************************************************
@ -59,7 +59,7 @@ testRun(void)
pgControlVersion(70300), VersionNotSupportedError,
"invalid PostgreSQL version 70300\n"
"HINT: is this version of PostgreSQL supported?");
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_94), 942, "9.4 control version");
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_95), 942, "9.5 control version");
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_11), 1100, "11 control version");
TEST_RESULT_UINT(pgControlVersion(PG_VERSION_17), 1700, "17 control version");
}
@ -163,13 +163,13 @@ testRun(void)
TEST_TITLE("check all valid page sizes");
HRN_PG_CONTROL_PUT(
storageTest, PG_VERSION_94, .systemId = 0xEFEFEFEFEF, .catalogVersion = hrnPgCatalogVersion(PG_VERSION_94),
storageTest, PG_VERSION_95, .systemId = 0xEFEFEFEFEF, .catalogVersion = hrnPgCatalogVersion(PG_VERSION_95),
.checkpoint = 0xAABBAABBEEFFEEFF, .timeline = 88, .pageSize = pgPageSize8);
TEST_ASSIGN(info, pgControlFromFile(storageTest, NULL), "get control info");
TEST_RESULT_UINT(info.systemId, 0xEFEFEFEFEF, " check system id");
TEST_RESULT_UINT(info.version, PG_VERSION_94, " check version");
TEST_RESULT_UINT(info.catalogVersion, 201409291, " check catalog version");
TEST_RESULT_UINT(info.version, PG_VERSION_95, " check version");
TEST_RESULT_UINT(info.catalogVersion, 201510051, " check catalog version");
TEST_RESULT_UINT(info.checkpoint, 0xAABBAABBEEFFEEFF, "check checkpoint");
TEST_RESULT_UINT(info.timeline, 88, "check timeline");
TEST_RESULT_UINT(info.pageSize, pgPageSize8, "check page size");
@ -291,15 +291,15 @@ testRun(void)
// Start with an invalid crc but write a valid one at a greater offset to test the forced scan
control = hrnPgControlToBuffer(
0, 0xFADEFADE, (PgControl){.version = PG_VERSION_94, .systemId = 0xAAAA0AAAA, .checkpoint = 777});
crcOffset = pgInterfaceVersion(PG_VERSION_94)->controlCrcOffset() + sizeof(uint32_t) * 2;
*((uint32_t *)(bufPtr(control) + crcOffset)) = crc32One(bufPtrConst(control), crcOffset);
0, 0xFADEFADE, (PgControl){.version = PG_VERSION_95, .systemId = 0xAAAA0AAAA, .checkpoint = 777});
crcOffset = pgInterfaceVersion(PG_VERSION_95)->controlCrcOffset() + sizeof(uint32_t) * 2;
*((uint32_t *)(bufPtr(control) + crcOffset)) = crc32cOne(bufPtrConst(control), crcOffset);
info = pgControlFromBuffer(control, STRDEF(PG_VERSION_94_Z));
info = pgControlFromBuffer(control, STRDEF(PG_VERSION_95_Z));
TEST_RESULT_UINT(info.checkpoint, 777, "check checkpoint");
TEST_RESULT_VOID(pgControlCheckpointInvalidate(control, STRDEF(PG_VERSION_94_Z)), "invalidate checkpoint");
info = pgControlFromBuffer(control, STRDEF(PG_VERSION_94_Z));
TEST_RESULT_VOID(pgControlCheckpointInvalidate(control, STRDEF(PG_VERSION_95_Z)), "invalidate checkpoint");
info = pgControlFromBuffer(control, STRDEF(PG_VERSION_95_Z));
TEST_RESULT_UINT(info.checkpoint, 0xDEAD, "check invalid checkpoint");
}
@ -345,7 +345,7 @@ testRun(void)
TEST_RESULT_STR_Z(pgLsnName(PG_VERSION_96), "location", "check location name");
TEST_RESULT_STR_Z(pgLsnName(PG_VERSION_10), "lsn", "check lsn name");
TEST_RESULT_STR_Z(pgTablespaceId(PG_VERSION_94, 201409291), "PG_9.4_201409291", "check 9.4 tablespace id");
TEST_RESULT_STR_Z(pgTablespaceId(PG_VERSION_95, 201510051), "PG_9.5_201510051", "check 9.5 tablespace id");
TEST_RESULT_STR_Z(pgTablespaceId(PG_VERSION_16, 999999999), "PG_16_999999999", "check 16 tablespace id");
TEST_RESULT_STR_Z(pgWalName(PG_VERSION_96), "xlog", "check xlog name");
@ -482,12 +482,12 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
memset(bufPtr(result), 0, bufSize(result));
HRN_PG_WAL_TO_BUFFER(result, PG_VERSION_94, .systemId = 0xEAEAEAEA, .size = HRN_PG_WAL_SEGMENT_SIZE_DEFAULT);
HRN_PG_WAL_TO_BUFFER(result, PG_VERSION_95, .systemId = 0xEAEAEAEA, .size = HRN_PG_WAL_SEGMENT_SIZE_DEFAULT);
storagePutP(storageNewWriteP(storageTest, walFile), result);
TEST_ASSIGN(info, pgWalFromFile(walFile, storageTest, NULL), "get wal info v9.4");
TEST_ASSIGN(info, pgWalFromFile(walFile, storageTest, NULL), "get wal info v9.5");
TEST_RESULT_UINT(info.systemId, 0xEAEAEAEA, " check system id");
TEST_RESULT_UINT(info.version, PG_VERSION_94, " check version");
TEST_RESULT_UINT(info.version, PG_VERSION_95, " check version");
TEST_RESULT_UINT(info.size, HRN_PG_WAL_SEGMENT_SIZE_DEFAULT, " check size");
// -------------------------------------------------------------------------------------------------------------------------