Unbreak by updating to pg_statsinfo 3.2.1.
Project moved to sourceforge, see http://pgstatsinfo.sourceforge.net/ Basic testing seems to show it works fine with postgres 9.5.
This commit is contained in:
parent
04a47aacd1
commit
9c817d924b
@ -1,18 +1,16 @@
|
||||
# $OpenBSD: Makefile,v 1.6 2016/05/13 14:41:10 pea Exp $
|
||||
# $OpenBSD: Makefile,v 1.7 2016/05/13 22:09:21 landry Exp $
|
||||
|
||||
BROKEN = doesnt build with postgresql 9.5
|
||||
COMMENT = monitor PostgreSQL activity & statistics
|
||||
|
||||
DISTNAME = pg_statsinfo-2.4.1
|
||||
DISTNAME = pg_statsinfo-3.2.1
|
||||
CATEGORIES = databases
|
||||
REVISION = 0
|
||||
|
||||
HOMEPAGE = http://pgstatsinfo.projects.pgfoundry.org/
|
||||
HOMEPAGE = http://pgstatsinfo.sourceforge.net/
|
||||
|
||||
# GPLv2
|
||||
PERMIT_PACKAGE_CDROM = Yes
|
||||
|
||||
MASTER_SITES = http://pgfoundry.org/frs/download.php/3429/
|
||||
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=pgstatsinfo/}
|
||||
|
||||
USE_GMAKE = Yes
|
||||
MAKE_FLAGS = USE_PGXS=1 CFLAGS="-DPG_USE_INLINE" LDFLAGS=-lkvm
|
||||
@ -20,6 +18,6 @@ MAKE_FLAGS = USE_PGXS=1 CFLAGS="-DPG_USE_INLINE" LDFLAGS=-lkvm
|
||||
BUILD_DEPENDS = databases/postgresql,-server
|
||||
LIB_DEPENDS = databases/postgresql
|
||||
|
||||
WANTLIB += c crypto kvm m pq pthread readline ssl termcap xml2 z
|
||||
WANTLIB += c kvm pq pthread
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
@ -1,2 +1,2 @@
|
||||
SHA256 (pg_statsinfo-2.4.1.tar.gz) = PVbKi7Kv2y2VmGW17CSeJURI8En3WfK80dgZuWDygb0=
|
||||
SIZE (pg_statsinfo-2.4.1.tar.gz) = 408287
|
||||
SHA256 (pg_statsinfo-3.2.1.tar.gz) = fyuQDaoK2OL9z9igW2OAJ40ZTNz7y2p4jmPyvpdWsJE=
|
||||
SIZE (pg_statsinfo-3.2.1.tar.gz) = 905953
|
||||
|
34
databases/pg_statsinfo/patches/patch-agent_common_h
Normal file
34
databases/pg_statsinfo/patches/patch-agent_common_h
Normal file
@ -0,0 +1,34 @@
|
||||
$OpenBSD: patch-agent_common_h,v 1.1 2016/05/13 22:09:21 landry Exp $
|
||||
--- agent/common.h.orig Fri May 13 21:03:17 2016
|
||||
+++ agent/common.h Fri May 13 21:13:03 2016
|
||||
@@ -12,9 +12,17 @@
|
||||
|
||||
#include "catalog/pg_control.h"
|
||||
|
||||
-#ifndef WIN32
|
||||
+#if !defined(WIN32)
|
||||
+#if defined(__OpenBSD__)
|
||||
+#include <sys/sched.h>
|
||||
+#include <sys/resource.h>
|
||||
+#include <sys/sysctl.h>
|
||||
+#include <paths.h>
|
||||
+#include <kvm.h>
|
||||
+#else
|
||||
#include "linux/version.h"
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
#define LINUX_VERSION_AT_LEAST(major, minor, patch) \
|
||||
(LINUX_VERSION_CODE >= KERNEL_VERSION(major, minor, patch))
|
||||
@@ -22,9 +30,11 @@
|
||||
#define GLIBC_VERSION_AT_LEAST(major, minor) \
|
||||
(__GLIBC__ > major || (__GLIBC__ == major && __GLIBC_MINOR__ >= minor))
|
||||
|
||||
+#if defined(__linux__)
|
||||
#ifndef HAVE_SYNC_FILE_RANGE
|
||||
#if (LINUX_VERSION_AT_LEAST(2,6,17) && GLIBC_VERSION_AT_LEAST(2,6))
|
||||
#define HAVE_SYNC_FILE_RANGE
|
||||
+#endif
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1,58 +0,0 @@
|
||||
$OpenBSD: patch-agent_lib_last_xact_activity_c,v 1.1 2013/10/25 21:44:48 landry Exp $
|
||||
Adapt to new API in PostgreSQL 9.3
|
||||
Shoehorned from unrelated https://github.com/dimitri/pgextwlist/pull/4/files and
|
||||
https://github.com/psoo/pg_stat_plans/commit/289ed7efefbffc72f42eb9651fc253a6cbae2ff6
|
||||
--- agent/lib/last_xact_activity.c.orig Fri Oct 25 23:25:19 2013
|
||||
+++ agent/lib/last_xact_activity.c Fri Oct 25 23:25:26 2013
|
||||
@@ -99,10 +99,10 @@ static statEntry *get_snapshot_entry(int beid);
|
||||
static Size buffer_size(int nbackends);
|
||||
#if PG_VERSION_NUM >= 90000
|
||||
static void myProcessUtility(Node *parsetree,
|
||||
- const char *queryString, ParamListInfo params, bool isTopLevel,
|
||||
+ const char *queryString, ProcessUtilityContext context, ParamListInfo params,
|
||||
DestReceiver *dest, char *completionTag);
|
||||
static void myProcessUtility0(Node *parsetree,
|
||||
- const char *queryString, ParamListInfo params, bool isTopLevel,
|
||||
+ const char *queryString, ProcessUtilityContext context, ParamListInfo params,
|
||||
DestReceiver *dest, char *completionTag);
|
||||
#endif
|
||||
#endif
|
||||
@@ -331,23 +331,23 @@ exit_transaction_if_needed()
|
||||
*/
|
||||
static void
|
||||
myProcessUtility(Node *parsetree, const char *queryString,
|
||||
- ParamListInfo params, bool isTopLevel,
|
||||
+ ProcessUtilityContext context, ParamListInfo params,
|
||||
DestReceiver *dest, char *completionTag)
|
||||
{
|
||||
/*
|
||||
* Do my process before other hook runs.
|
||||
*/
|
||||
- myProcessUtility0(parsetree, queryString, params, isTopLevel, dest,
|
||||
+ myProcessUtility0(parsetree, queryString, context, params, dest,
|
||||
completionTag);
|
||||
|
||||
PG_TRY();
|
||||
{
|
||||
if (prev_ProcessUtility_hook)
|
||||
- prev_ProcessUtility_hook(parsetree, queryString, params,
|
||||
- isTopLevel, dest, completionTag);
|
||||
+ prev_ProcessUtility_hook(parsetree, queryString, context, params,
|
||||
+ dest, completionTag);
|
||||
else
|
||||
- standard_ProcessUtility(parsetree, queryString, params,
|
||||
- isTopLevel, dest, completionTag);
|
||||
+ standard_ProcessUtility(parsetree, queryString, context, params,
|
||||
+ dest, completionTag);
|
||||
}
|
||||
PG_CATCH();
|
||||
{
|
||||
@@ -361,7 +361,7 @@ myProcessUtility(Node *parsetree, const char *queryStr
|
||||
|
||||
static void
|
||||
myProcessUtility0(Node *parsetree, const char *queryString,
|
||||
- ParamListInfo params, bool isTopLevel,
|
||||
+ ProcessUtilityContext context, ParamListInfo params,
|
||||
DestReceiver *dest, char *completionTag)
|
||||
{
|
||||
statEntry *entry;
|
@ -1,39 +1,19 @@
|
||||
$OpenBSD: patch-agent_lib_libstatsinfo_c,v 1.2 2014/12/26 12:56:56 landry Exp $
|
||||
freebsd-ports/databases/pg_statsinfo/files/patch-libstatsinfo.c
|
||||
--- agent/lib/libstatsinfo.c.orig Mon Nov 26 03:21:03 2012
|
||||
+++ agent/lib/libstatsinfo.c Fri Dec 26 13:54:46 2014
|
||||
@@ -50,9 +50,17 @@
|
||||
#include "pgut/pgut-spi.h"
|
||||
#include "../common.h"
|
||||
|
||||
-#ifndef WIN32
|
||||
+#if !defined(WIN32)
|
||||
+#if defined(__OpenBSD__)
|
||||
+#include <sys/sched.h>
|
||||
+#include <sys/resource.h>
|
||||
+#include <sys/sysctl.h>
|
||||
+#include <paths.h>
|
||||
+#include <kvm.h>
|
||||
+#else
|
||||
#include "linux/version.h"
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
/* also adjust non-critial setting parameters? */
|
||||
/* #define ADJUST_NON_CRITICAL_SETTINGS */
|
||||
@@ -1114,9 +1122,11 @@ statsinfo_restart(PG_FUNCTION_ARGS)
|
||||
$OpenBSD: patch-agent_lib_libstatsinfo_c,v 1.3 2016/05/13 22:09:21 landry Exp $
|
||||
--- agent/lib/libstatsinfo.c.orig Fri Feb 12 10:49:13 2016
|
||||
+++ agent/lib/libstatsinfo.c Fri May 13 23:34:34 2016
|
||||
@@ -1693,9 +1693,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" */
|
||||
+#if !defined(__OpenBSD__)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,41)
|
||||
+#if defined(__linux__)
|
||||
#if !LINUX_VERSION_AT_LEAST(2,5,41)
|
||||
#error kernel version 2.5.41 or later is required
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* statsinfo_cpustats - get cpu information
|
||||
@@ -1155,6 +1165,7 @@ statsinfo_cpustats_noarg(PG_FUNCTION_ARGS)
|
||||
@@ -1734,6 +1736,7 @@ statsinfo_cpustats_noarg(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_DATUM(get_cpustats(fcinfo, 0, 0, 0, 0));
|
||||
}
|
||||
|
||||
@ -41,7 +21,7 @@ freebsd-ports/databases/pg_statsinfo/files/patch-libstatsinfo.c
|
||||
static Datum
|
||||
get_cpustats(FunctionCallInfo fcinfo,
|
||||
int64 prev_cpu_user,
|
||||
@@ -1167,6 +1178,59 @@ get_cpustats(FunctionCallInfo fcinfo,
|
||||
@@ -1746,6 +1749,59 @@ get_cpustats(FunctionCallInfo fcinfo,
|
||||
int64 cpu_system;
|
||||
int64 cpu_idle;
|
||||
int64 cpu_iowait;
|
||||
@ -101,106 +81,15 @@ freebsd-ports/databases/pg_statsinfo/files/patch-libstatsinfo.c
|
||||
List *records = NIL;
|
||||
List *fields = NIL;
|
||||
HeapTuple tuple;
|
||||
@@ -1239,6 +1303,7 @@ get_cpustats(FunctionCallInfo fcinfo,
|
||||
@@ -1818,6 +1874,7 @@ get_cpustats(FunctionCallInfo fcinfo,
|
||||
|
||||
return HeapTupleGetDatum(tuple);
|
||||
}
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* statsinfo_devicestats - get device information
|
||||
@@ -1333,11 +1398,14 @@ get_devicestats(FunctionCallInfo fcinfo, ArrayType *de
|
||||
|
||||
for (row = 0; row < SPI_processed; row++)
|
||||
{
|
||||
+#if !defined(__OpenBSD__)
|
||||
HeapTupleHeader prev_devicestats;
|
||||
+#endif
|
||||
char *device;
|
||||
char *spcname;
|
||||
char *dev_major;
|
||||
char *dev_minor;
|
||||
+#if !defined(__OpenBSD__)
|
||||
char *dev_name = NULL;
|
||||
int64 readsector;
|
||||
int64 readtime;
|
||||
@@ -1346,14 +1414,18 @@ get_devicestats(FunctionCallInfo fcinfo, ArrayType *de
|
||||
int64 ioqueue;
|
||||
int64 iototaltime;
|
||||
char *record;
|
||||
+#endif
|
||||
char regex[64];
|
||||
List *devicenum = NIL;
|
||||
+#if !defined(__OpenBSD__)
|
||||
List *records = NIL;
|
||||
List *fields = NIL;
|
||||
int nfield;
|
||||
+#endif
|
||||
|
||||
device = SPI_getvalue(tuptable->vals[row], tuptable->tupdesc, 1);
|
||||
spcname = SPI_getvalue(tuptable->vals[row], tuptable->tupdesc, 2);
|
||||
+ elog(LOG, "device:%s, spc:%s\n", device, spcname);
|
||||
|
||||
if (prev_device)
|
||||
{
|
||||
@@ -1375,6 +1447,7 @@ get_devicestats(FunctionCallInfo fcinfo, ArrayType *de
|
||||
|
||||
snprintf(regex, lengthof(regex), "^\\s*%s\\s+%s\\s+", dev_major, dev_minor);
|
||||
|
||||
+#if !defined(__OpenBSD__)
|
||||
/* extract device information */
|
||||
if (exec_grep(FILE_DISKSTATS, regex, &records) <= 0)
|
||||
{
|
||||
@@ -1389,11 +1462,24 @@ get_devicestats(FunctionCallInfo fcinfo, ArrayType *de
|
||||
record = b_trim((char *) list_nth(records, 0));
|
||||
|
||||
nfield = exec_split(record, "\\s+", &fields);
|
||||
+#endif
|
||||
|
||||
memset(nulls, 0, sizeof(nulls));
|
||||
memset(values, 0, sizeof(values));
|
||||
spclist = list_truncate(spclist, 0);
|
||||
|
||||
+#if defined(__OpenBSD__)
|
||||
+ values[0] = CStringGetTextDatum("");
|
||||
+ values[1] = CStringGetTextDatum("");
|
||||
+ values[2] = CStringGetTextDatum("");
|
||||
+ values[2] = Int64GetDatum(0);
|
||||
+ values[3] = Int64GetDatum(0);
|
||||
+ values[4] = Int64GetDatum(0);
|
||||
+ values[5] = Int64GetDatum(0);
|
||||
+ values[6] = Int64GetDatum(0);
|
||||
+ values[7] = Int64GetDatum(0);
|
||||
+ values[8] = Int64GetDatum(0);
|
||||
+#else
|
||||
if (nfield == NUM_DISKSTATS_FIELDS)
|
||||
{
|
||||
/* device_major */
|
||||
@@ -1467,7 +1553,15 @@ get_devicestats(FunctionCallInfo fcinfo, ArrayType *de
|
||||
(errcode(ERRCODE_DATA_EXCEPTION),
|
||||
errmsg("unexpected file format: \"%s\"", FILE_DISKSTATS),
|
||||
errdetail("number of fields is not corresponding")));
|
||||
+#endif
|
||||
|
||||
+#if defined(__OpenBSD__)
|
||||
+ values[9] = Int16GetDatum(0);
|
||||
+ values[10] = Int16GetDatum(0);
|
||||
+ values[11] = Int16GetDatum(0);
|
||||
+ values[12] = Int16GetDatum(0);
|
||||
+ values[13] = Int16GetDatum(0);
|
||||
+#else
|
||||
/* set the overflow flag if value is smaller than previous value */
|
||||
prev_devicestats = search_devicestats(devicestats, dev_name);
|
||||
|
||||
@@ -1536,6 +1630,7 @@ get_devicestats(FunctionCallInfo fcinfo, ArrayType *de
|
||||
|
||||
spclist = lappend(spclist, spcname);
|
||||
prev_device = device;
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* store the last tuple */
|
||||
@@ -1560,10 +1655,46 @@ get_devicestats(FunctionCallInfo fcinfo, ArrayType *de
|
||||
#define NUM_DEVICESTATS_COLS 17
|
||||
#define TYPE_DEVICE_TABLESPACES TEXTOID
|
||||
@@ -1991,10 +2048,46 @@ statsinfo_devicestats(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* statsinfo_loadavg - get loadavg information
|
||||
*/
|
||||
@ -247,7 +136,7 @@ freebsd-ports/databases/pg_statsinfo/files/patch-libstatsinfo.c
|
||||
int fd;
|
||||
char buffer[256];
|
||||
int nbytes;
|
||||
@@ -1622,6 +1753,7 @@ statsinfo_loadavg(PG_FUNCTION_ARGS)
|
||||
@@ -2053,6 +2146,7 @@ statsinfo_loadavg(PG_FUNCTION_ARGS)
|
||||
|
||||
return HeapTupleGetDatum(tuple);
|
||||
}
|
||||
@ -255,7 +144,7 @@ freebsd-ports/databases/pg_statsinfo/files/patch-libstatsinfo.c
|
||||
|
||||
#define FILE_MEMINFO "/proc/meminfo"
|
||||
#define NUM_MEMORY_COLS 5
|
||||
@@ -1641,6 +1773,7 @@ compare_meminfo_table(const void *a, const void *b)
|
||||
@@ -2072,6 +2166,7 @@ compare_meminfo_table(const void *a, const void *b)
|
||||
/*
|
||||
* statsinfo_memory - get memory information
|
||||
*/
|
||||
@ -263,7 +152,7 @@ freebsd-ports/databases/pg_statsinfo/files/patch-libstatsinfo.c
|
||||
Datum
|
||||
statsinfo_memory(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -1648,6 +1781,36 @@ statsinfo_memory(PG_FUNCTION_ARGS)
|
||||
@@ -2079,6 +2174,36 @@ statsinfo_memory(PG_FUNCTION_ARGS)
|
||||
HeapTuple tuple;
|
||||
Datum values[NUM_MEMORY_COLS];
|
||||
bool nulls[NUM_MEMORY_COLS];
|
||||
@ -300,7 +189,7 @@ freebsd-ports/databases/pg_statsinfo/files/patch-libstatsinfo.c
|
||||
int fd;
|
||||
char buffer[2048];
|
||||
int nbytes;
|
||||
@@ -1746,6 +1909,7 @@ nextline:
|
||||
@@ -2177,6 +2302,7 @@ nextline:
|
||||
|
||||
return HeapTupleGetDatum(tuple);
|
||||
}
|
||||
@ -308,7 +197,7 @@ freebsd-ports/databases/pg_statsinfo/files/patch-libstatsinfo.c
|
||||
|
||||
#define FILE_PROFILE "/proc/systemtap/statsinfo_prof/profile"
|
||||
#define NUM_PROFILE_COLS 3
|
||||
@@ -1754,9 +1918,16 @@ nextline:
|
||||
@@ -2185,9 +2311,16 @@ nextline:
|
||||
/*
|
||||
* statsinfo_profile - get profile information
|
||||
*/
|
||||
@ -325,20 +214,11 @@ freebsd-ports/databases/pg_statsinfo/files/patch-libstatsinfo.c
|
||||
ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
|
||||
TupleDesc tupdesc;
|
||||
Tuplestorestate *tupstore;
|
||||
@@ -1863,6 +2034,7 @@ statsinfo_profile(PG_FUNCTION_ARGS)
|
||||
@@ -2294,6 +2427,7 @@ statsinfo_profile(PG_FUNCTION_ARGS)
|
||||
|
||||
PG_RETURN_VOID();
|
||||
}
|
||||
+#endif
|
||||
|
||||
static void
|
||||
static bool
|
||||
checked_write(int fd, const void *buf, int size)
|
||||
@@ -2226,7 +2398,7 @@ statsinfo_tablespaces(PG_FUNCTION_ARGS)
|
||||
|
||||
relation = heap_open(TableSpaceRelationId, AccessShareLock);
|
||||
|
||||
- scan = heap_beginscan(relation, SnapshotNow, 0, NULL);
|
||||
+ scan = heap_beginscan(relation, SnapshotAny, 0, NULL);
|
||||
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
|
||||
{
|
||||
Form_pg_tablespace form = (Form_pg_tablespace) GETSTRUCT(tuple);
|
||||
|
@ -1,11 +0,0 @@
|
||||
$OpenBSD: patch-agent_lib_pgut_pgut-spi_c,v 1.1 2013/10/25 21:44:48 landry Exp $
|
||||
--- agent/lib/pgut/pgut-spi.c.orig Fri Oct 25 23:40:06 2013
|
||||
+++ agent/lib/pgut/pgut-spi.c Fri Oct 25 23:41:08 2013
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "postgres.h"
|
||||
#include "pgut-spi.h"
|
||||
+#include "lib/stringinfo.h"
|
||||
|
||||
#define EXEC_FAILED(ret, expected) \
|
||||
(((expected) > 0 && (ret) != (expected)) || (ret) < 0)
|
@ -1,15 +1,13 @@
|
||||
$OpenBSD: patch-agent_lib_port_c,v 1.1.1.1 2013/10/23 22:00:19 landry Exp $
|
||||
--- agent/lib/port.c.orig Sat Aug 10 19:29:04 2013
|
||||
+++ agent/lib/port.c Sat Aug 10 19:30:16 2013
|
||||
@@ -8,7 +8,11 @@
|
||||
$OpenBSD: patch-agent_lib_port_c,v 1.2 2016/05/13 22:09:21 landry Exp $
|
||||
--- agent/lib/port.c.orig Fri May 13 21:23:03 2016
|
||||
+++ agent/lib/port.c Fri May 13 21:23:53 2016
|
||||
@@ -8,7 +8,8 @@
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
+#if defined(__OpenBSD__)
|
||||
-#include <sys/statfs.h>
|
||||
+#include <sys/param.h>
|
||||
+#include <sys/mount.h>
|
||||
+#else
|
||||
#include <sys/statfs.h>
|
||||
+#endif
|
||||
#include <unistd.h>
|
||||
|
||||
bool
|
||||
|
@ -1,14 +1,11 @@
|
||||
@comment $OpenBSD: PLIST,v 1.1.1.1 2013/10/23 22:00:19 landry Exp $
|
||||
@comment $OpenBSD: PLIST,v 1.2 2016/05/13 22:09:21 landry Exp $
|
||||
bin/archive_pglog.sh
|
||||
@bin bin/pg_statsinfo
|
||||
@bin bin/pg_statsinfod
|
||||
lib/postgresql/
|
||||
lib/postgresql/pg_statsinfo.so
|
||||
share/postgresql/
|
||||
share/postgresql/contrib/
|
||||
share/postgresql/contrib/pg_statsinfo.sql
|
||||
share/postgresql/contrib/pg_statsrepo83.sql
|
||||
share/postgresql/contrib/pg_statsrepo.sql
|
||||
share/postgresql/contrib/pg_statsrepo_alert.sql
|
||||
share/postgresql/contrib/pg_statsrepo_partition.sql
|
||||
share/postgresql/contrib/uninstall_pg_statsinfo.sql
|
||||
share/postgresql/contrib/uninstall_pg_statsrepo.sql
|
||||
|
Loading…
Reference in New Issue
Block a user