summaryrefslogtreecommitdiff
path: root/src/backend/pgxc
diff options
context:
space:
mode:
authorPavan Deolasee2017-06-14 05:42:18 +0000
committerPavan Deolasee2017-06-14 05:42:18 +0000
commit15dd5274c323fb93e4e3ea9ad2185aaaec10f79c (patch)
tree9dafb4c7f735d9429ea461dc792933af87493c33 /src/backend/pgxc
parentdfbb88e3bbb526dcb204b456b9e5cfd9d10d0d0a (diff)
parentd5cb3bab564e0927ffac7c8729eacf181a12dd40 (diff)
Merge from PG master upto d5cb3bab564e0927ffac7c8729eacf181a12dd40
This is the result of the "git merge remotes/PGSQL/master" upto the said commit point. We have done some basic analysis, fixed compilation problems etc, but bulk of the logical problems in conflict resolution etc will be handled by subsequent commits.
Diffstat (limited to 'src/backend/pgxc')
-rw-r--r--src/backend/pgxc/cluster/pause.c1
-rw-r--r--src/backend/pgxc/locator/locator.c2
-rw-r--r--src/backend/pgxc/nodemgr/groupmgr.c5
-rw-r--r--src/backend/pgxc/nodemgr/nodemgr.c12
-rw-r--r--src/backend/pgxc/pool/execRemote.c16
-rw-r--r--src/backend/pgxc/pool/pgxcnode.c3
-rw-r--r--src/backend/pgxc/pool/poolmgr.c3
-rw-r--r--src/backend/pgxc/squeue/squeue.c17
8 files changed, 27 insertions, 32 deletions
diff --git a/src/backend/pgxc/cluster/pause.c b/src/backend/pgxc/cluster/pause.c
index 164dafa0e8..65769e94c3 100644
--- a/src/backend/pgxc/cluster/pause.c
+++ b/src/backend/pgxc/cluster/pause.c
@@ -15,6 +15,7 @@
#include "pgxc/execRemote.h"
#include "pgxc/pause.h"
#include "pgxc/pgxc.h"
+#include "storage/shmem.h"
#include "storage/spin.h"
#include "miscadmin.h"
diff --git a/src/backend/pgxc/locator/locator.c b/src/backend/pgxc/locator/locator.c
index c45d7e7d14..1c6d98c8a2 100644
--- a/src/backend/pgxc/locator/locator.c
+++ b/src/backend/pgxc/locator/locator.c
@@ -889,8 +889,6 @@ hash_func_ptr(Oid dataType)
return hashchar;
case NAMEOID:
return hashname;
- case INT2VECTOROID:
- return hashint2vector;
case VARCHAROID:
case TEXTOID:
return hashtext;
diff --git a/src/backend/pgxc/nodemgr/groupmgr.c b/src/backend/pgxc/nodemgr/groupmgr.c
index b63b8cf44f..8104e5ba4c 100644
--- a/src/backend/pgxc/nodemgr/groupmgr.c
+++ b/src/backend/pgxc/nodemgr/groupmgr.c
@@ -106,10 +106,7 @@ PgxcGroupCreate(CreateGroupStmt *stmt)
rel = heap_open(PgxcGroupRelationId, RowExclusiveLock);
tup = heap_form_tuple(rel->rd_att, values, nulls);
- /* Do the insertion */
- (void) simple_heap_insert(rel, tup);
-
- CatalogUpdateIndexes(rel, tup);
+ CatalogTupleInsert(rel, tup);
heap_close(rel, RowExclusiveLock);
}
diff --git a/src/backend/pgxc/nodemgr/nodemgr.c b/src/backend/pgxc/nodemgr/nodemgr.c
index 5ae6fe5f05..e6cc9af14b 100644
--- a/src/backend/pgxc/nodemgr/nodemgr.c
+++ b/src/backend/pgxc/nodemgr/nodemgr.c
@@ -28,6 +28,8 @@
#include "pgxc/locator.h"
#include "pgxc/nodemgr.h"
#include "pgxc/pgxc.h"
+#include "storage/lwlock.h"
+#include "storage/shmem.h"
/*
* How many times should we try to find a unique indetifier
@@ -838,10 +840,7 @@ PgxcNodeCreate(CreateNodeStmt *stmt)
htup = heap_form_tuple(pgxcnodesrel->rd_att, values, nulls);
- /* Insert tuple in catalog */
- simple_heap_insert(pgxcnodesrel, htup);
-
- CatalogUpdateIndexes(pgxcnodesrel, htup);
+ CatalogTupleInsert(pgxcnodesrel, htup);
heap_close(pgxcnodesrel, AccessExclusiveLock);
}
@@ -964,10 +963,7 @@ PgxcNodeAlter(AlterNodeStmt *stmt)
newtup = heap_modify_tuple(oldtup, RelationGetDescr(rel),
new_record,
new_record_nulls, new_record_repl);
- simple_heap_update(rel, &oldtup->t_self, newtup);
-
- /* Update indexes */
- CatalogUpdateIndexes(rel, newtup);
+ CatalogTupleUpdate(rel, &oldtup->t_self, newtup);
/* Release lock at Commit */
heap_close(rel, NoLock);
diff --git a/src/backend/pgxc/pool/execRemote.c b/src/backend/pgxc/pool/execRemote.c
index 21f155f5f7..59c5d8e7c0 100644
--- a/src/backend/pgxc/pool/execRemote.c
+++ b/src/backend/pgxc/pool/execRemote.c
@@ -3142,8 +3142,7 @@ get_exec_connections(RemoteQueryState *planstate,
(PlanState *) planstate);
Datum partvalue = ExecEvalExpr(estate,
planstate->combiner.ss.ps.ps_ExprContext,
- &isnull,
- NULL);
+ &isnull);
RelationLocInfo *rel_loc_info = GetRelationLocInfo(exec_nodes->en_relid);
/* PGXCTODO what is the type of partvalue here */
ExecNodes *nodes = GetRelationNodes(rel_loc_info,
@@ -3922,7 +3921,8 @@ PreCommit_Remote(char *prepareGID, char *nodestring, bool preparedLocalNode)
* table finally aborts - remote connections are not holding temporary
* objects in this case.
*/
- if (IS_PGXC_LOCAL_COORDINATOR && MyXactAccessedTempRel)
+ if (IS_PGXC_LOCAL_COORDINATOR &&
+ (MyXactFlags & XACT_FLAGS_ACCESSEDTEMPREL))
temp_object_included = true;
@@ -4194,7 +4194,7 @@ IsTwoPhaseCommitRequired(bool localWrite)
if (IS_PGXC_DATANODE)
return false;
- if (MyXactAccessedTempRel)
+ if (MyXactFlags & XACT_FLAGS_ACCESSEDTEMPREL)
{
elog(DEBUG1, "Transaction accessed temporary objects - "
"2PC will not be used and that can lead to data inconsistencies "
@@ -4492,7 +4492,7 @@ ExecInitRemoteQuery(RemoteQuery *node, EState *estate, int eflags)
combiner->ss.ps.plan = (Plan *) node;
combiner->ss.ps.state = estate;
- combiner->ss.ps.qual = NIL;
+ combiner->ss.ps.qual = NULL;
combiner->request_type = REQUEST_TYPE_QUERY;
@@ -4713,7 +4713,7 @@ ExecRemoteQuery(RemoteQueryState *node)
if (combiner->tuplesortstate)
{
if (tuplesort_gettupleslot((Tuplesortstate *) combiner->tuplesortstate,
- true, resultslot, NULL))
+ true, true, resultslot, NULL))
return resultslot;
else
ExecClearTuple(resultslot);
@@ -5244,7 +5244,7 @@ ExecInitRemoteSubplan(RemoteSubplan *node, EState *estate, int eflags)
combiner->ss.ps.plan = (Plan *) node;
combiner->ss.ps.state = estate;
- combiner->ss.ps.qual = NIL;
+ combiner->ss.ps.qual = NULL;
combiner->request_type = REQUEST_TYPE_QUERY;
@@ -6049,7 +6049,7 @@ primary_mode_phase_two:
if (combiner->tuplesortstate)
{
if (tuplesort_gettupleslot((Tuplesortstate *) combiner->tuplesortstate,
- true, resultslot, NULL))
+ true, true, resultslot, NULL))
{
if (log_remotesubplan_stats)
ShowUsageCommon("ExecRemoteSubplan", &start_r, &start_t);
diff --git a/src/backend/pgxc/pool/pgxcnode.c b/src/backend/pgxc/pool/pgxcnode.c
index eafd9cbbe0..809da4f1d2 100644
--- a/src/backend/pgxc/pool/pgxcnode.c
+++ b/src/backend/pgxc/pool/pgxcnode.c
@@ -48,6 +48,7 @@
#include "pgxc/pgxc.h"
#include "pgxc/poolmgr.h"
#include "tcop/dest.h"
+#include "storage/lwlock.h"
#include "utils/builtins.h"
#include "utils/elog.h"
#include "utils/memutils.h"
@@ -2509,7 +2510,7 @@ PGXCNodeGetNodeOid(int nodeid, char node_type)
Datum
pgxc_node_str(PG_FUNCTION_ARGS)
{
- PG_RETURN_NAME(PGXCNodeName);
+ PG_RETURN_TEXT_P(cstring_to_text(PGXCNodeName));
}
/*
diff --git a/src/backend/pgxc/pool/poolmgr.c b/src/backend/pgxc/pool/poolmgr.c
index 336101419e..140907d872 100644
--- a/src/backend/pgxc/pool/poolmgr.c
+++ b/src/backend/pgxc/pool/poolmgr.c
@@ -39,6 +39,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <poll.h>
+#include <math.h>
#include "postgres.h"
@@ -63,10 +64,12 @@
#include "pgxc/poolutils.h"
#include "postmaster/postmaster.h" /* For UnixSocketDir */
#include "storage/procarray.h"
+#include "utils/varlena.h"
#include "../interfaces/libpq/libpq-fe.h"
#include "../interfaces/libpq/libpq-int.h"
+
/* Configuration options */
int PoolConnKeepAlive = 600;
int PoolMaintenanceTimeout = 30;
diff --git a/src/backend/pgxc/squeue/squeue.c b/src/backend/pgxc/squeue/squeue.c
index 4fbae5b31b..a9741f33f6 100644
--- a/src/backend/pgxc/squeue/squeue.c
+++ b/src/backend/pgxc/squeue/squeue.c
@@ -36,6 +36,7 @@
#include "storage/shmem.h"
#include "utils/hsearch.h"
#include "utils/resowner.h"
+#include "pgstat.h"
int NSQueues = 64;
@@ -120,7 +121,6 @@ typedef struct SQueueHeader
*/
static HTAB *SharedQueues = NULL;
static LWLockPadded *SQueueLocks = NULL;
-static LWLockTranche SharedQueueLocksTranche;
/*
* Pool of synchronization items
@@ -234,12 +234,8 @@ SharedQueuesInit(void)
/* either both syncs and locks, or none of them */
Assert(! foundLocks);
- SharedQueueLocksTranche.name = "Shared Queue Locks";
- SharedQueueLocksTranche.array_base = SQueueLocks;
- SharedQueueLocksTranche.array_stride = sizeof(LWLockPadded);
-
/* Register the trannche tranche in the main tranches array */
- LWLockRegisterTranche(LWTRANCHE_SHARED_QUEUES, &SharedQueueLocksTranche);
+ LWLockRegisterTranche(LWTRANCHE_SHARED_QUEUES, "Shared Queue Locks");
l = 0;
for (i = 0; i < NUM_SQUEUES; i++)
@@ -1020,7 +1016,9 @@ SharedQueueRead(SharedQueue squeue, int consumerIdx,
cstate->cs_node, cstate->cs_pid, cstate->cs_status);
/* Wait for notification about available info */
- WaitLatch(&sqsync->sqs_consumer_sync[consumerIdx].cs_latch, WL_LATCH_SET | WL_POSTMASTER_DEATH, -1);
+ WaitLatch(&sqsync->sqs_consumer_sync[consumerIdx].cs_latch,
+ WL_LATCH_SET | WL_POSTMASTER_DEATH, -1,
+ WAIT_EVENT_MQ_INTERNAL);
/* got the notification, restore lock and try again */
LWLockAcquire(sqsync->sqs_consumer_sync[consumerIdx].cs_lwlock, LW_EXCLUSIVE);
}
@@ -1421,7 +1419,7 @@ CHECK:
/* wait for a notification */
wait_result = WaitLatch(&sqsync->sqs_producer_latch,
WL_LATCH_SET | WL_POSTMASTER_DEATH | WL_TIMEOUT,
- 10000L);
+ 10000L, WAIT_EVENT_MQ_INTERNAL);
if (wait_result & WL_TIMEOUT)
{
elog(WARNING, "SQueue %s, timeout while waiting for Consumers "
@@ -1776,7 +1774,8 @@ sq_pull_long_tuple(ConsState *cstate, RemoteDataRow datarow,
ResetLatch(&sync->cs_latch);
LWLockRelease(sync->cs_lwlock);
/* Wait for notification about available info */
- WaitLatch(&sync->cs_latch, WL_LATCH_SET | WL_POSTMASTER_DEATH, -1);
+ WaitLatch(&sync->cs_latch, WL_LATCH_SET | WL_POSTMASTER_DEATH, -1,
+ WAIT_EVENT_MQ_INTERNAL);
/* got the notification, restore lock and try again */
LWLockAcquire(sync->cs_lwlock, LW_EXCLUSIVE);
}