1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-03 00:26:59 +02:00

Revert ignoring catalog version when identifying a PostgreSQL version.

927d9adb changed the way CATALOG_VERSION_NO is used to identify PostgreSQL versions since PG_CONTROL_VERSION is generally bumped with each release. The goal was to make the beta/rc period less painful because any CATALOG_VERSION_NO bump renders pgBackRest inoperative.

This worked, but in fact we'd rather be stricter about which CATALOG_VERSION_NO we accept when identifying a version of PostgreSQL. It is not just about identifying a major version, but making sure the build contains all the functions and catalogs we expect to make pgBackRest work correctly. It is better to reject early dev/beta/rc builds that may not work.

Since 927d9adb was relatively recent the chance that this stricter checking will cause a problem seems minimal, so revert to checking CATALOG_VERSION_NO for every PostgreSQL version.

Leave in place the code that pulls CATALOG_VERSION_NO from pg_control rather than the internal constant since the plan is still to allow catalog versions to "float" during the PostgreSQL beta/rc phase, which will be the subject of a future commit.
This commit is contained in:
David Steele
2021-05-17 07:12:46 -04:00
parent f45e76fa2e
commit 9235c62c6b
3 changed files with 118 additions and 23 deletions

View File

@ -24,8 +24,6 @@ Determine if the supplied pg_control is for this version of PostgreSQL
#elif PG_VERSION >= PG_VERSION_83
#ifdef CATALOG_VERSION_NO
#define PG_INTERFACE_CONTROL_IS(version) \
bool \
pgInterfaceControlIs##version(const unsigned char *controlFile) \
@ -37,19 +35,6 @@ Determine if the supplied pg_control is for this version of PostgreSQL
((ControlFileData *)controlFile)->catalog_version_no == CATALOG_VERSION_NO; \
}
#else
#define PG_INTERFACE_CONTROL_IS(version) \
bool \
pgInterfaceControlIs##version(const unsigned char *controlFile) \
{ \
ASSERT(controlFile != NULL); \
\
return ((ControlFileData *)controlFile)->pg_control_version == PG_CONTROL_VERSION; \
}
#endif // CATALOG_VERSION_NO
#endif
/***********************************************************************************************************************************

View File

@ -177,17 +177,73 @@ Types from src/include/catalog/catversion.h
***********************************************************************************************************************************/
// CATALOG_VERSION_NO define
//
// Add CATALOG_VERSION_NO when more than one PostgreSQL version shares a control version so the PostgreSQL version can be reliably
// identified. Newer versions of PostgreSQL have bumped the control version but that has not always been the case.
//
// Undef CATALOG_VERSION_NO in PostgreSQL versions where it is not required to improve readability.
// ---------------------------------------------------------------------------------------------------------------------------------
#if PG_VERSION > PG_VERSION_MAX
#elif PG_VERSION >= PG_VERSION_13
/*
* We could use anything we wanted for version numbers, but I recommend
* following the "YYYYMMDDN" style often used for DNS zone serial numbers.
* YYYYMMDD are the date of the change, and N is the number of the change
* on that day. (Hopefully we'll never commit ten independent sets of
* catalog changes on the same day...)
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 202007201
#elif PG_VERSION >= PG_VERSION_12
/*
* We could use anything we wanted for version numbers, but I recommend
* following the "YYYYMMDDN" style often used for DNS zone serial numbers.
* YYYYMMDD are the date of the change, and N is the number of the change
* on that day. (Hopefully we'll never commit ten independent sets of
* catalog changes on the same day...)
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 201909212
#elif PG_VERSION >= PG_VERSION_11
/*
* We could use anything we wanted for version numbers, but I recommend
* following the "YYYYMMDDN" style often used for DNS zone serial numbers.
* YYYYMMDD are the date of the change, and N is the number of the change
* on that day. (Hopefully we'll never commit ten independent sets of
* catalog changes on the same day...)
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 201809051
#elif PG_VERSION >= PG_VERSION_10
/*
* We could use anything we wanted for version numbers, but I recommend
* following the "YYYYMMDDN" style often used for DNS zone serial numbers.
* YYYYMMDD are the date of the change, and N is the number of the change
* on that day. (Hopefully we'll never commit ten independent sets of
* catalog changes on the same day...)
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 201707211
#elif PG_VERSION >= PG_VERSION_96
#undef CATALOG_VERSION_NO
/*
* We could use anything we wanted for version numbers, but I recommend
* following the "YYYYMMDDN" style often used for DNS zone serial numbers.
* YYYYMMDD are the date of the change, and N is the number of the change
* on that day. (Hopefully we'll never commit ten independent sets of
* catalog changes on the same day...)
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 201608131
#elif PG_VERSION >= PG_VERSION_95
@ -215,9 +271,31 @@ Types from src/include/catalog/catversion.h
/* yyyymmddN */
#define CATALOG_VERSION_NO 201409291
#elif PG_VERSION >= PG_VERSION_93
/*
* We could use anything we wanted for version numbers, but I recommend
* following the "YYYYMMDDN" style often used for DNS zone serial numbers.
* YYYYMMDD are the date of the change, and N is the number of the change
* on that day. (Hopefully we'll never commit ten independent sets of
* catalog changes on the same day...)
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 201306121
#elif PG_VERSION >= PG_VERSION_92
#undef CATALOG_VERSION_NO
/*
* We could use anything we wanted for version numbers, but I recommend
* following the "YYYYMMDDN" style often used for DNS zone serial numbers.
* YYYYMMDD are the date of the change, and N is the number of the change
* on that day. (Hopefully we'll never commit ten independent sets of
* catalog changes on the same day...)
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 201204301
#elif PG_VERSION >= PG_VERSION_91
@ -245,9 +323,32 @@ Types from src/include/catalog/catversion.h
/* yyyymmddN */
#define CATALOG_VERSION_NO 201008051
#elif PG_VERSION >= PG_VERSION_84
/*
* We could use anything we wanted for version numbers, but I recommend
* following the "YYYYMMDDN" style often used for DNS zone serial numbers.
* YYYYMMDD are the date of the change, and N is the number of the change
* on that day. (Hopefully we'll never commit ten independent sets of
* catalog changes on the same day...)
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 200904091
#elif PG_VERSION >= PG_VERSION_83
#undef CATALOG_VERSION_NO
/*
* We could use anything we wanted for version numbers, but I recommend
* following the "YYYYMMDDN" style often used for DNS zone serial numbers.
* YYYYMMDD are the date of the change, and N is the number of the change
* on that day. (Hopefully we'll never commit ten independent sets of
* catalog changes on the same day...)
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 200711281
#endif