Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Compatibility with PG17 beta1 #66

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,32 @@ jobs:
matrix:
include:
- postgres-version: '9.3'
os: ubuntu-22.04
- postgres-version: '9.4'
os: ubuntu-20.04
- postgres-version: '9.5'
- postgres-version: '9.4'
os: ubuntu-22.04
- postgres-version: '9.5'
os: ubuntu-24.04
- postgres-version: '9.6'
os: ubuntu-20.04
- postgres-version: '10'
os: ubuntu-22.04
- postgres-version: '11'
os: ubuntu-20.04
os: ubuntu-24.04
- postgres-version: '12'
os: ubuntu-22.04
- postgres-version: '13'
os: ubuntu-20.04
- postgres-version: '14'
- postgres-version: '13'
os: ubuntu-22.04
- postgres-version: '14'
os: ubuntu-24.04
- postgres-version: '15'
os: ubuntu-20.04
- postgres-version: '16'
os: ubuntu-22.04
- postgres-version: '17'
os: ubuntu-24.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up packages
run: |
set -e
Expand Down
2 changes: 2 additions & 0 deletions bg_mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ static const char *process_type(pg_stat_activity p)
QUOTE(STATS_COLLECTOR_PROC_NAME),
QUOTE(LOGGER_PROC_NAME),
QUOTE(STANDALONE_BACKEND_PROC_NAME),
QUOTE(SLOTSYNC_WORKER_PROC_NAME),
QUOTE(WAL_SUMMARIZER_PROC_NAME),
QUOTE(PARALLEL_WORKER_NAME),
QUOTE(LOGICAL_LAUNCHER_NAME),
QUOTE(LOGICAL_WORKER_NAME)
Expand Down
18 changes: 15 additions & 3 deletions postgres_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,10 @@ static PgBackendType parse_cmdline(const char * const buf, const char **rest)
AUX_BACKEND(STATS_COLLECTOR),
AUX_BACKEND(WAL_WRITER),
AUX_BACKEND(BG_WRITER),
#if PG_VERSION_NUM >= 170000
AUX_BACKEND(SLOTSYNC_WORKER),
AUX_BACKEND(WAL_SUMMARIZER),
#endif
OTH_BACKEND(UNKNOWN),
{NULL, 0, PG_UNDEFINED}
};
Expand Down Expand Up @@ -1010,11 +1014,17 @@ static PgBackendType map_backend_type(BackendType type)
#if PG_VERSION_NUM >= 160000
case B_STANDALONE_BACKEND:
return PG_STANDALONE_BACKEND;
#endif
#if PG_VERSION_NUM >= 170000
case B_SLOTSYNC_WORKER:
return PG_SLOTSYNC_WORKER;
case B_WAL_SUMMARIZER:
return PG_WAL_SUMMARIZER;
#endif
case B_BG_WORKER:
default:
return PG_UNDEFINED;
break;
}
return PG_UNDEFINED;
}
#endif

Expand Down Expand Up @@ -1141,7 +1151,9 @@ static void get_pg_stat_activity(pg_stat_activity_list *pg_stats)

if (init_postgres)
{
#if PG_VERSION_NUM >= 150000
#if PG_VERSION_NUM >= 170000
InitPostgres("postgres", InvalidOid, NULL, InvalidOid, 0, NULL);
#elif PG_VERSION_NUM >= 150000
InitPostgres("postgres", InvalidOid, NULL, InvalidOid, false, false, NULL);
#elif PG_VERSION_NUM >= 110000
InitPostgres("postgres", InvalidOid, NULL, InvalidOid, NULL, false);
Expand Down
4 changes: 4 additions & 0 deletions postgres_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ typedef enum PgBackendType
PG_STATS_COLLECTOR,
PG_LOGGER,
PG_STANDALONE_BACKEND,
PG_SLOTSYNC_WORKER,
PG_WAL_SUMMARIZER,
PG_PARALLEL_WORKER,
PG_LOGICAL_LAUNCHER,
PG_LOGICAL_WORKER
Expand All @@ -29,6 +31,8 @@ typedef enum PgBackendType
#define AUTOVAC_WORKER_PROC_NAME "autovacuum worker"
#define BACKEND_PROC_NAME "backend"
#define STANDALONE_BACKEND_PROC_NAME "standalone backend"
#define SLOTSYNC_WORKER_PROC_NAME "slotsync worker"
#define WAL_SUMMARIZER_PROC_NAME "walsummarizer"
#define BG_WRITER_NAME "bgwriter"
#define CHECKPOINTER_PROC_NAME "checkpointer"
#define STARTUP_PROC_NAME "startup"
Expand Down
18 changes: 14 additions & 4 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,20 @@ bg_mon.port = $(($bport+$1))" >> test_cluster$1/postgresql.conf
else
echo "wal_level = 'hot_standby'" >> test_cluster$1/postgresql.conf
fi
if [[ ${version%.*} -ge 17 ]]; then
echo "sync_replication_slots = 'on'
hot_standby_feedback = 'on'
primary_slot_name = 'standby'
summarize_wal = 'on'" >> test_cluster$1/postgresql.conf
fi
start_postgres $1
}

function curl_ps_loop() {
for a in $(seq 1 $2); do
curl -s -H "Accept-Encoding: br" http://localhost:$(($bport+$1)) | brotli -d
echo
curl -s -H "Accept-Encoding: br" http://localhost:$(($bport+$1)) | brotli -d || true
sleep 1
if [[ ! -z "$3" ]]; then
if [[ ! -z "$3" ]]; then
ps auxwwwf | grep postgres
fi
done
Expand All @@ -105,14 +110,19 @@ function clone_cluster() {
mkdir test_cluster$1
chmod 700 test_cluster1
if [[ $version =~ ^[1-9][0-9]$ ]]; then opt="-X none"; fi
time pg_basebackup $opt -R -c fast -h localhost -p $port -F t -D - | pv -qL 3M | tar -C test_cluster1 -x || true
time pg_basebackup $opt --dbname "host=localhost port=$port dbname=postgres" -R -c fast -F t -D - | pv -qL 3M | tar -C test_cluster1 -x || true
echo "bg_mon.port = $(($bport+$1))" >> test_cluster$1/postgresql.conf
start_postgres $1
curl_ps_loop $1 10
}

create_cluster 0

if [[ ${version%.*} -ge 17 ]]; then
psql -h localhost -p $port -d postgres -c "select pg_create_physical_replication_slot('standby')"
psql -h localhost -p $port -d postgres -c "select pg_create_logical_replication_slot('failover', 'pgoutput', failover => true)"
fi

if [[ ${version%.*} -ge 13 ]]; then
# PROCSIG_BARRIER handling test
psql -h localhost -p $port -d postgres -c "CREATE DATABASE test"
Expand Down
Loading