From 35199bb658b374176855b6874f92ec18d1370d55 Mon Sep 17 00:00:00 2001 From: jeremy Date: Tue, 19 Feb 2019 05:10:26 +0000 Subject: [PATCH] Update to pg_statsinfo 10.0 to work with PostgreSQL 11 OK ajacoutot@ --- databases/pg_statsinfo/Makefile | 5 +- databases/pg_statsinfo/distinfo | 4 +- .../patches/patch-agent_bin_pgut_pgut_c | 19 ------ .../patch-agent_lib_last_xact_activity_c | 60 ------------------- .../patches/patch-agent_lib_libstatsinfo_c | 56 ++++++++--------- .../patches/patch-reporter_pgut_pgut_c | 19 ------ 6 files changed, 28 insertions(+), 135 deletions(-) delete mode 100644 databases/pg_statsinfo/patches/patch-agent_bin_pgut_pgut_c delete mode 100644 databases/pg_statsinfo/patches/patch-agent_lib_last_xact_activity_c delete mode 100644 databases/pg_statsinfo/patches/patch-reporter_pgut_pgut_c diff --git a/databases/pg_statsinfo/Makefile b/databases/pg_statsinfo/Makefile index 5c143e4067f..95e1f6bfaff 100644 --- a/databases/pg_statsinfo/Makefile +++ b/databases/pg_statsinfo/Makefile @@ -1,10 +1,9 @@ -# $OpenBSD: Makefile,v 1.11 2018/06/01 14:24:55 sthen Exp $ +# $OpenBSD: Makefile,v 1.12 2019/02/19 05:10:26 jeremy Exp $ COMMENT = monitor PostgreSQL activity & statistics -DISTNAME = pg_statsinfo-3.3.0 +DISTNAME = pg_statsinfo-10.0 CATEGORIES = databases -REVISION = 0 HOMEPAGE = http://pgstatsinfo.sourceforge.net/ diff --git a/databases/pg_statsinfo/distinfo b/databases/pg_statsinfo/distinfo index a016e9e4f7e..c0b9be1907e 100644 --- a/databases/pg_statsinfo/distinfo +++ b/databases/pg_statsinfo/distinfo @@ -1,2 +1,2 @@ -SHA256 (pg_statsinfo-3.3.0.tar.gz) = OOxbFr1QyHZAo1f7qxEhXHknihc+H/+ZFM1rzF1FFQw= -SIZE (pg_statsinfo-3.3.0.tar.gz) = 912251 +SHA256 (pg_statsinfo-10.0.tar.gz) = l/IPCUHrYI5JQFvZz83N06rXoZ4eb8TpNaHVkkp4DKM= +SIZE (pg_statsinfo-10.0.tar.gz) = 921560 diff --git a/databases/pg_statsinfo/patches/patch-agent_bin_pgut_pgut_c b/databases/pg_statsinfo/patches/patch-agent_bin_pgut_pgut_c deleted file mode 100644 index 5fd7d49cd29..00000000000 --- a/databases/pg_statsinfo/patches/patch-agent_bin_pgut_pgut_c +++ /dev/null @@ -1,19 +0,0 @@ -$OpenBSD: patch-agent_bin_pgut_pgut_c,v 1.1 2017/11/30 16:16:24 jeremy Exp $ - -Fix build with PostgreSQL 10. - -Index: agent/bin/pgut/pgut.c ---- agent/bin/pgut/pgut.c.orig -+++ agent/bin/pgut/pgut.c -@@ -388,7 +388,10 @@ parse_time(const char *value, time_t *time) - static char * - prompt_for_password(void) - { -- return simple_prompt("Password: ", 100, false); -+ char * dest; -+ dest = malloc(100); -+ simple_prompt("Password: ", dest, 100, false); -+ return dest; - } - - #if PG_VERSION_NUM < 80300 diff --git a/databases/pg_statsinfo/patches/patch-agent_lib_last_xact_activity_c b/databases/pg_statsinfo/patches/patch-agent_lib_last_xact_activity_c deleted file mode 100644 index fdd64bf7b60..00000000000 --- a/databases/pg_statsinfo/patches/patch-agent_lib_last_xact_activity_c +++ /dev/null @@ -1,60 +0,0 @@ -$OpenBSD: patch-agent_lib_last_xact_activity_c,v 1.3 2017/11/30 16:18:22 jeremy Exp $ - -Index: agent/lib/last_xact_activity.c ---- agent/lib/last_xact_activity.c.orig -+++ agent/lib/last_xact_activity.c -@@ -97,10 +97,11 @@ static void make_status_snapshot(void); - static statEntry *get_snapshot_entry(int beid); - static Size buffer_size(int nbackends); - #if PG_VERSION_NUM >= 90000 --static void myProcessUtility0(Node *parsetree, const char *queryString); -+static void myProcessUtility0(PlannedStmt *pstmt, const char *queryString); - #if PG_VERSION_NUM >= 90300 --static void myProcessUtility(Node *parsetree, const char *queryString, -+static void myProcessUtility(PlannedStmt *pstmt, const char *queryString, - ProcessUtilityContext context, ParamListInfo params, -+ QueryEnvironment *queryEnv, - DestReceiver *dest, char *completionTag); - #else - static void myProcessUtility(Node *parsetree, -@@ -326,10 +327,11 @@ exit_transaction_if_needed() - } - - static void --myProcessUtility0(Node *parsetree, const char *queryString) -+myProcessUtility0(PlannedStmt *pstmt, const char *queryString) - { - statEntry *entry; - TransactionStmt *stmt; -+ Node *parsetree = pstmt->utilityStmt; - - entry = get_stat_entry(MyBackendId); - -@@ -412,22 +414,23 @@ myProcessUtility0(Node *parsetree, const char *querySt - */ - #if PG_VERSION_NUM >= 90300 - static void --myProcessUtility(Node *parsetree, const char *queryString, -+myProcessUtility(PlannedStmt *pstmt, const char *queryString, - ProcessUtilityContext context, ParamListInfo params, -+ QueryEnvironment *queryEnv, - DestReceiver *dest, char *completionTag) - { - /* - * Do my process before other hook runs. - */ -- myProcessUtility0(parsetree, queryString); -+ myProcessUtility0(pstmt, queryString); - - PG_TRY(); - { - if (prev_ProcessUtility_hook) -- prev_ProcessUtility_hook(parsetree, queryString, context, params, -+ prev_ProcessUtility_hook(pstmt, queryString, context, params, queryEnv, - dest, completionTag); - else -- standard_ProcessUtility(parsetree, queryString, context, params, -+ standard_ProcessUtility(pstmt, queryString, context, params, queryEnv, - dest, completionTag); - } - PG_CATCH(); diff --git a/databases/pg_statsinfo/patches/patch-agent_lib_libstatsinfo_c b/databases/pg_statsinfo/patches/patch-agent_lib_libstatsinfo_c index 7f003395414..8677c925d52 100644 --- a/databases/pg_statsinfo/patches/patch-agent_lib_libstatsinfo_c +++ b/databases/pg_statsinfo/patches/patch-agent_lib_libstatsinfo_c @@ -1,4 +1,4 @@ -$OpenBSD: patch-agent_lib_libstatsinfo_c,v 1.5 2017/11/30 16:18:22 jeremy Exp $ +$OpenBSD: patch-agent_lib_libstatsinfo_c,v 1.6 2019/02/19 05:10:26 jeremy Exp $ Work with PostgreSQL 10. @@ -13,15 +13,6 @@ Index: agent/lib/libstatsinfo.c #include #include #include -@@ -19,7 +20,7 @@ - #include "catalog/pg_control.h" - #include "catalog/pg_tablespace.h" - #include "funcapi.h" --#include "libpq/ip.h" -+#include "common/ip.h" - #include "libpq/pqsignal.h" - #include "mb/pg_wchar.h" - #include "regex/regex.h" @@ -37,6 +38,7 @@ #include "utils/tqual.h" #include "utils/lsyscache.h" @@ -30,15 +21,24 @@ Index: agent/lib/libstatsinfo.c #if PG_VERSION_NUM >= 90100 #include "catalog/pg_collation.h" -@@ -566,6 +568,7 @@ sample_activity(void) - int waiting; - int running; +@@ -595,6 +597,7 @@ sample_activity(void) + int waiting = 0; + int running = 0; int i; + volatile PGPROC *proc = MyProc; if (!long_xacts) { -@@ -1853,9 +1856,11 @@ statsinfo_restart(PG_FUNCTION_ARGS) +@@ -708,7 +711,7 @@ sample_activity(void) + " in transaction", pgstat_track_activity_query_size); + else + strlcpy(entry->query, +- be->st_activity, pgstat_track_activity_query_size); ++ be->st_activity_raw, pgstat_track_activity_query_size); + #else + strlcpy(entry->query, + be->st_activity, pgstat_track_activity_query_size); +@@ -1882,9 +1885,11 @@ statsinfo_restart(PG_FUNCTION_ARGS) #define NUM_STAT_FIELDS_MIN 6 /* not support a kernel that does not have the required fields at "/proc/stat" */ @@ -50,7 +50,7 @@ Index: agent/lib/libstatsinfo.c /* * statsinfo_cpustats - get cpu information -@@ -1894,6 +1899,7 @@ statsinfo_cpustats_noarg(PG_FUNCTION_ARGS) +@@ -1923,6 +1928,7 @@ statsinfo_cpustats_noarg(PG_FUNCTION_ARGS) PG_RETURN_DATUM(get_cpustats(fcinfo, 0, 0, 0, 0)); } @@ -58,7 +58,7 @@ Index: agent/lib/libstatsinfo.c static Datum get_cpustats(FunctionCallInfo fcinfo, int64 prev_cpu_user, -@@ -1906,6 +1912,59 @@ get_cpustats(FunctionCallInfo fcinfo, +@@ -1935,6 +1941,59 @@ get_cpustats(FunctionCallInfo fcinfo, int64 cpu_system; int64 cpu_idle; int64 cpu_iowait; @@ -118,7 +118,7 @@ Index: agent/lib/libstatsinfo.c List *records = NIL; List *fields = NIL; HeapTuple tuple; -@@ -1978,6 +2037,7 @@ get_cpustats(FunctionCallInfo fcinfo, +@@ -2007,6 +2066,7 @@ get_cpustats(FunctionCallInfo fcinfo, return HeapTupleGetDatum(tuple); } @@ -126,7 +126,7 @@ Index: agent/lib/libstatsinfo.c #define NUM_DEVICESTATS_COLS 17 #define TYPE_DEVICE_TABLESPACES TEXTOID -@@ -2151,10 +2211,46 @@ statsinfo_devicestats(PG_FUNCTION_ARGS) +@@ -2180,10 +2240,46 @@ statsinfo_devicestats(PG_FUNCTION_ARGS) /* * statsinfo_loadavg - get loadavg information */ @@ -173,7 +173,7 @@ Index: agent/lib/libstatsinfo.c int fd; char buffer[256]; int nbytes; -@@ -2213,6 +2309,7 @@ statsinfo_loadavg(PG_FUNCTION_ARGS) +@@ -2242,6 +2338,7 @@ statsinfo_loadavg(PG_FUNCTION_ARGS) return HeapTupleGetDatum(tuple); } @@ -181,7 +181,7 @@ Index: agent/lib/libstatsinfo.c #define FILE_MEMINFO "/proc/meminfo" #define NUM_MEMORY_COLS 5 -@@ -2232,6 +2329,7 @@ compare_meminfo_table(const void *a, const void *b) +@@ -2261,6 +2358,7 @@ compare_meminfo_table(const void *a, const void *b) /* * statsinfo_memory - get memory information */ @@ -189,7 +189,7 @@ Index: agent/lib/libstatsinfo.c Datum statsinfo_memory(PG_FUNCTION_ARGS) { -@@ -2239,6 +2337,36 @@ statsinfo_memory(PG_FUNCTION_ARGS) +@@ -2268,6 +2366,36 @@ statsinfo_memory(PG_FUNCTION_ARGS) HeapTuple tuple; Datum values[NUM_MEMORY_COLS]; bool nulls[NUM_MEMORY_COLS]; @@ -226,7 +226,7 @@ Index: agent/lib/libstatsinfo.c int fd; char buffer[2048]; int nbytes; -@@ -2337,6 +2465,7 @@ nextline: +@@ -2366,6 +2494,7 @@ nextline: return HeapTupleGetDatum(tuple); } @@ -234,7 +234,7 @@ Index: agent/lib/libstatsinfo.c #define FILE_PROFILE "/proc/systemtap/statsinfo_prof/profile" #define NUM_PROFILE_COLS 3 -@@ -2345,9 +2474,16 @@ nextline: +@@ -2374,9 +2503,16 @@ nextline: /* * statsinfo_profile - get profile information */ @@ -251,7 +251,7 @@ Index: agent/lib/libstatsinfo.c ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo; TupleDesc tupdesc; Tuplestorestate *tupstore; -@@ -2454,6 +2590,7 @@ statsinfo_profile(PG_FUNCTION_ARGS) +@@ -2483,6 +2619,7 @@ statsinfo_profile(PG_FUNCTION_ARGS) PG_RETURN_VOID(); } @@ -259,11 +259,3 @@ Index: agent/lib/libstatsinfo.c static bool checked_write(int fd, const void *buf, int size) -@@ -2557,7 +2694,6 @@ StartStatsinfoLauncher(void) - worker.bgw_flags = BGWORKER_SHMEM_ACCESS; - worker.bgw_start_time = BgWorkerStart_PostmasterStart; - worker.bgw_restart_time = BGW_NEVER_RESTART; -- worker.bgw_main = StatsinfoLauncherMain; - worker.bgw_main_arg = (Datum) NULL; - #if PG_VERSION_NUM >= 90400 - worker.bgw_notify_pid = 0; diff --git a/databases/pg_statsinfo/patches/patch-reporter_pgut_pgut_c b/databases/pg_statsinfo/patches/patch-reporter_pgut_pgut_c deleted file mode 100644 index 197eaa5237a..00000000000 --- a/databases/pg_statsinfo/patches/patch-reporter_pgut_pgut_c +++ /dev/null @@ -1,19 +0,0 @@ -$OpenBSD: patch-reporter_pgut_pgut_c,v 1.1 2017/11/30 16:18:22 jeremy Exp $ - -Work with PostgreSQL 10. - -Index: reporter/pgut/pgut.c ---- reporter/pgut/pgut.c.orig -+++ reporter/pgut/pgut.c -@@ -387,7 +387,10 @@ parse_time(const char *value, time_t *time) - static char * - prompt_for_password(void) - { -- return simple_prompt("Password: ", 100, false); -+ char * dest; -+ dest = malloc(100); -+ simple_prompt("Password: ", dest, 100, false); -+ return dest; - } - - #if PG_VERSION_NUM < 80300