diff options
author | Pavan Deolasee | 2016-04-11 05:14:59 +0000 |
---|---|---|
committer | Pavan Deolasee | 2016-10-18 10:05:04 +0000 |
commit | 028cc6630df1843880f1780c2b92d5b94a4bb85e (patch) | |
tree | b68f01dfa342d43f3323711b2816da49d9d3bcf6 | |
parent | eed242e84c34d254873b58e000918b3d1c63d3c1 (diff) |
Make changes and bug fixes to let compilation and regression run on smartos
We don't yet officially support the platform, given very little testing done so
far on this platform. But we don't stop others to doing it either. So
committing these changes upstream.
Reports, investigation and patches by Patrick Sodré.
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | src/backend/executor/nodeAgg.c | 10 | ||||
-rw-r--r-- | src/backend/pgxc/pool/pgxcnode.c | 4 | ||||
-rw-r--r-- | src/backend/pgxc/pool/poolcomm.c | 5 | ||||
-rw-r--r-- | src/backend/utils/adt/dbsize.c | 31 | ||||
-rw-r--r-- | src/backend/utils/sort/tuplesort.c | 2 | ||||
-rw-r--r-- | src/gtm/gtm_ctl/Makefile | 6 | ||||
-rw-r--r-- | src/gtm/main/Makefile | 6 | ||||
-rw-r--r-- | src/gtm/proxy/Makefile | 4 | ||||
-rw-r--r-- | src/interfaces/libpq/fe-auth.c | 3 | ||||
-rw-r--r-- | src/port/getpeereid.c | 3 | ||||
-rw-r--r-- | src/test/regress/resultmap | 1 |
12 files changed, 55 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore index 13c4bde5e6..12b9d98152 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ win32ver.rc lib*dll.def *~ lib*.pc +tags # Local excludes in root directory /GNUmakefile @@ -41,3 +42,4 @@ lib*.pc /cscope* /.gitignore /tmp_install/ +.tags diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index 30d6efacb2..6b5dc56a0a 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -1117,10 +1117,14 @@ finalize_aggregate(AggState *aggstate, * copy the initial datum since it might get changed inside the * collection function */ - fcinfo.arg[0] = datumCopy(peraggstate->initCollectValue, - peraggstate->collecttypeByVal, - peraggstate->collecttypeLen); fcinfo.argnull[0] = peraggstate->initCollectValueIsNull; + fcinfo.arg[0] = (Datum) NULL; + if (!fcinfo.argnull[0]) + { + fcinfo.arg[0] = datumCopy(peraggstate->initCollectValue, + peraggstate->collecttypeByVal, + peraggstate->collecttypeLen); + } value = FunctionCallInvoke(&fcinfo); isnull = fcinfo.isnull; } diff --git a/src/backend/pgxc/pool/pgxcnode.c b/src/backend/pgxc/pool/pgxcnode.c index ee8be9b837..7b9b7855ab 100644 --- a/src/backend/pgxc/pool/pgxcnode.c +++ b/src/backend/pgxc/pool/pgxcnode.c @@ -20,6 +20,10 @@ #include "postgres.h" #include <poll.h> +#ifdef __sun +#include <sys/filio.h> +#endif + #include <sys/time.h> #include <sys/types.h> #include <sys/ioctl.h> diff --git a/src/backend/pgxc/pool/poolcomm.c b/src/backend/pgxc/pool/poolcomm.c index 29f88df55d..ddc58b4a96 100644 --- a/src/backend/pgxc/pool/poolcomm.c +++ b/src/backend/pgxc/pool/poolcomm.c @@ -11,6 +11,11 @@ *------------------------------------------------------------------------- */ +#ifdef __sun +#define _XOPEN_SOURCE 500 +#define uint uint32_t +#endif + #include <sys/types.h> #include <sys/socket.h> #include <sys/uio.h> diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c index 4021f8fb39..50daac1f2b 100644 --- a/src/backend/utils/adt/dbsize.c +++ b/src/backend/utils/adt/dbsize.c @@ -1021,6 +1021,7 @@ pgxc_execute_on_nodes(int numnodes, Oid *nodelist, char *query) int64 total_size = 0; int64 size = 0; Datum datum = (Datum) 0; + bool isnull = true; #ifdef XCP EState *estate; @@ -1082,13 +1083,27 @@ pgxc_execute_on_nodes(int numnodes, Oid *nodelist, char *query) MemoryContextSwitchTo(oldcontext); result = ExecRemoteQuery(pstate); - while (!TupIsNull(result)) + while (result != NULL && !TupIsNull(result)) { - bool isnull; datum = slot_getattr(result, 1, &isnull); - size = DatumGetInt64(datum); - total_size += size; result = ExecRemoteQuery(pstate); + + /* For single node, don't assume the type of datum. It can be bool also. */ + if (numnodes == 1) + continue; + /* We should not cast a null into an int */ + if (isnull) + { + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("Expected Int64 but got null instead " + "while executing query '%s'", + query))); + break; + } + + size = DatumGetInt64(datum); + total_size += size; } ExecEndRemoteQuery(pstate); #else @@ -1136,7 +1151,15 @@ pgxc_execute_on_nodes(int numnodes, Oid *nodelist, char *query) #endif if (numnodes == 1) + { + if (isnull) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("Expected datum but got null instead " + "while executing query '%s'", + query))); PG_RETURN_DATUM(datum); + } else PG_RETURN_INT64(total_size); } diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 5250c58ca8..bc4f327454 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -1061,7 +1061,7 @@ tuplesort_begin_merge(TupleDesc tupDesc, state->mergenext = (int *) palloc0(combiner->conn_count * sizeof(int)); state->mergelast = (int *) palloc0(combiner->conn_count * sizeof(int)); state->mergeavailslots = (int *) palloc0(combiner->conn_count * sizeof(int)); - state->mergeavailmem = (long *) palloc0(combiner->conn_count * sizeof(long)); + state->mergeavailmem = (int64 *) palloc0(combiner->conn_count * sizeof(int64)); state->tp_runs = (int *) palloc0(combiner->conn_count * sizeof(int)); state->tp_dummy = (int *) palloc0(combiner->conn_count * sizeof(int)); diff --git a/src/gtm/gtm_ctl/Makefile b/src/gtm/gtm_ctl/Makefile index 03bd792a07..cece470f91 100644 --- a/src/gtm/gtm_ctl/Makefile +++ b/src/gtm/gtm_ctl/Makefile @@ -11,14 +11,10 @@ top_builddir=../../.. include $(top_builddir)/src/Makefile.global subdir = src/gtm/gtm_ctl -OBJS=gtm_ctl.o +OBJS=gtm_ctl.o OTHERS=../common/libgtm.a ../libpq/libpqcomm.a ../client/libgtmclient.a ../path/libgtmpath.a -LDFLAGS=-L$(top_builddir)/common -L$(top_builddir)/libpq - - -LIBS=-lpthread gtm_ctl:$(OBJS) $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $^ $(OTHERS) -o gtm_ctl diff --git a/src/gtm/main/Makefile b/src/gtm/main/Makefile index ebd22fc2d8..61ceffac2b 100644 --- a/src/gtm/main/Makefile +++ b/src/gtm/main/Makefile @@ -17,11 +17,7 @@ endif OBJS=main.o gtm_thread.o gtm_txn.o gtm_seq.o gtm_snap.o gtm_standby.o gtm_opt.o gtm_backup.o -OTHERS= ../libpq/libpqcomm.a ../path/libgtmpath.a ../recovery/libgtmrecovery.a ../client/libgtmclient.a ../common/libgtm.a ../../port/libpgport.a - -LDFLAGS=-L$(top_builddir)/common -L$(top_builddir)/libpq - -LIBS=-lpthread +OTHERS= ../libpq/libpqcomm.a ../path/libgtmpath.a ../recovery/libgtmrecovery.a ../client/libgtmclient.a ../common/libgtm.a ../../port/libpgport.a gtm:$(OBJS) $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $^ $(OTHERS) -o gtm diff --git a/src/gtm/proxy/Makefile b/src/gtm/proxy/Makefile index ee0aa1cdd8..e03d07ff64 100644 --- a/src/gtm/proxy/Makefile +++ b/src/gtm/proxy/Makefile @@ -19,10 +19,6 @@ OBJS=proxy_main.o proxy_thread.o proxy_utils.o gtm_proxy_opt.o OTHERS= ../libpq/libpqcomm.a ../path/libgtmpath.a ../client/libgtmclient.a ../common/libgtm.a -LDFLAGS=-L$(top_builddir)/common -L$(top_builddir)/libpq - -LIBS=-lpthread - gtm_proxy:$(OBJS) $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $^ $(OTHERS) ../../port/libpgport_srv.a -o gtm_proxy diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c index 5891c75bce..6df4357041 100644 --- a/src/interfaces/libpq/fe-auth.c +++ b/src/interfaces/libpq/fe-auth.c @@ -30,6 +30,9 @@ #include <sys/param.h> /* for MAXHOSTNAMELEN on most */ #include <sys/socket.h> #ifdef HAVE_SYS_UCRED_H +#ifdef __sun +#include <procfs.h> +#endif #include <sys/ucred.h> #endif #ifndef MAXHOSTNAMELEN diff --git a/src/port/getpeereid.c b/src/port/getpeereid.c index 126b5c6d8d..f592b56b55 100644 --- a/src/port/getpeereid.c +++ b/src/port/getpeereid.c @@ -24,6 +24,9 @@ #include <ucred.h> #endif #ifdef HAVE_SYS_UCRED_H +#ifdef __sun +#include <procfs.h> +#endif #include <sys/ucred.h> #endif diff --git a/src/test/regress/resultmap b/src/test/regress/resultmap index 04ba99fe33..2e54ed2246 100644 --- a/src/test/regress/resultmap +++ b/src/test/regress/resultmap @@ -15,3 +15,4 @@ int8:out:i.86-pc-mingw32=int8-exp-three-digits.out int8:out:x86_64-w64-mingw32=int8-exp-three-digits.out int8:out:i.86-w64-mingw32=int8-exp-three-digits.out int8:out:i.86-pc-win32vc=int8-exp-three-digits.out +aggregates:out:i386-pc-solaris2.11=aggregates-float-sunos.out |