PG-194: PostgreSQL 13.3 and 14 support.
parent
1dcf596194
commit
6c2e052396
|
@ -0,0 +1,75 @@
|
||||||
|
name: pg13-test
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: pg13-test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Clone postgres repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: 'postgres/postgres'
|
||||||
|
ref: 'REL_13_STABLE'
|
||||||
|
|
||||||
|
- name: Clone pg_stat_monitor repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: 'src/pg_stat_monitor'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt purge postgresql-client-common postgresql-common postgresql postgresql*
|
||||||
|
sudo apt-get install libreadline6-dev systemtap-sdt-dev zlib1g-dev libssl-dev libpam0g-dev python-dev bison flex libipc-run-perl -y
|
||||||
|
sudo rm -rf /var/lib/postgresql/
|
||||||
|
sudo rm -rf /var/log/postgresql/
|
||||||
|
sudo rm -rf /etc/postgresql/
|
||||||
|
sudo rm -rf /usr/lib/postgresql
|
||||||
|
sudo rm -rf /usr/include/postgresql
|
||||||
|
sudo rm -rf /usr/share/postgresql
|
||||||
|
sudo rm -rf /etc/postgresql
|
||||||
|
sudo rm -f /usr/bin/pg_config
|
||||||
|
|
||||||
|
- name: Create pgsql dir
|
||||||
|
run: mkdir -p /opt/pgsql
|
||||||
|
|
||||||
|
- name: Build postgres
|
||||||
|
run: |
|
||||||
|
export PATH="/opt/pgsql/bin:$PATH"
|
||||||
|
./configure --enable-tap-tests --prefix=/opt/pgsql
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
- name: Start postgresql cluster
|
||||||
|
run: |
|
||||||
|
export PATH="/opt/pgsql/bin:$PATH"
|
||||||
|
/opt/pgsql/bin/initdb -D /opt/pgsql/data
|
||||||
|
/opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start
|
||||||
|
|
||||||
|
- name: Build pg_stat_monitor
|
||||||
|
run: |
|
||||||
|
export PATH="/opt/pgsql/bin:$PATH"
|
||||||
|
sudo cp /opt/pgsql/bin/pg_config /usr/bin
|
||||||
|
make USE_PGXS=1
|
||||||
|
make USE_PGXS=1 install
|
||||||
|
working-directory: src/pg_stat_monitor/
|
||||||
|
|
||||||
|
|
||||||
|
- name: Start pg_stat_monitor_tests
|
||||||
|
run: |
|
||||||
|
/opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile stop
|
||||||
|
echo "shared_preload_libraries = 'pg_stat_monitor'" >> /opt/pgsql/data/postgresql.conf
|
||||||
|
/opt/pgsql/bin/pg_ctl -D /opt/pgsql/data -l logfile start
|
||||||
|
make installcheck
|
||||||
|
working-directory: src/pg_stat_monitor/
|
||||||
|
|
||||||
|
- name: Report on test fail
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
if: ${{ failure() }}
|
||||||
|
with:
|
||||||
|
name: Regressions diff and postgresql log
|
||||||
|
path: |
|
||||||
|
src/pg_stat_monitor/regression.diffs
|
||||||
|
src/pg_stat_monitor/logfile
|
||||||
|
retention-days: 1
|
|
@ -52,10 +52,6 @@ do \
|
||||||
void _PG_init(void);
|
void _PG_init(void);
|
||||||
void _PG_fini(void);
|
void _PG_fini(void);
|
||||||
|
|
||||||
/*---- Initicalization Function Declarations ----*/
|
|
||||||
void _PG_init(void);
|
|
||||||
void _PG_fini(void);
|
|
||||||
|
|
||||||
/*---- Local variables ----*/
|
/*---- Local variables ----*/
|
||||||
|
|
||||||
/* Current nesting depth of ExecutorRun+ProcessUtility calls */
|
/* Current nesting depth of ExecutorRun+ProcessUtility calls */
|
||||||
|
@ -123,7 +119,7 @@ static void pgss_ExecutorFinish(QueryDesc *queryDesc);
|
||||||
static void pgss_ExecutorEnd(QueryDesc *queryDesc);
|
static void pgss_ExecutorEnd(QueryDesc *queryDesc);
|
||||||
static bool pgss_ExecutorCheckPerms(List *rt, bool abort);
|
static bool pgss_ExecutorCheckPerms(List *rt, bool abort);
|
||||||
|
|
||||||
#if PG_VERSION_NUM >= 130000
|
#if PG_VERSION_NUM >= 140000
|
||||||
static PlannedStmt * pgss_planner_hook(Query *parse, const char *query_string, int cursorOptions, ParamListInfo boundParams);
|
static PlannedStmt * pgss_planner_hook(Query *parse, const char *query_string, int cursorOptions, ParamListInfo boundParams);
|
||||||
static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||||
bool readOnlyTree,
|
bool readOnlyTree,
|
||||||
|
@ -131,6 +127,13 @@ static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||||
ParamListInfo params, QueryEnvironment *queryEnv,
|
ParamListInfo params, QueryEnvironment *queryEnv,
|
||||||
DestReceiver *dest,
|
DestReceiver *dest,
|
||||||
QueryCompletion *qc);
|
QueryCompletion *qc);
|
||||||
|
#elif PG_VERSION_NUM >= 130000
|
||||||
|
static PlannedStmt * pgss_planner_hook(Query *parse, const char *query_string, int cursorOptions, ParamListInfo boundParams);
|
||||||
|
static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||||
|
ProcessUtilityContext context,
|
||||||
|
ParamListInfo params, QueryEnvironment *queryEnv,
|
||||||
|
DestReceiver *dest,
|
||||||
|
QueryCompletion *qc);
|
||||||
#else
|
#else
|
||||||
static void BufferUsageAccumDiff(BufferUsage* bufusage, BufferUsage* pgBufferUsage, BufferUsage* bufusage_start);
|
static void BufferUsageAccumDiff(BufferUsage* bufusage, BufferUsage* pgBufferUsage, BufferUsage* bufusage_start);
|
||||||
static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||||
|
@ -215,7 +218,6 @@ void
|
||||||
_PG_init(void)
|
_PG_init(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
elog(DEBUG2, "pg_stat_monitor: %s()", __FUNCTION__);
|
elog(DEBUG2, "pg_stat_monitor: %s()", __FUNCTION__);
|
||||||
/*
|
/*
|
||||||
* In order to create our shared memory area, we have to be loaded via
|
* In order to create our shared memory area, we have to be loaded via
|
||||||
|
@ -762,7 +764,7 @@ pgss_planner_hook(Query *parse, const char *query_string, int cursorOptions, Par
|
||||||
/*
|
/*
|
||||||
* ProcessUtility hook
|
* ProcessUtility hook
|
||||||
*/
|
*/
|
||||||
#if PG_VERSION_NUM >= 130000
|
#if PG_VERSION_NUM >= 140000
|
||||||
static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||||
bool readOnlyTree,
|
bool readOnlyTree,
|
||||||
ProcessUtilityContext context,
|
ProcessUtilityContext context,
|
||||||
|
@ -770,6 +772,13 @@ static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||||
DestReceiver *dest,
|
DestReceiver *dest,
|
||||||
QueryCompletion *qc)
|
QueryCompletion *qc)
|
||||||
|
|
||||||
|
#elif PG_VERSION_NUM >= 130000
|
||||||
|
static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||||
|
ProcessUtilityContext context,
|
||||||
|
ParamListInfo params, QueryEnvironment *queryEnv,
|
||||||
|
DestReceiver *dest,
|
||||||
|
QueryCompletion *qc)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||||
ProcessUtilityContext context, ParamListInfo params,
|
ProcessUtilityContext context, ParamListInfo params,
|
||||||
|
@ -811,7 +820,7 @@ static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||||
INSTR_TIME_SET_CURRENT(start);
|
INSTR_TIME_SET_CURRENT(start);
|
||||||
PG_TRY();
|
PG_TRY();
|
||||||
{
|
{
|
||||||
#if PG_VERSION_NUM >= 130000
|
#if PG_VERSION_NUM >= 140000
|
||||||
if (prev_ProcessUtility)
|
if (prev_ProcessUtility)
|
||||||
prev_ProcessUtility(pstmt, queryString,
|
prev_ProcessUtility(pstmt, queryString,
|
||||||
readOnlyTree,
|
readOnlyTree,
|
||||||
|
@ -824,6 +833,17 @@ static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||||
context, params, queryEnv,
|
context, params, queryEnv,
|
||||||
dest,
|
dest,
|
||||||
qc);
|
qc);
|
||||||
|
#elif PG_VERSION_NUM >= 130000
|
||||||
|
if (prev_ProcessUtility)
|
||||||
|
prev_ProcessUtility(pstmt, queryString,
|
||||||
|
context, params, queryEnv,
|
||||||
|
dest,
|
||||||
|
qc);
|
||||||
|
else
|
||||||
|
standard_ProcessUtility(pstmt, queryString,
|
||||||
|
context, params, queryEnv,
|
||||||
|
dest,
|
||||||
|
qc);
|
||||||
#else
|
#else
|
||||||
if (prev_ProcessUtility)
|
if (prev_ProcessUtility)
|
||||||
prev_ProcessUtility(pstmt, queryString,
|
prev_ProcessUtility(pstmt, queryString,
|
||||||
|
@ -833,7 +853,8 @@ static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||||
else
|
else
|
||||||
standard_ProcessUtility(pstmt, queryString,
|
standard_ProcessUtility(pstmt, queryString,
|
||||||
context, params, queryEnv,
|
context, params, queryEnv,
|
||||||
dest);
|
dest,
|
||||||
|
completionTag);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
PG_CATCH();
|
PG_CATCH();
|
||||||
|
@ -871,7 +892,7 @@ static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if PG_VERSION_NUM >= 130000
|
#if PG_VERSION_NUM >= 140000
|
||||||
if (prev_ProcessUtility)
|
if (prev_ProcessUtility)
|
||||||
prev_ProcessUtility(pstmt, queryString,
|
prev_ProcessUtility(pstmt, queryString,
|
||||||
readOnlyTree,
|
readOnlyTree,
|
||||||
|
@ -883,6 +904,16 @@ static void pgss_ProcessUtility(PlannedStmt *pstmt, const char *queryString,
|
||||||
context, params, queryEnv,
|
context, params, queryEnv,
|
||||||
dest,
|
dest,
|
||||||
qc);
|
qc);
|
||||||
|
#elif PG_VERSION_NUM >= 130000
|
||||||
|
if (prev_ProcessUtility)
|
||||||
|
prev_ProcessUtility(pstmt, queryString,
|
||||||
|
context, params, queryEnv,
|
||||||
|
dest,
|
||||||
|
qc);
|
||||||
|
standard_ProcessUtility(pstmt, queryString,
|
||||||
|
context, params, queryEnv,
|
||||||
|
dest,
|
||||||
|
qc);
|
||||||
#else
|
#else
|
||||||
if (prev_ProcessUtility)
|
if (prev_ProcessUtility)
|
||||||
prev_ProcessUtility(pstmt, queryString,
|
prev_ProcessUtility(pstmt, queryString,
|
||||||
|
|
Loading…
Reference in New Issue