PG-1126: Expose Percona API version

This commit is contained in:
Zsolt Parragi 2024-11-11 07:48:43 +00:00
parent 3f007cac5d
commit c79499cf5b
5 changed files with 47 additions and 0 deletions

View File

@ -22,6 +22,7 @@ OBJS = \
guc_tables.o \
help_config.o \
injection_point.o \
percona.o \
pg_config.o \
pg_controldata.o \
pg_rusage.o \

View File

@ -7,6 +7,7 @@ backend_sources += files(
'guc_tables.c',
'help_config.c',
'injection_point.c',
'percona.c',
'pg_config.c',
'pg_controldata.c',
'pg_rusage.c',

View File

@ -0,0 +1,15 @@
/*-------------------------------------------------------------------------
*
* percona.c
* Percona specific functions
*
* IDENTIFICATION
* src/backend/utils/misc/percona.c
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "utils/percona.h"
const int percona_api_version = PERCONA_API_VERSION;

View File

@ -383,3 +383,5 @@
* Enable tracing of syncscan operations (see also the trace_syncscan GUC var).
*/
/* #define TRACE_SYNCSCAN */
#define PERCONA_API_VERSION 1

View File

@ -0,0 +1,28 @@
/*-------------------------------------------------------------------------
*
* percona.h
* Percona specific functions
*
* IDENTIFICATION
* src/include/utils/percona.h
*
*-------------------------------------------------------------------------
*/
#ifndef PERCONA__H__
#define PERCONA__H__
extern const PGDLLIMPORT int percona_api_version;
static inline bool check_percona_api_version(void)
{
if (PERCONA_API_VERSION != percona_api_version)
{
elog(FATAL, "Percona API version mismatch, the extension was built againts a different PostgreSQL version!");
return false;
}
return true;
}
#endif // PERCONA__H__