diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index f5fdd92..0437547 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -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 diff --git a/bg_mon.c b/bg_mon.c index a4621ed..f238745 100644 --- a/bg_mon.c +++ b/bg_mon.c @@ -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) diff --git a/postgres_stats.c b/postgres_stats.c index ed6d146..c3ccf8c 100644 --- a/postgres_stats.c +++ b/postgres_stats.c @@ -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} }; @@ -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 @@ -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); diff --git a/postgres_stats.h b/postgres_stats.h index 6fe2c8a..1867cd9 100644 --- a/postgres_stats.h +++ b/postgres_stats.h @@ -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 @@ -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" diff --git a/test.sh b/test.sh index 8484b6a..46c53ea 100644 --- a/test.sh +++ b/test.sh @@ -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 @@ -105,7 +110,7 @@ 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 @@ -113,6 +118,11 @@ function clone_cluster() { 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"