You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-05 00:28:52 +02:00
Remove most references to PostgreSQL control and catalog versions.
The control and catalog versions were stored a variety of places in the optimistic hope that they would be useful. In fact they never were. We can't remove them from the backup.info and backup.manifest files due to backwards compatibility concerns, but we can at least avoid loading and storing them in C structures. Add functions to the PostgreSQL interface which will return the control and catalog versions for any supported version of PostgreSQL to allow backwards compatibility for backup.info and backup.manifest. These functions will be useful in other ways, e.g. generating the tablespace identifier in PostgreSQL >= 9.0.
This commit is contained in:
@ -9,58 +9,80 @@ PostgreSQL Version Interface
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
uint32_t pgInterfaceCatalogVersion083(void);
|
||||
bool pgInterfaceControlIs083(const unsigned char *controlFile);
|
||||
PgControl pgInterfaceControl083(const unsigned char *controlFile);
|
||||
uint32_t pgInterfaceControlVersion083(void);
|
||||
bool pgInterfaceWalIs083(const unsigned char *walFile);
|
||||
PgWal pgInterfaceWal083(const unsigned char *controlFile);
|
||||
|
||||
uint32_t pgInterfaceCatalogVersion084(void);
|
||||
bool pgInterfaceControlIs084(const unsigned char *controlFile);
|
||||
PgControl pgInterfaceControl084(const unsigned char *controlFile);
|
||||
uint32_t pgInterfaceControlVersion084(void);
|
||||
bool pgInterfaceWalIs084(const unsigned char *walFile);
|
||||
PgWal pgInterfaceWal084(const unsigned char *controlFile);
|
||||
|
||||
uint32_t pgInterfaceCatalogVersion090(void);
|
||||
bool pgInterfaceControlIs090(const unsigned char *controlFile);
|
||||
PgControl pgInterfaceControl090(const unsigned char *controlFile);
|
||||
uint32_t pgInterfaceControlVersion090(void);
|
||||
bool pgInterfaceWalIs090(const unsigned char *walFile);
|
||||
PgWal pgInterfaceWal090(const unsigned char *controlFile);
|
||||
|
||||
uint32_t pgInterfaceCatalogVersion091(void);
|
||||
bool pgInterfaceControlIs091(const unsigned char *controlFile);
|
||||
PgControl pgInterfaceControl091(const unsigned char *controlFile);
|
||||
uint32_t pgInterfaceControlVersion091(void);
|
||||
bool pgInterfaceWalIs091(const unsigned char *walFile);
|
||||
PgWal pgInterfaceWal091(const unsigned char *controlFile);
|
||||
|
||||
uint32_t pgInterfaceCatalogVersion092(void);
|
||||
bool pgInterfaceControlIs092(const unsigned char *controlFile);
|
||||
PgControl pgInterfaceControl092(const unsigned char *controlFile);
|
||||
uint32_t pgInterfaceControlVersion092(void);
|
||||
bool pgInterfaceWalIs092(const unsigned char *walFile);
|
||||
PgWal pgInterfaceWal092(const unsigned char *controlFile);
|
||||
|
||||
uint32_t pgInterfaceCatalogVersion093(void);
|
||||
bool pgInterfaceControlIs093(const unsigned char *controlFile);
|
||||
PgControl pgInterfaceControl093(const unsigned char *controlFile);
|
||||
uint32_t pgInterfaceControlVersion093(void);
|
||||
bool pgInterfaceWalIs093(const unsigned char *walFile);
|
||||
PgWal pgInterfaceWal093(const unsigned char *controlFile);
|
||||
|
||||
uint32_t pgInterfaceCatalogVersion094(void);
|
||||
bool pgInterfaceControlIs094(const unsigned char *controlFile);
|
||||
PgControl pgInterfaceControl094(const unsigned char *controlFile);
|
||||
uint32_t pgInterfaceControlVersion094(void);
|
||||
bool pgInterfaceWalIs094(const unsigned char *walFile);
|
||||
PgWal pgInterfaceWal094(const unsigned char *controlFile);
|
||||
|
||||
uint32_t pgInterfaceCatalogVersion095(void);
|
||||
bool pgInterfaceControlIs095(const unsigned char *controlFile);
|
||||
PgControl pgInterfaceControl095(const unsigned char *controlFile);
|
||||
uint32_t pgInterfaceControlVersion095(void);
|
||||
bool pgInterfaceWalIs095(const unsigned char *walFile);
|
||||
PgWal pgInterfaceWal095(const unsigned char *controlFile);
|
||||
|
||||
uint32_t pgInterfaceCatalogVersion096(void);
|
||||
bool pgInterfaceControlIs096(const unsigned char *controlFile);
|
||||
PgControl pgInterfaceControl096(const unsigned char *controlFile);
|
||||
uint32_t pgInterfaceControlVersion096(void);
|
||||
bool pgInterfaceWalIs096(const unsigned char *walFile);
|
||||
PgWal pgInterfaceWal096(const unsigned char *controlFile);
|
||||
|
||||
uint32_t pgInterfaceCatalogVersion100(void);
|
||||
bool pgInterfaceControlIs100(const unsigned char *controlFile);
|
||||
PgControl pgInterfaceControl100(const unsigned char *controlFile);
|
||||
uint32_t pgInterfaceControlVersion100(void);
|
||||
bool pgInterfaceWalIs100(const unsigned char *walFile);
|
||||
PgWal pgInterfaceWal100(const unsigned char *controlFile);
|
||||
|
||||
uint32_t pgInterfaceCatalogVersion110(void);
|
||||
bool pgInterfaceControlIs110(const unsigned char *controlFile);
|
||||
PgControl pgInterfaceControl110(const unsigned char *controlFile);
|
||||
uint32_t pgInterfaceControlVersion110(void);
|
||||
bool pgInterfaceWalIs110(const unsigned char *walFile);
|
||||
PgWal pgInterfaceWal110(const unsigned char *controlFile);
|
||||
|
||||
|
@ -17,6 +17,22 @@ Each version of PostgreSQL will need a vXXX.c file to contain the version-specif
|
||||
|
||||
#include "postgres/interface/version.auto.h"
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Get the catalog version
|
||||
***********************************************************************************************************************************/
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_83
|
||||
|
||||
#define PG_INTERFACE_CATALOG_VERSION(version) \
|
||||
uint32_t \
|
||||
pgInterfaceCatalogVersion##version(void) \
|
||||
{ \
|
||||
return CATALOG_VERSION_NO; \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Determine if the supplied pg_control is for this version of PostgreSQL
|
||||
***********************************************************************************************************************************/
|
||||
@ -54,8 +70,6 @@ Read the version specific pg_control into a general data structure
|
||||
return (PgControl) \
|
||||
{ \
|
||||
.systemId = ((ControlFileData *)controlFile)->system_identifier, \
|
||||
.controlVersion = ((ControlFileData *)controlFile)->pg_control_version, \
|
||||
.catalogVersion = ((ControlFileData *)controlFile)->catalog_version_no, \
|
||||
.pageSize = ((ControlFileData *)controlFile)->blcksz, \
|
||||
.walSegmentSize = ((ControlFileData *)controlFile)->xlog_seg_size, \
|
||||
.pageChecksum = ((ControlFileData *)controlFile)->data_checksum_version != 0, \
|
||||
@ -74,8 +88,6 @@ Read the version specific pg_control into a general data structure
|
||||
return (PgControl) \
|
||||
{ \
|
||||
.systemId = ((ControlFileData *)controlFile)->system_identifier, \
|
||||
.controlVersion = ((ControlFileData *)controlFile)->pg_control_version, \
|
||||
.catalogVersion = ((ControlFileData *)controlFile)->catalog_version_no, \
|
||||
.pageSize = ((ControlFileData *)controlFile)->blcksz, \
|
||||
.walSegmentSize = ((ControlFileData *)controlFile)->xlog_seg_size, \
|
||||
}; \
|
||||
@ -83,6 +95,22 @@ Read the version specific pg_control into a general data structure
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Get the control version
|
||||
***********************************************************************************************************************************/
|
||||
#if PG_VERSION > PG_VERSION_MAX
|
||||
|
||||
#elif PG_VERSION >= PG_VERSION_83
|
||||
|
||||
#define PG_INTERFACE_CONTROL_VERSION(version) \
|
||||
uint32_t \
|
||||
pgInterfaceControlVersion##version(void) \
|
||||
{ \
|
||||
return PG_CONTROL_VERSION; \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Create a pg_control file for testing
|
||||
***********************************************************************************************************************************/
|
||||
@ -97,10 +125,8 @@ Create a pg_control file for testing
|
||||
ASSERT(buffer != NULL); \
|
||||
\
|
||||
((ControlFileData *)buffer)->system_identifier = pgControl.systemId; \
|
||||
((ControlFileData *)buffer)->pg_control_version = \
|
||||
pgControl.controlVersion == 0 ? PG_CONTROL_VERSION : pgControl.controlVersion; \
|
||||
((ControlFileData *)buffer)->catalog_version_no = \
|
||||
pgControl.catalogVersion == 0 ? CATALOG_VERSION_NO : pgControl.catalogVersion; \
|
||||
((ControlFileData *)buffer)->pg_control_version = PG_CONTROL_VERSION; \
|
||||
((ControlFileData *)buffer)->catalog_version_no = CATALOG_VERSION_NO; \
|
||||
((ControlFileData *)buffer)->blcksz = pgControl.pageSize; \
|
||||
((ControlFileData *)buffer)->xlog_seg_size = pgControl.walSegmentSize; \
|
||||
((ControlFileData *)buffer)->data_checksum_version = pgControl.pageChecksum; \
|
||||
@ -116,10 +142,8 @@ Create a pg_control file for testing
|
||||
ASSERT(!pgControl.pageChecksum); \
|
||||
\
|
||||
((ControlFileData *)buffer)->system_identifier = pgControl.systemId; \
|
||||
((ControlFileData *)buffer)->pg_control_version = \
|
||||
pgControl.controlVersion == 0 ? PG_CONTROL_VERSION : pgControl.controlVersion; \
|
||||
((ControlFileData *)buffer)->catalog_version_no = \
|
||||
pgControl.catalogVersion == 0 ? CATALOG_VERSION_NO : pgControl.catalogVersion; \
|
||||
((ControlFileData *)buffer)->pg_control_version = PG_CONTROL_VERSION; \
|
||||
((ControlFileData *)buffer)->catalog_version_no = CATALOG_VERSION_NO; \
|
||||
((ControlFileData *)buffer)->blcksz = pgControl.pageSize; \
|
||||
((ControlFileData *)buffer)->xlog_seg_size = pgControl.walSegmentSize; \
|
||||
}
|
||||
@ -188,8 +212,10 @@ Create a WAL file file for testing
|
||||
Call all macros with a single macro to make the vXXX.c files as simple as possible
|
||||
***********************************************************************************************************************************/
|
||||
#define PG_INTERFACE_BASE(version) \
|
||||
PG_INTERFACE_CATALOG_VERSION(version) \
|
||||
PG_INTERFACE_CONTROL_IS(version) \
|
||||
PG_INTERFACE_CONTROL(version) \
|
||||
PG_INTERFACE_CONTROL_VERSION(version) \
|
||||
PG_INTERFACE_WAL_IS(version) \
|
||||
PG_INTERFACE_WAL(version)
|
||||
|
||||
|
Reference in New Issue
Block a user