summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael P2011-12-08 04:50:25 +0000
committerMichael P2011-12-08 04:50:25 +0000
commit2a406e56dea3e750e74cc38115e83e30217b4822 (patch)
tree42b27adb393ac484e625630149bbd16eb11e68ee
parent99407dfd856b4250593379a6764f9bbd61ae03f7 (diff)
Simplify node DDL grammar and supress slave management part
New grammar uses WITH clause of CREATE TABLE in this manner: CREATE/ALTER NODE nodename WITH ( [ TYPE = ('coordinator' | 'datanode'),] [ HOST = 'string',] [ PORT = portnum,] [ PRIMARY,] [ PREFERRED ]); This applies to CREATE/ALTER NODE. Grammar simplification results in the deletion in related_to column of pgxc_node catalog. Documentation is updated in consequence. This commit solves also an issue with variable names sharing same format between GTM and XC nodes.
-rw-r--r--doc-xc/src/sgml/catalogs.sgmlin17
-rw-r--r--doc-xc/src/sgml/ref/alter_node.sgmlin64
-rw-r--r--doc-xc/src/sgml/ref/create_node.sgmlin41
-rw-r--r--src/backend/access/transam/gtm.c6
-rw-r--r--src/backend/catalog/heap.c4
-rw-r--r--src/backend/commands/copy.c2
-rw-r--r--src/backend/parser/gram.y108
-rw-r--r--src/backend/pgxc/locator/locator.c14
-rw-r--r--src/backend/pgxc/nodemgr/groupmgr.c2
-rw-r--r--src/backend/pgxc/nodemgr/nodemgr.c263
-rw-r--r--src/backend/pgxc/pool/execRemote.c14
-rw-r--r--src/backend/pgxc/pool/pgxcnode.c75
-rw-r--r--src/backend/pgxc/pool/poolmgr.c68
-rw-r--r--src/backend/postmaster/postmaster.c12
-rw-r--r--src/backend/utils/cache/lsyscache.c23
-rw-r--r--src/backend/utils/sort/tuplesort.c2
-rw-r--r--src/bin/initdb/initdb.c2
-rw-r--r--src/gtm/client/fe-connect.c2
-rw-r--r--src/gtm/client/fe-protocol.c6
-rw-r--r--src/gtm/client/gtm_client.c2
-rw-r--r--src/gtm/client/test/test_seq.c2
-rw-r--r--src/gtm/client/test/test_snap.c2
-rw-r--r--src/gtm/client/test/test_snapperf.c2
-rw-r--r--src/gtm/client/test/test_txn.c2
-rw-r--r--src/gtm/client/test/test_txnperf.c2
-rw-r--r--src/gtm/common/elog.c2
-rw-r--r--src/gtm/main/gtm_seq.c36
-rw-r--r--src/gtm/main/gtm_snap.c8
-rw-r--r--src/gtm/main/gtm_standby.c10
-rw-r--r--src/gtm/main/gtm_txn.c60
-rw-r--r--src/gtm/main/main.c2
-rw-r--r--src/gtm/proxy/proxy_main.c10
-rw-r--r--src/gtm/recovery/register.c24
-rw-r--r--src/gtm/recovery/replication.c8
-rw-r--r--src/gtm/test/test_common.c4
-rw-r--r--src/gtm/test/test_connect.c12
-rw-r--r--src/gtm/test/test_node.c14
-rw-r--r--src/gtm/test/test_node5.c14
-rw-r--r--src/gtm/test/test_repli.c2
-rw-r--r--src/gtm/test/test_repli2.c14
-rw-r--r--src/gtm/test/test_scenario.c10
-rw-r--r--src/gtm/test/test_standby.c2
-rw-r--r--src/gtm/test/test_startup.c4
-rw-r--r--src/gtm/test/test_txn.c4
-rw-r--r--src/gtm/test2/test_connect2.c2
-rw-r--r--src/gtm/test2/test_standby.c2
-rw-r--r--src/gtm/test2/test_startup.c4
-rw-r--r--src/gtm/test2/test_txn.c4
-rw-r--r--src/gtm/test2/test_txn2.c2
-rw-r--r--src/gtm/test2/test_txn3.c2
-rw-r--r--src/include/catalog/pgxc_node.h23
-rw-r--r--src/include/gtm/gtm_c.h12
-rw-r--r--src/include/parser/kwlist.h13
-rw-r--r--src/include/pgxc/nodemgr.h4
-rw-r--r--src/include/utils/lsyscache.h1
-rw-r--r--src/test/regress/pg_regress.c24
56 files changed, 351 insertions, 719 deletions
diff --git a/doc-xc/src/sgml/catalogs.sgmlin b/doc-xc/src/sgml/catalogs.sgmlin
index 495025b30f..129188fe1f 100644
--- a/doc-xc/src/sgml/catalogs.sgmlin
+++ b/doc-xc/src/sgml/catalogs.sgmlin
@@ -6537,19 +6537,8 @@
<entry><type>char</type></entry>
<entry></entry>
<entry>Type of cluster node.
- It is <literal>C</literal> for a Coordinator master.
- It is <literal>D</literal> for a Datanode master.
- It is <literal>S</literal> for a Coordinator master.
- It is <literal>X</literal> for a Datanode master.
- </entry>
- </row>
-
- <row>
- <entry><structfield>node_related</structfield></entry>
- <entry><type>oid</type></entry>
- <entry><literal><link linkend="catalog-pgxc-node"><structname>pgxc_node</structname></link>.oid</literal></entry>
- <entry>Oid of related cluster node.
- Only Slave nodes can have related nodes from which they synchronize.
+ It is <literal>C</literal> for a Coordinator.
+ It is <literal>D</literal> for a Datanode.
</entry>
</row>
@@ -6572,7 +6561,7 @@
<entry><type>bool</type></entry>
<entry></entry>
<entry>Defines if node is a primary node.
- Only Datanode master can be a primary node.
+ Only Datanode can be a primary node.
</entry>
</row>
diff --git a/doc-xc/src/sgml/ref/alter_node.sgmlin b/doc-xc/src/sgml/ref/alter_node.sgmlin
index 59b58a5d7d..526df21bee 100644
--- a/doc-xc/src/sgml/ref/alter_node.sgmlin
+++ b/doc-xc/src/sgml/ref/alter_node.sgmlin
@@ -21,11 +21,14 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
-ALTER NODE <replaceable class="parameter">nodename</replaceable> SET
- [ NODEPORT = <replaceable class="parameter">nodenum</replaceable>, ]
- [ HOSTIP = <replaceable class="parameter">hostname</replaceable>, ]
- [ RELATED ( TO <replaceable class="parameter">nodename</replaceable> | NONE ), ]
- [ (COORDINATOR | NODE) (MASTER | SLAVE) ]
+ALTER NODE <replaceable class="parameter">nodename</replaceable> WITH
+ (
+ [ TYPE = <replaceable class="parameter">nodetype</replaceable>,]
+ [ HOST = <replaceable class="parameter">hostname</replaceable>,]
+ [ PORT = <replaceable class="parameter">portnum</replaceable>,]
+ [ PRIMARY,]
+ [ PREFERRED ]
+ )
</synopsis>
</refsynopsisdiv>
@@ -64,23 +67,11 @@ ALTER NODE <replaceable class="parameter">nodename</replaceable> SET
</varlistentry>
<varlistentry>
- <term><literal>COORDINATOR</literal></term>
- <term><literal>NODE</literal></term>
+ <term><literal>TYPE</literal></term>
<listitem>
<para>
- The type of the cluster node. <literal>COORDINATOR</literal> for
- a Coordinator node, <literal>NODE</literal> for a Datanode.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><literal>SLAVE</literal></term>
- <term><literal>MASTER</literal></term>
- <listitem>
- <para>
- The standby status of the node. <literal>MASTER</literal> for
- a master node, <literal>SLAVE</literal> for a standby/slave node.
+ The type of the cluster node. It is possible to specify
+ a Coordinator node or a Datanode node.
</para>
</listitem>
</varlistentry>
@@ -106,13 +97,12 @@ ALTER NODE <replaceable class="parameter">nodename</replaceable> SET
</varlistentry>
<varlistentry>
- <term><literal>RELATED TO</literal></term>
- <term><literal>RELATED NONE</literal></term>
+ <term><replaceable class="parameter">nodetype</replaceable></term>
<listitem>
<para>
- Defines for a slave node on which master/slave node this node is
- dependant by replication. <literal>RELATED NONE</literal> is used
- in the case where node is modified such as to be not dependant to another one.
+ The node type for given cluster node. Possible values are:
+ 'coordinator' for a Coordinator node and 'datanode' for a
+ Datanode node.
</para>
</listitem>
</varlistentry>
@@ -141,19 +131,8 @@ ALTER NODE <replaceable class="parameter">nodename</replaceable> SET
<refsect1>
<title>Notes</title>
<para>
- A slave Datanode cannot be modified as <literal>PRIMARY</literal> but
- it can be modified as <literal>PREFERRED</literal>.
- </para>
-
- <para>
- A master node cannot have a related node defined with <literal>
- RELATED TO</literal>. Defining a related node on a slave is mandatory.
- </para>
-
- <para>
- A slave node can be promoted to a master node with <literal>RELATED NONE
- </literal>, but in this case the node type has to be changed from
- <literal>SLAVE</literal> to <literal>MASTER</literal>.
+ A Datanode can be modified as <literal>PRIMARY</literal> and
+ as <literal>PREFERRED</literal> as many times as necessary.
</para>
<para>
@@ -166,14 +145,7 @@ ALTER NODE <replaceable class="parameter">nodename</replaceable> SET
<para>
Modify a Coordinator node located on local machine to use port 6543.
<programlisting>
-ALTER NODE coord_node SET PORTNUM = 6543;
-</programlisting>
- </para>
-
- <para>
- Promote a slave datanode to master.
-<programlisting>
-ALTER NODE data_node SET DATANODE MASTER, RELATED TO NONE;
+ALTER NODE coord_node WITH (PORT = 6543, HOST = 'localhost');
</programlisting>
</para>
diff --git a/doc-xc/src/sgml/ref/create_node.sgmlin b/doc-xc/src/sgml/ref/create_node.sgmlin
index 8076a3eddd..9916982932 100644
--- a/doc-xc/src/sgml/ref/create_node.sgmlin
+++ b/doc-xc/src/sgml/ref/create_node.sgmlin
@@ -23,10 +23,9 @@ PostgreSQL documentation
<synopsis>
CREATE NODE <replaceable class="parameter">nodename</replaceable> WITH
(
- [ (COORDINATOR | NODE) (SLAVE | MASTER),]
- [ HOSTIP = <replaceable class="parameter">hostname</replaceable>,]
- [ NODEPORT = <replaceable class="parameter">portnum</replaceable>,]
- [ RELATED TO <replaceable class="parameter">nodename</replaceable>,]
+ [ TYPE = <replaceable class="parameter">nodetype</replaceable>,]
+ [ HOST = <replaceable class="parameter">hostname</replaceable>,]
+ [ PORT = <replaceable class="parameter">portnum</replaceable>,]
[ PRIMARY,]
[ PREFERRED ]
)
@@ -73,23 +72,11 @@ CREATE NODE <replaceable class="parameter">nodename</replaceable> WITH
</varlistentry>
<varlistentry>
- <term><literal>COORDINATOR</literal></term>
- <term><literal>NODE</literal></term>
+ <term><literal>TYPE</literal></term>
<listitem>
<para>
- The type of the cluster node. <literal>COORDINATOR</literal> for
- a Coordinator node, <literal>NODE</literal> for a Datanode.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><literal>SLAVE</literal></term>
- <term><literal>MASTER</literal></term>
- <listitem>
- <para>
- The standby status of the node. <literal>MASTER</literal> for
- a master node, <literal>SLAVE</literal> for a standby/slave node.
+ The type of the cluster node. It is possible to specify
+ a Coordinator node or a Datanode node.
</para>
</listitem>
</varlistentry>
@@ -115,11 +102,12 @@ CREATE NODE <replaceable class="parameter">nodename</replaceable> WITH
</varlistentry>
<varlistentry>
- <term><literal>RELATED TO</literal></term>
+ <term><replaceable class="parameter">nodetype</replaceable></term>
<listitem>
<para>
- Defines for a slave node on which master/slave node this node is
- dependant by replication.
+ The node type for given cluster node. Possible values are:
+ 'coordinator' for a Coordinator node and 'datanode' for a
+ Datanode node.
</para>
</listitem>
</varlistentry>
@@ -156,11 +144,6 @@ CREATE NODE <replaceable class="parameter">nodename</replaceable> WITH
A slave Datanode cannot be defined as <literal>PRIMARY</literal> but
it can be defined as <literal>PREFERRED</literal>.
</para>
-
- <para>
- A master node cannot have a related node defined with <literal>
- RELATED TO</literal>. Defining a related node on a slave is mandatory.
- </para>
</refsect1>
<refsect1>
@@ -168,7 +151,7 @@ CREATE NODE <replaceable class="parameter">nodename</replaceable> WITH
<para>
Create a Coordinator node located on local machine using port 6543
<programlisting>
-CREATE NODE node2 WITH (COORDINATOR MASTER, HOSTIP = 'localhost', PORTNUM = 6543);
+CREATE NODE node2 WITH (TYPE = 'coordinator', HOST = 'localhost', PORT = 6543);
</programlisting>
</para>
@@ -176,7 +159,7 @@ CREATE NODE node2 WITH (COORDINATOR MASTER, HOSTIP = 'localhost', PORTNUM = 6543
Create a Datanode master which is a preferred and primary node
located on remote machine with IP '192.168.0.3' on port 8888.
<programlisting>
-CREATE NODE node2 WITH (DATANODE MASTER, HOSTIP = '192.168.0.3', PORTNUM = 8888, PRIMARY, PREFERRED);
+CREATE NODE node2 WITH (TYPE = 'datanode', HOST = '192.168.0.3', PORT = 8888, PRIMARY, PREFERRED);
</programlisting>
</para>
diff --git a/src/backend/access/transam/gtm.c b/src/backend/access/transam/gtm.c
index bcb91ddba4..27acfb202d 100644
--- a/src/backend/access/transam/gtm.c
+++ b/src/backend/access/transam/gtm.c
@@ -55,12 +55,12 @@ InitGTM(void)
/* If this thread is postmaster itself, it contacts gtm identifying itself */
if (!IsUnderPostmaster)
{
- GTM_PGXCNodeType remote_type = PGXC_NODE_DEFAULT;
+ GTM_PGXCNodeType remote_type = GTM_NODE_DEFAULT;
if (IS_PGXC_COORDINATOR)
- remote_type = PGXC_NODE_COORDINATOR;
+ remote_type = GTM_NODE_COORDINATOR;
else if (IS_PGXC_DATANODE)
- remote_type = PGXC_NODE_DATANODE;
+ remote_type = GTM_NODE_DATANODE;
sprintf(conn_str, "host=%s port=%d node_name=%s remote_type=%d postmaster=1",
GtmHost, GtmPort, PGXCNodeName, remote_type);
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index 383514225a..0082b2e233 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -1144,7 +1144,7 @@ build_subcluster_data(PGXCSubCluster *subcluster, int *numnodes)
Form_pgxc_node pgxc_node = (Form_pgxc_node) GETSTRUCT(tuple);
/* Add only Datanode masters */
- if (pgxc_node->node_type != PGXC_NODE_DATANODE_MASTER)
+ if (pgxc_node->node_type != PGXC_NODE_DATANODE)
continue;
(*numnodes)++;
@@ -1201,7 +1201,7 @@ build_subcluster_data(PGXCSubCluster *subcluster, int *numnodes)
errmsg("PGXC Node %s: object not defined",
node_name)));
- if (get_pgxc_nodetype(noid) != PGXC_NODE_DATANODE_MASTER)
+ if (get_pgxc_nodetype(noid) != PGXC_NODE_DATANODE)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("PGXC node %s: not a Datanode master",
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index b63a9d7307..00e25bd7c5 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -2880,7 +2880,7 @@ EndCopyFrom(CopyState cstate)
bool replicated = cstate->rel_loc->locatorType == LOCATOR_TYPE_REPLICATED;
DataNodeCopyFinish(
cstate->connections,
- replicated ? PGXCNodeGetNodeId(primary_data_node, PGXC_NODE_DATANODE_MASTER) : -1,
+ replicated ? PGXCNodeGetNodeId(primary_data_node, PGXC_NODE_DATANODE) : -1,
replicated ? COMBINE_TYPE_SAME : COMBINE_TYPE_SUM);
pfree(cstate->connections);
pfree(cstate->query_buf.data);
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index c0b4e8411a..88048dba36 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -241,11 +241,10 @@ static void SplitColQualList(List *qualList,
%type <list> createdb_opt_list alterdb_opt_list copy_opt_list
transaction_mode_list
create_extension_opt_list alter_extension_opt_list
- pgxcnode_list pgxcnode_opt_list
+ pgxcnode_list
%type <defelt> createdb_opt_item alterdb_opt_item copy_opt_item
transaction_mode_item
create_extension_opt_item alter_extension_opt_item
- pgxcnode_opt_item pgxcnode_type
%type <ival> opt_lock lock_type cast_context
%type <ival> vacuum_option_list vacuum_option_elem
@@ -532,7 +531,7 @@ static void SplitColQualList(List *qualList,
GLOBAL GRANT GRANTED GREATEST GROUP_P
/* PGXC_BEGIN */
- HANDLER HASH HAVING HEADER_P HOLD HOSTIP HOUR_P
+ HANDLER HASH HAVING HEADER_P HOLD HOUR_P
/* PGXC_END */
IDENTITY_P IF_P ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IN_P
@@ -548,9 +547,9 @@ static void SplitColQualList(List *qualList,
LEAST LEFT LEVEL LIKE LIMIT LISTEN LOAD LOCAL LOCALTIME LOCALTIMESTAMP
LOCATION LOCK_P
/* PGXC_BEGIN */
- MAPPING MASTER MATCH MAXVALUE MINUTE_P MINVALUE MODE MODULO MONTH_P MOVE
- NAME_P NAMES NATIONAL NATURAL NCHAR NEXT NO NODE NODEPORT NONE
+ MAPPING MATCH MAXVALUE MINUTE_P MINVALUE MODE MODULO MONTH_P MOVE
/* PGXC_END */
+ NAME_P NAMES NATIONAL NATURAL NCHAR NEXT NO NODE NONE
NOT NOTHING NOTIFY NOTNULL NOWAIT NULL_P NULLIF NULLS_P NUMERIC
OBJECT_P OF OFF OFFSET OIDS ON ONLY OPERATOR OPTION OPTIONS OR
@@ -566,7 +565,7 @@ static void SplitColQualList(List *qualList,
RANGE READ REAL REASSIGN RECHECK RECURSIVE REF REFERENCES REINDEX
/* PGXC_BEGIN */
- RELATED RELATIVE_P RELEASE RENAME REPEATABLE REPLACE REPLICA REPLICATION
+ RELATIVE_P RELEASE RENAME REPEATABLE REPLACE REPLICA REPLICATION
RESET RESTART RESTRICT RETURNING RETURNS REVOKE RIGHT ROBIN ROLE ROLLBACK
ROUND ROW ROWS RULE
/* PGXC_END */
@@ -574,7 +573,7 @@ static void SplitColQualList(List *qualList,
SAVEPOINT SCHEMA SCROLL SEARCH SECOND_P SECURITY SELECT SEQUENCE SEQUENCES
SERIALIZABLE SERVER SESSION SESSION_USER SET SETOF SHARE
/* PGXC_BEGIN */
- SHOW SIMILAR SIMPLE SLAVE SMALLINT SOME STABLE STANDALONE_P START STATEMENT
+ SHOW SIMILAR SIMPLE SMALLINT SOME STABLE STANDALONE_P START STATEMENT
STATISTICS STDIN STDOUT STORAGE STRICT_P STRIP_P SUBSTRING
/* PGXC_END */
SYMMETRIC SYSID SYSTEM_P
@@ -8026,21 +8025,20 @@ opt_barrier_id:
*
* CREATE NODE nodename WITH
* (
- * [ (COORDINATOR | NODE) (SLAVE | MASTER),]
- * [ HOSTIP = 'hostname'],
- * [ NODEPORT = portnum ],
- * [ RELATED TO nodename ],
+ * [ TYPE = ('datanode' | 'coordinator') ],
+ * [ HOST = 'hostname'],
+ * [ PORT = portnum ],
* [ PRIMARY ],
* [ PREFERRED ]
* )
*
*****************************************************************************/
-CreateNodeStmt: CREATE NODE pgxcnode_name WITH '(' pgxcnode_opt_list ')'
+CreateNodeStmt: CREATE NODE pgxcnode_name OptWith
{
CreateNodeStmt *n = makeNode(CreateNodeStmt);
n->node_name = $3;
- n->options = $6;
+ n->options = $4;
$$ = (Node *)n;
}
;
@@ -8056,80 +8054,25 @@ pgxcnode_list:
| pgxcnode_name { $$ = list_make1(makeString($1)); }
;
-pgxcnode_opt_list:
- pgxcnode_opt_list ',' pgxcnode_opt_item { $$ = lappend($1, $3); }
- | pgxcnode_opt_item { $$ = list_make1($1); }
- ;
-
-pgxcnode_opt_item:
- NODEPORT '=' Iconst
- {
- $$ = makeDefElem("port", (Node *)makeInteger($3));
- }
- | HOSTIP '=' Sconst
- {
- $$ = makeDefElem("host", (Node *)makeString($3));
- }
- | RELATED TO pgxcnode_name
- {
- $$ = makeDefElem("related", (Node *)makeString($3));
- }
- | RELATED NONE
- {
- $$ = makeDefElem("related", NULL);
- }
- | pgxcnode_type
- {
- $$ = $1;
- }
- | PRIMARY
- {
- $$ = makeDefElem("primary", NULL);
- }
- | PREFERRED
- {
- $$ = makeDefElem("preferred", NULL);
- }
- ;
-
-/* Types listed here should correspond to the ones in pgxc_node.h */
-pgxcnode_type:
- COORDINATOR MASTER
- {
- $$ = makeDefElem("type", (Node *)makeString("C"));
- }
- | COORDINATOR SLAVE
- {
- $$ = makeDefElem("type", (Node *)makeString("S"));
- }
- | NODE MASTER
- {
- $$ = makeDefElem("type", (Node *)makeString("D"));
- }
- | NODE SLAVE
- {
- $$ = makeDefElem("type", (Node *)makeString("X"));
- }
- ;
-
/*****************************************************************************
*
* QUERY:
- * Modification of parameters
- * ALTER NODE nodename SET NODEPORT = nodenum
- * ALTER NODE nodename SET HOSTIP = hostname
- * ALTER NODE nodename SET RELATED TO nodename
- * ALTER NODE nodename SET RELATED NONE
- * Node Promotion
- * ALTER NODE nodename SET (COORDINATOR | SLAVE) (MASTER | SLAVE)
+ * ALTER NODE nodename WITH
+ * (
+ * [ TYPE = ('datanode' | 'coordinator') ],
+ * [ HOST = 'hostname'],
+ * [ PORT = portnum ],
+ * [ PRIMARY ],
+ * [ PREFERRED ]
+ * )
*
*****************************************************************************/
-AlterNodeStmt: ALTER NODE pgxcnode_name SET pgxcnode_opt_list
+AlterNodeStmt: ALTER NODE pgxcnode_name OptWith
{
AlterNodeStmt *n = makeNode(AlterNodeStmt);
n->node_name = $3;
- n->options = $5;
+ n->options = $4;
$$ = (Node *)n;
}
;
@@ -12338,9 +12281,6 @@ unreserved_keyword:
/* PGXC_END */
| HEADER_P
| HOLD
-/* PGXC_BEGIN */
- | HOSTIP
-/* PGXC_END */
| HOUR_P
| IDENTITY_P
| IF_P
@@ -12389,9 +12329,6 @@ unreserved_keyword:
| NEXT
| NO
| NODE
-/* PGXC_BEGIN */
- | NODEPORT
-/* PGXC_END */
| NOTHING
| NOTIFY
| NOWAIT
@@ -12430,9 +12367,6 @@ unreserved_keyword:
| RECURSIVE
| REF
| REINDEX
-/* PGXC_BEGIN */
- | RELATED
-/* PGXC_END */
| RELATIVE_P
| RELEASE
| RENAME
diff --git a/src/backend/pgxc/locator/locator.c b/src/backend/pgxc/locator/locator.c
index 5e7ec911fd..5836474193 100644
--- a/src/backend/pgxc/locator/locator.c
+++ b/src/backend/pgxc/locator/locator.c
@@ -135,7 +135,7 @@ GetAnyDataNode(List *relNodes)
int i;
for (i = 0; i < num_preferred_data_nodes; i++)
{
- int nodeid = PGXCNodeGetNodeId(preferred_data_node[i], PGXC_NODE_DATANODE_MASTER);
+ int nodeid = PGXCNodeGetNodeId(preferred_data_node[i], PGXC_NODE_DATANODE);
/* OK, found one */
if (nodeid == relation_nodeid)
@@ -491,7 +491,7 @@ IsTableDistOnPrimary(RelationLocInfo *rel_loc_info)
foreach(item, rel_loc_info->nodeList)
{
- if (PGXCNodeGetNodeId(primary_data_node, PGXC_NODE_DATANODE_MASTER) == lfirst_int(item))
+ if (PGXCNodeGetNodeId(primary_data_node, PGXC_NODE_DATANODE) == lfirst_int(item))
return true;
}
return false;
@@ -549,9 +549,9 @@ GetRelationNodes(RelationLocInfo *rel_loc_info, Datum valueForDistCol, Oid typeO
&& list_length(exec_nodes->nodeList) > 1) /* make sure more than 1 */
{
exec_nodes->primarynodelist = lappend_int(NULL,
- PGXCNodeGetNodeId(primary_data_node, PGXC_NODE_DATANODE_MASTER));
+ PGXCNodeGetNodeId(primary_data_node, PGXC_NODE_DATANODE));
list_delete_int(exec_nodes->nodeList,
- PGXCNodeGetNodeId(primary_data_node, PGXC_NODE_DATANODE_MASTER));
+ PGXCNodeGetNodeId(primary_data_node, PGXC_NODE_DATANODE));
}
}
else
@@ -565,7 +565,7 @@ GetRelationNodes(RelationLocInfo *rel_loc_info, Datum valueForDistCol, Oid typeO
* concurrently
*/
exec_nodes->nodeList = lappend_int(NULL,
- PGXCNodeGetNodeId(primary_data_node, PGXC_NODE_DATANODE_MASTER));
+ PGXCNodeGetNodeId(primary_data_node, PGXC_NODE_DATANODE));
}
else if (num_preferred_data_nodes >= 0)
{
@@ -576,7 +576,7 @@ GetRelationNodes(RelationLocInfo *rel_loc_info, Datum valueForDistCol, Oid typeO
for (k = 0; k < num_preferred_data_nodes; k++)
{
if (PGXCNodeGetNodeId(preferred_data_node[k],
- PGXC_NODE_DATANODE_MASTER) == lfirst_int(item))
+ PGXC_NODE_DATANODE) == lfirst_int(item))
{
exec_nodes->nodeList = lappend_int(NULL,
lfirst_int(item));
@@ -802,7 +802,7 @@ RelationBuildLocator(Relation rel)
for (j = 0; j < pgxc_class->nodeoids.dim1; j++)
relationLocInfo->nodeList = lappend_int(relationLocInfo->nodeList,
PGXCNodeGetNodeId(pgxc_class->nodeoids.values[j],
- PGXC_NODE_DATANODE_MASTER));
+ PGXC_NODE_DATANODE));
/*
* If the locator type is round robin, we set a node to
diff --git a/src/backend/pgxc/nodemgr/groupmgr.c b/src/backend/pgxc/nodemgr/groupmgr.c
index 7fb43f0e9c..daf41efcb9 100644
--- a/src/backend/pgxc/nodemgr/groupmgr.c
+++ b/src/backend/pgxc/nodemgr/groupmgr.c
@@ -74,7 +74,7 @@ PgxcGroupCreate(CreateGroupStmt *stmt)
errmsg("PGXC Node %s: object not defined",
node_name)));
- if (get_pgxc_nodetype(noid) != PGXC_NODE_DATANODE_MASTER)
+ if (get_pgxc_nodetype(noid) != PGXC_NODE_DATANODE)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("PGXC node %s: only Datanode master can be a group member",
diff --git a/src/backend/pgxc/nodemgr/nodemgr.c b/src/backend/pgxc/nodemgr/nodemgr.c
index 64ed0fabcd..cca896217f 100644
--- a/src/backend/pgxc/nodemgr/nodemgr.c
+++ b/src/backend/pgxc/nodemgr/nodemgr.c
@@ -30,15 +30,14 @@
/* Global number of nodes */
int NumDataNodes = 2;
int NumCoords = 1;
-int NumCoordSlaves = 0;
-int NumDataNodeSlaves = 0;
/*
- * Check list of options and return things filled
+ * Check list of options and return things filled.
+ * This includes check on option values.
*/
static void
check_options(List *options, DefElem **dhost,
- DefElem **drelated, DefElem **dport, DefElem **dtype,
+ DefElem **dport, DefElem **dtype,
DefElem **is_primary, DefElem **is_preferred)
{
ListCell *option;
@@ -55,19 +54,27 @@ check_options(List *options, DefElem **dhost,
if (strcmp(defel->defname, "port") == 0)
{
+ int port_value;
+
if (*dport)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("conflicting or redundant options")));
+
+ /* Value is mandatory */
+ if (!defel->arg)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("port value is not specified")));
+
*dport = defel;
- }
- else if (strcmp(defel->defname, "related") == 0)
- {
- if (*drelated)
+
+ port_value = intVal(defel->arg);
+ if (port_value < 1 || port_value > 65535)
ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("conflicting or redundant options")));
- *drelated = defel;
+ (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
+ errmsg("port value is out of range")));
+
}
else if (strcmp(defel->defname, "host") == 0)
{
@@ -75,15 +82,38 @@ check_options(List *options, DefElem **dhost,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("conflicting or redundant options")));
+
+ /* Value is mandatory */
+ if (!defel->arg)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("host value is not specified")));
+
*dhost = defel;
}
else if (strcmp(defel->defname, "type") == 0)
{
+ char *nodetype;
+
if (*dtype)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("conflicting or redundant options")));
+
*dtype = defel;
+
+ /* Value is mandatory */
+ if (!defel->arg)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("type value is not specified")));
+
+ nodetype = strVal(defel->arg);
+ if (strcmp(nodetype, "coordinator") != 0 &&
+ strcmp(nodetype, "datanode") != 0)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("type value is incorrect, specify 'coordinator or 'datanode'")));
}
else if (strcmp(defel->defname, "primary") == 0)
{
@@ -91,6 +121,12 @@ check_options(List *options, DefElem **dhost,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("conflicting or redundant options")));
+
+ if (defel->arg)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("a value cannot be specified with primary")));
+
*is_primary = defel;
}
else if (strcmp(defel->defname, "preferred") == 0)
@@ -99,8 +135,19 @@ check_options(List *options, DefElem **dhost,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("conflicting or redundant options")));
+ if (defel->arg)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("a value cannot be specified with preferred")));
+
*is_preferred = defel;
}
+ else
+ {
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("incorrect option: %s", defel->defname)));
+ }
}
}
@@ -133,8 +180,7 @@ cmp_nodes(const void *p1, const void *p2)
* an ordered list of node Oids for each PGXC node type.
*/
void
-PgxcNodeListAndCount(Oid **coOids, Oid **dnOids, Oid **coslaveOids, Oid **dnslaveOids,
- int *num_coords, int *num_dns, int *num_co_slaves, int *num_dn_slaves)
+PgxcNodeListAndCount(Oid **coOids, Oid **dnOids, int *num_coords, int *num_dns)
{
Relation rel;
HeapScanDesc scan;
@@ -142,8 +188,6 @@ PgxcNodeListAndCount(Oid **coOids, Oid **dnOids, Oid **coslaveOids, Oid **dnslav
*num_coords = 0;
*num_dns = 0;
- *num_co_slaves = 0;
- *num_dn_slaves = 0;
/* Don't forget to reinitialize primary and preferred nodes also */
primary_data_node = InvalidOid;
@@ -167,26 +211,16 @@ PgxcNodeListAndCount(Oid **coOids, Oid **dnOids, Oid **coslaveOids, Oid **dnslav
/* Take data for given node type */
switch (nodeForm->node_type)
{
- case PGXC_NODE_COORD_MASTER:
+ case PGXC_NODE_COORDINATOR:
(*num_coords)++;
numnodes = *num_coords;
nodes = coOids;
break;
- case PGXC_NODE_DATANODE_MASTER:
+ case PGXC_NODE_DATANODE:
(*num_dns)++;
numnodes = *num_dns;
nodes = dnOids;
break;
- case PGXC_NODE_COORD_SLAVE:
- (*num_co_slaves)++;
- numnodes = *num_co_slaves;
- nodes = coslaveOids;
- break;
- case PGXC_NODE_DATANODE_SLAVE:
- (*num_dn_slaves)++;
- numnodes = *num_dn_slaves;
- nodes = dnslaveOids;
- break;
default:
break;
}
@@ -219,10 +253,6 @@ PgxcNodeListAndCount(Oid **coOids, Oid **dnOids, Oid **coslaveOids, Oid **dnslav
qsort(*coOids, *num_coords, sizeof(Oid), cmp_nodes);
if (NumDataNodes != 0)
qsort(*dnOids, *num_dns, sizeof(Oid), cmp_nodes);
- if (NumDataNodeSlaves != 0)
- qsort(*coslaveOids, *num_co_slaves, sizeof(Oid), cmp_nodes);
- if (NumDataNodeSlaves != 0)
- qsort(*dnslaveOids, *num_dn_slaves, sizeof(Oid), cmp_nodes);
}
/*
@@ -234,7 +264,6 @@ void
PgxcNodeCreate(CreateNodeStmt *stmt)
{
Relation pgxcnodesrel;
- Oid node_relatedoid;
HeapTuple htup;
bool nulls[Natts_pgxc_node];
Datum values[Natts_pgxc_node];
@@ -242,13 +271,11 @@ PgxcNodeCreate(CreateNodeStmt *stmt)
int i;
/* Options */
DefElem *dhost = NULL;
- DefElem *drelated = NULL;
DefElem *dport = NULL;
DefElem *dtype = NULL;
DefElem *is_primary = NULL;
DefElem *is_preferred = NULL;
const char *node_host = NULL;
- const char *node_related = NULL;
char node_type;
int node_port;
bool nodeis_primary = false;
@@ -269,11 +296,11 @@ PgxcNodeCreate(CreateNodeStmt *stmt)
/* Filter options */
check_options(stmt->options, &dhost,
- &drelated, &dport, &dtype,
+ &dport, &dtype,
&is_primary, &is_preferred);
/* Then assign default values if necessary */
- if (dport && dport->arg)
+ if (dport)
{
node_port = intVal(dport->arg);
}
@@ -286,7 +313,7 @@ PgxcNodeCreate(CreateNodeStmt *stmt)
}
/* For host */
- if (dhost && dhost->arg)
+ if (dhost)
{
node_host = strVal(dhost->arg);
}
@@ -299,15 +326,14 @@ PgxcNodeCreate(CreateNodeStmt *stmt)
}
/* For node type */
- if (dtype && dtype->arg)
+ if (dtype)
{
char *loc;
loc = strVal(dtype->arg);
- node_type = *loc;
- Assert(node_type == PGXC_NODE_COORD_MASTER ||
- node_type == PGXC_NODE_COORD_SLAVE ||
- node_type == PGXC_NODE_DATANODE_MASTER ||
- node_type == PGXC_NODE_DATANODE_SLAVE);
+ if (strcmp(loc, "coordinator") == 0)
+ node_type = PGXC_NODE_COORDINATOR;
+ else
+ node_type = PGXC_NODE_DATANODE;
}
else
{
@@ -318,60 +344,6 @@ PgxcNodeCreate(CreateNodeStmt *stmt)
node_name)));
}
- /* For node related */
- if (drelated && drelated->arg &&
- (node_type == PGXC_NODE_COORD_SLAVE ||
- node_type == PGXC_NODE_DATANODE_SLAVE))
- {
- /* Check if this related node exists for given name and get Oid */
- node_related = strVal(drelated->arg);
- node_relatedoid = get_pgxc_nodeoid(node_related);
- if (!OidIsValid(node_relatedoid))
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("PGXC node %s: related node not existing",
- node_name)));
- }
- else
- {
- /* Apply default */
- node_relatedoid = InvalidOid;
- elog(LOG, "PGXC node %s: Applying default related value",
- node_name);
- }
-
- /*
- * A master node cannot have a related node specified
- * this would mean that this master is under another master.
- */
- if ((node_type == PGXC_NODE_COORD_MASTER ||
- node_type == PGXC_NODE_DATANODE_MASTER) &&
- OidIsValid(node_relatedoid))
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("PGXC node %s: Related node specified for master",
- node_name)));
-
- /*
- * If a slave node is defined, a related node is mandatory
- * It doesn't matter if related node is master or slave.
- */
- if ((node_type == PGXC_NODE_COORD_SLAVE ||
- node_type == PGXC_NODE_DATANODE_SLAVE) &&
- !OidIsValid(node_relatedoid))
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("PGXC node %s: Related node not specified for slave",
- node_name)));
-
- if (node_port < 1 || node_port > 65535)
- {
- ereport(ERROR,
- (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
- errmsg("PGXC node %s: port value out of range",
- node_name)));
- }
-
/* Iterate through all attributes initializing nulls and values */
for (i = 0; i < Natts_pgxc_node; i++)
{
@@ -381,7 +353,7 @@ PgxcNodeCreate(CreateNodeStmt *stmt)
if (is_primary)
{
- if (node_type != PGXC_NODE_DATANODE_MASTER)
+ if (node_type != PGXC_NODE_DATANODE)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("PGXC node %s: cannot be a primary node, it has to be a master Datanode",
@@ -397,7 +369,7 @@ PgxcNodeCreate(CreateNodeStmt *stmt)
if (is_preferred)
{
- if (node_type != PGXC_NODE_DATANODE_MASTER)
+ if (node_type != PGXC_NODE_DATANODE)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("PGXC node %s: cannot be a preferred node, it has to be a master Datanode",
@@ -416,7 +388,6 @@ PgxcNodeCreate(CreateNodeStmt *stmt)
/* Build entry tuple */
values[Anum_pgxc_node_name - 1] = DirectFunctionCall1(namein, CStringGetDatum(node_name));
values[Anum_pgxc_node_type - 1] = CharGetDatum(node_type);
- values[Anum_pgxc_node_related - 1] = ObjectIdGetDatum(node_relatedoid);
values[Anum_pgxc_node_port - 1] = Int32GetDatum(node_port);
values[Anum_pgxc_node_host - 1] = DirectFunctionCall1(namein, CStringGetDatum(node_host));
values[Anum_pgxc_node_is_primary - 1] = BoolGetDatum(nodeis_primary);
@@ -441,20 +412,17 @@ void
PgxcNodeAlter(AlterNodeStmt *stmt)
{
DefElem *dhost = NULL;
- DefElem *drelated = NULL;
DefElem *dport = NULL;
DefElem *dtype = NULL;
DefElem *is_primary = NULL;
DefElem *is_preferred = NULL;
const char *node_name = stmt->node_name;
const char *node_host = NULL;
- const char *node_related = NULL;
char node_type = PGXC_NODE_NONE;
int node_port = 0;
bool nodeis_preferred = false;
bool nodeis_primary = false;
HeapTuple oldtup, newtup;
- Oid relatedOid = InvalidOid;
Oid nodeOid = get_pgxc_nodeoid(node_name);
Relation rel;
Datum new_record[Natts_pgxc_node];
@@ -484,30 +452,21 @@ PgxcNodeAlter(AlterNodeStmt *stmt)
/* Filter options */
check_options(stmt->options, &dhost,
- &drelated, &dport, &dtype,
+ &dport, &dtype,
&is_primary, &is_preferred);
/* Host value */
- if (dhost && dhost->arg)
+ if (dhost)
node_host = strVal(dhost->arg);
/* Port value */
- if (dport && dport->arg)
- {
+ if (dport)
node_port = intVal(dport->arg);
- if (node_port < 1 || node_port > 65535)
- {
- ereport(ERROR,
- (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
- errmsg("PGXC node %s: port value out of range",
- node_name)));
- }
- }
/* Primary node */
if (is_primary)
{
- if (get_pgxc_nodetype(nodeOid) != PGXC_NODE_DATANODE_MASTER)
+ if (get_pgxc_nodetype(nodeOid) != PGXC_NODE_DATANODE)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("PGXC node %s: cannot be a primary node, it has to be a master Datanode",
@@ -524,7 +483,7 @@ PgxcNodeAlter(AlterNodeStmt *stmt)
/* Preferred node */
if (is_preferred)
{
- if (get_pgxc_nodetype(nodeOid) != PGXC_NODE_DATANODE_MASTER)
+ if (get_pgxc_nodetype(nodeOid) != PGXC_NODE_DATANODE)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("PGXC node %s: cannot be a preferred node, it has to be a master Datanode",
@@ -532,71 +491,31 @@ PgxcNodeAlter(AlterNodeStmt *stmt)
nodeis_preferred = true;
}
- /* Related node */
- if (drelated && drelated->arg)
- {
- node_related = strVal(drelated->arg);
- relatedOid = get_pgxc_nodeoid(node_related);
- if (!OidIsValid(relatedOid))
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("PGXC node %s: related node not existing",
- node_name)));
-
- /* Just in case... */
- if (relatedOid == nodeOid)
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("PGXC node %s: node referencing to itself",
- node_name)));
- }
-
/* For node type */
- if (dtype && dtype->arg)
+ if (dtype)
{
char *loc;
Form_pgxc_node loctup = (Form_pgxc_node) GETSTRUCT(oldtup);
char node_type_old = loctup->node_type;
loc = strVal(dtype->arg);
- node_type = *loc;
- Assert(node_type == PGXC_NODE_COORD_MASTER ||
- node_type == PGXC_NODE_COORD_SLAVE ||
- node_type == PGXC_NODE_DATANODE_MASTER ||
- node_type == PGXC_NODE_DATANODE_SLAVE);
+ if (strcmp(loc, "coordinator") == 0)
+ node_type = PGXC_NODE_COORDINATOR;
+ else
+ node_type = PGXC_NODE_DATANODE;
/* Check type dependency */
- if ((node_type_old == PGXC_NODE_COORD_MASTER ||
- node_type_old == PGXC_NODE_COORD_SLAVE) &&
- (node_type == PGXC_NODE_DATANODE_MASTER ||
- node_type == PGXC_NODE_DATANODE_SLAVE))
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("PGXC node %s: cannot promote Coordinator to Datanode",
- node_name)));
- else if ((node_type_old == PGXC_NODE_DATANODE_MASTER ||
- node_type_old == PGXC_NODE_DATANODE_SLAVE) &&
- (node_type == PGXC_NODE_COORD_MASTER ||
- node_type == PGXC_NODE_COORD_SLAVE))
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("PGXC node %s: cannot promote Datanode to Coordinator",
- node_name)));
-
- /* Check related/type dependency */
- if ((node_type == PGXC_NODE_COORD_SLAVE ||
- node_type == PGXC_NODE_DATANODE_SLAVE) &&
- !OidIsValid(relatedOid))
+ if (node_type_old == PGXC_NODE_COORDINATOR &&
+ node_type == PGXC_NODE_DATANODE)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("PGXC node %s: undefined related node for slave node",
+ errmsg("PGXC node %s: cannot alter Coordinator to Datanode",
node_name)));
- if ((node_type == PGXC_NODE_COORD_MASTER ||
- node_type == PGXC_NODE_DATANODE_MASTER) &&
- OidIsValid(relatedOid))
+ else if (node_type_old == PGXC_NODE_DATANODE &&
+ node_type == PGXC_NODE_COORDINATOR)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("PGXC node %s: defined related node for master node",
+ errmsg("PGXC node %s: cannot alter Datanode to Coordinator",
node_name)));
}
@@ -615,14 +534,6 @@ PgxcNodeAlter(AlterNodeStmt *stmt)
DirectFunctionCall1(namein, CStringGetDatum(node_host));
new_record_repl[Anum_pgxc_node_host - 1] = true;
}
- if (drelated ||
- node_type == PGXC_NODE_COORD_MASTER ||
- node_type == PGXC_NODE_DATANODE_MASTER)
- {
- /* Force update of related node to InvalidOid if node is changed to master */
- new_record[Anum_pgxc_node_related - 1] = ObjectIdGetDatum(relatedOid);
- new_record_repl[Anum_pgxc_node_related - 1] = true;
- }
if (node_type != PGXC_NODE_NONE)
{
new_record[Anum_pgxc_node_type - 1] = CharGetDatum(node_type);
diff --git a/src/backend/pgxc/pool/execRemote.c b/src/backend/pgxc/pool/execRemote.c
index b8a34b2110..228ef7aa94 100644
--- a/src/backend/pgxc/pool/execRemote.c
+++ b/src/backend/pgxc/pool/execRemote.c
@@ -953,7 +953,7 @@ BufferConnection(PGXCNodeHandle *conn)
combiner->tapenodes = (int*) palloc0(NumDataNodes * sizeof(int));
combiner->tapenodes[combiner->current_conn] =
PGXCNodeGetNodeId(conn->nodeoid,
- PGXC_NODE_DATANODE_MASTER);
+ PGXC_NODE_DATANODE);
}
else
/* Remove current connection, move last in-place, adjust current_conn */
@@ -1266,7 +1266,7 @@ handle_response(PGXCNodeHandle * conn, RemoteQueryState *combiner)
Assert(conn->have_row_desc);
#endif
HandleDataRow(combiner, msg, msg_len, PGXCNodeGetNodeId(conn->nodeoid,
- PGXC_NODE_DATANODE_MASTER));
+ PGXC_NODE_DATANODE));
return RESPONSE_DATAROW;
case 's': /* PortalSuspended */
suspended = true;
@@ -1440,14 +1440,14 @@ analyze_node_string(char *nodestring,
errmsg("PGXC Node %s: object not defined",
nodename)));
- if (get_pgxc_nodetype(nodeoid) == PGXC_NODE_DATANODE_MASTER)
+ if (get_pgxc_nodetype(nodeoid) == PGXC_NODE_DATANODE)
{
- int nodeid = PGXCNodeGetNodeId(nodeoid, PGXC_NODE_DATANODE_MASTER);
+ int nodeid = PGXCNodeGetNodeId(nodeoid, PGXC_NODE_DATANODE);
*datanodelist = lappend_int(*datanodelist, nodeid);
}
- else if (get_pgxc_nodetype(nodeoid) == PGXC_NODE_COORD_MASTER)
+ else if (get_pgxc_nodetype(nodeoid) == PGXC_NODE_COORDINATOR)
{
- int nodeid = PGXCNodeGetNodeId(nodeoid, PGXC_NODE_COORD_MASTER);
+ int nodeid = PGXCNodeGetNodeId(nodeoid, PGXC_NODE_COORDINATOR);
/* Local Coordinator has been found, so commit it */
if (nodeid == PGXCNodeId - 1)
is_local_coord = true;
@@ -3257,7 +3257,7 @@ pgxc_start_command_on_connection(PGXCNodeHandle *connection, bool need_tran,
if (step->statement)
prepared = ActivateDatanodeStatementOnNode(step->statement,
PGXCNodeGetNodeId(connection->nodeoid,
- PGXC_NODE_DATANODE_MASTER));
+ PGXC_NODE_DATANODE));
/*
* execute and fetch rows only if they will be consumed
* immediately by the sorter
diff --git a/src/backend/pgxc/pool/pgxcnode.c b/src/backend/pgxc/pool/pgxcnode.c
index b1c1f84997..cca5febbe3 100644
--- a/src/backend/pgxc/pool/pgxcnode.c
+++ b/src/backend/pgxc/pool/pgxcnode.c
@@ -51,24 +51,20 @@
static int datanode_count = 0;
static int coord_count = 0;
-static int datanode_slave_count = 0;
-static int coord_slave_count = 0;
/*
- * Datanode handles of masters and slaves, saved in Transaction memory context
+ * Datanode handles saved in Transaction memory context
* when PostgresMain is launched.
* Those handles are used inside a transaction by Coordinator to Datanodes.
*/
static PGXCNodeHandle *dn_handles = NULL;
-static PGXCNodeHandle *dn_slave_handles = NULL;
/*
- * Coordinator handles of masters and slaves, saved in Transaction memory context
+ * Coordinator handles saved in Transaction memory context
* when PostgresMain is launched.
* Those handles are used inside a transaction by Coordinator to Coordinators
*/
static PGXCNodeHandle *co_handles = NULL;
-static PGXCNodeHandle *co_slave_handles = NULL;
static void pgxc_node_init(PGXCNodeHandle *handle, int sock);
static void pgxc_node_free(PGXCNodeHandle *handle);
@@ -118,7 +114,7 @@ void
InitMultinodeExecutor(bool is_force)
{
int count;
- Oid *coOids, *dnOids, *coslaveOids, *dnslaveOids;
+ Oid *coOids, *dnOids;
/* Free all the existing information first */
if (is_force)
@@ -126,14 +122,11 @@ InitMultinodeExecutor(bool is_force)
/* This function could get called multiple times because of sigjmp */
if (dn_handles != NULL &&
- co_handles != NULL &&
- dn_slave_handles != NULL &&
- co_slave_handles != NULL)
+ co_handles != NULL)
return;
/* Get classified list of node Oids */
- PgxcNodeListAndCount(&coOids, &dnOids, &coslaveOids, &dnslaveOids,
- &NumCoords, &NumDataNodes, &NumCoordSlaves, &NumDataNodeSlaves);
+ PgxcNodeListAndCount(&coOids, &dnOids, &NumCoords, &NumDataNodes);
/* Do proper initialization of handles */
if (NumDataNodes > 0)
@@ -142,17 +135,9 @@ InitMultinodeExecutor(bool is_force)
if (NumCoords > 0)
co_handles = (PGXCNodeHandle *)
palloc(NumCoords * sizeof(PGXCNodeHandle));
- if (NumDataNodeSlaves > 0)
- dn_slave_handles = (PGXCNodeHandle *)
- palloc(NumDataNodeSlaves * sizeof(PGXCNodeHandle));
- if (NumCoordSlaves > 0)
- co_slave_handles = (PGXCNodeHandle *)
- palloc(NumCoordSlaves * sizeof(PGXCNodeHandle));
if ((!dn_handles && NumDataNodes > 0) ||
- (!co_handles && NumCoords > 0) ||
- (!dn_slave_handles && NumDataNodeSlaves > 0) ||
- (!co_slave_handles && NumCoordSlaves > 0))
+ (!co_handles && NumCoords > 0))
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory for node handles")));
@@ -168,21 +153,9 @@ InitMultinodeExecutor(bool is_force)
init_pgxc_handle(&co_handles[count]);
co_handles[count].nodeoid = coOids[count];
}
- for (count = 0; count < NumCoordSlaves; count++)
- {
- init_pgxc_handle(&co_slave_handles[count]);
- co_slave_handles[count].nodeoid = coslaveOids[count];
- }
- for (count = 0; count < NumDataNodeSlaves; count++)
- {
- init_pgxc_handle(&dn_slave_handles[count]);
- dn_slave_handles[count].nodeoid = dnslaveOids[count];
- }
datanode_count = 0;
coord_count = 0;
- datanode_slave_count = 0;
- coord_slave_count = 0;
PGXCNodeId = 0;
/* Finally determine which is the node-self */
@@ -338,14 +311,6 @@ pgxc_node_all_free(void)
num_nodes = NumDataNodes;
array_handles = dn_handles;
break;
- case 2:
- num_nodes = NumCoordSlaves;
- array_handles = co_slave_handles;
- break;
- case 3:
- num_nodes = NumDataNodeSlaves;
- array_handles = dn_slave_handles;
- break;
default:
Assert(0);
}
@@ -361,8 +326,6 @@ pgxc_node_all_free(void)
co_handles = NULL;
dn_handles = NULL;
- co_slave_handles = NULL;
- dn_slave_handles = NULL;
}
/*
@@ -840,7 +803,7 @@ cancel_query(void)
if (handle->state != DN_CONNECTION_STATE_IDLE)
{
dn_cancel[dn_count++] = PGXCNodeGetNodeId(handle->nodeoid,
- PGXC_NODE_DATANODE_MASTER);
+ PGXC_NODE_DATANODE);
}
}
}
@@ -863,7 +826,7 @@ cancel_query(void)
if (handle->state != DN_CONNECTION_STATE_IDLE)
{
co_cancel[dn_count++] = PGXCNodeGetNodeId(handle->nodeoid,
- PGXC_NODE_COORD_MASTER);
+ PGXC_NODE_COORDINATOR);
}
}
}
@@ -2262,22 +2225,14 @@ PGXCNodeGetNodeId(Oid nodeoid, char node_type)
switch (node_type)
{
- case PGXC_NODE_COORD_MASTER:
+ case PGXC_NODE_COORDINATOR:
num_nodes = NumCoords;
handles = co_handles;
break;
- case PGXC_NODE_DATANODE_MASTER:
+ case PGXC_NODE_DATANODE:
num_nodes = NumDataNodes;
handles = dn_handles;
break;
- case PGXC_NODE_COORD_SLAVE:
- num_nodes = NumCoordSlaves;
- handles = co_slave_handles;
- break;
- case PGXC_NODE_DATANODE_SLAVE:
- num_nodes = NumDataNodeSlaves;
- handles = dn_slave_handles;
- break;
default:
/* Should not happen */
Assert(0);
@@ -2307,18 +2262,12 @@ PGXCNodeGetNodeOid(int nodeid, char node_type)
switch (node_type)
{
- case PGXC_NODE_COORD_MASTER:
+ case PGXC_NODE_COORDINATOR:
handles = co_handles;
break;
- case PGXC_NODE_DATANODE_MASTER:
+ case PGXC_NODE_DATANODE:
handles = dn_handles;
break;
- case PGXC_NODE_COORD_SLAVE:
- handles = co_slave_handles;
- break;
- case PGXC_NODE_DATANODE_SLAVE:
- handles = dn_slave_handles;
- break;
default:
/* Should not happen */
Assert(0);
diff --git a/src/backend/pgxc/pool/poolmgr.c b/src/backend/pgxc/pool/poolmgr.c
index b7e3a861f3..1651fc6c0d 100644
--- a/src/backend/pgxc/pool/poolmgr.c
+++ b/src/backend/pgxc/pool/poolmgr.c
@@ -84,8 +84,6 @@ static MemoryContext PoolerMemoryContext = NULL;
/* PGXC Nodes info list */
static PGXCNodeConnectionInfo *datanode_connInfos;
static PGXCNodeConnectionInfo *coord_connInfos;
-static PGXCNodeConnectionInfo *datanode_slave_connInfos;
-static PGXCNodeConnectionInfo *coord_slave_connInfos;
/* Pool to all the databases (linked list) */
static DatabasePool *databasePools = NULL;
@@ -246,28 +244,16 @@ node_info_free(void)
for (count = 0; count < NumCoords; count++)
pfree(coord_connInfos[count].host);
- for (count = 0; count < NumCoordSlaves; count++)
- pfree(coord_slave_connInfos[count].host);
for (count = 0; count < NumDataNodes; count++)
pfree(datanode_connInfos[count].host);
- for (count = 0; count < NumDataNodeSlaves; count++)
- pfree(datanode_slave_connInfos[count].host);
if (datanode_connInfos)
pfree(datanode_connInfos);
if (coord_connInfos)
pfree(coord_connInfos);
- if (coord_slave_connInfos)
- pfree(coord_slave_connInfos);
- if (datanode_slave_connInfos)
- pfree(datanode_slave_connInfos);
NumCoords = 0;
NumDataNodes = 0;
- NumDataNodeSlaves = 0;
- NumCoordSlaves = 0;
- datanode_slave_connInfos = NULL;
- coord_slave_connInfos = NULL;
coord_connInfos = NULL;
datanode_connInfos = NULL;
}
@@ -281,12 +267,9 @@ node_info_load(void)
int count;
Oid *coOids = NULL;
Oid *dnOids = NULL;
- Oid *coslaveOids = NULL;
- Oid *dnslaveOids = NULL;
/* Update number of PGXC nodes saved in cache */
- PgxcNodeListAndCount(&coOids, &dnOids, &coslaveOids, &dnslaveOids,
- &NumCoords, &NumDataNodes, &NumCoordSlaves, &NumDataNodeSlaves);
+ PgxcNodeListAndCount(&coOids, &dnOids, &NumCoords, &NumDataNodes);
/* Then initialize the node informations */
if (NumDataNodes != 0)
@@ -295,12 +278,6 @@ node_info_load(void)
if (NumCoords != 0)
coord_connInfos = (PGXCNodeConnectionInfo *)
palloc(NumCoords * sizeof(PGXCNodeConnectionInfo));
- if (NumCoordSlaves != 0)
- coord_slave_connInfos = (PGXCNodeConnectionInfo *)
- palloc(NumCoordSlaves * sizeof(PGXCNodeConnectionInfo));
- if (NumDataNodeSlaves != 0)
- datanode_slave_connInfos = (PGXCNodeConnectionInfo *)
- palloc(NumDataNodeSlaves * sizeof(PGXCNodeConnectionInfo));
/* Fill in connection info structures */
for (count = 0; count < NumCoords; count++)
@@ -315,28 +292,12 @@ node_info_load(void)
datanode_connInfos[count].port = get_pgxc_nodeport(dnOids[count]);
datanode_connInfos[count].host = get_pgxc_nodehost(dnOids[count]);
}
- for (count = 0; count < NumCoordSlaves; count++)
- {
- coord_slave_connInfos[count].nodeoid = coslaveOids[count];
- coord_slave_connInfos[count].port = get_pgxc_nodeport(coslaveOids[count]);
- coord_slave_connInfos[count].host = get_pgxc_nodehost(coslaveOids[count]);
- }
- for (count = 0; count < NumDataNodeSlaves; count++)
- {
- datanode_slave_connInfos[count].nodeoid = dnOids[count];
- datanode_slave_connInfos[count].port = get_pgxc_nodeport(dnslaveOids[count]);
- datanode_slave_connInfos[count].host = get_pgxc_nodehost(dnslaveOids[count]);
- }
/* Clean up resources */
if (coOids)
pfree(coOids);
if (dnOids)
pfree(dnOids);
- if (coslaveOids)
- pfree(coslaveOids);
- if (dnslaveOids)
- pfree(dnslaveOids);
}
/*
@@ -346,22 +307,17 @@ static int
node_info_check(void)
{
int res = POOL_CHECK_SUCCESS;
- int num_coord, num_dn,
- num_coord_slave, num_dn_slave, i, j;
+ int num_coord, num_dn, i, j;
Oid *coOids = NULL;
Oid *dnOids = NULL;
- Oid *coslaveOids = NULL;
- Oid *dnslaveOids = NULL;
/* Update number of PGXC nodes saved in cache */
- PgxcNodeListAndCount(&coOids, &dnOids, &coslaveOids, &dnslaveOids,
- &num_coord, &num_dn, &num_coord_slave, &num_dn_slave);
+ PgxcNodeListAndCount(&coOids, &dnOids,
+ &num_coord, &num_dn);
/* Check first if node numbers are consistent */
if (NumCoords != num_coord ||
- NumDataNodes != num_dn ||
- NumCoordSlaves != num_coord_slave ||
- NumDataNodeSlaves != num_dn_slave)
+ NumDataNodes != num_dn)
{
res = POOL_CHECK_FAILED;
goto finish;
@@ -387,16 +343,6 @@ node_info_check(void)
oid_vector = dnOids;
conninfo = datanode_connInfos;
break;
- case 2:
- numnodes = NumCoordSlaves;
- oid_vector = coslaveOids;
- conninfo = coord_slave_connInfos;
- break;
- case 3:
- numnodes = NumDataNodeSlaves;
- oid_vector = dnslaveOids;
- conninfo = datanode_slave_connInfos;
- break;
default:
Assert(0);
}
@@ -420,10 +366,6 @@ finish:
pfree(coOids);
if (dnOids)
pfree(dnOids);
- if (coslaveOids)
- pfree(coslaveOids);
- if (dnslaveOids)
- pfree(dnslaveOids);
return res;
}
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 94f1511590..b0a323c4c0 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -1130,14 +1130,14 @@ PostmasterMain(int argc, char *argv[])
/* Register node on GTM during Postmaster Startup. */
if (IS_PGXC_COORDINATOR)
{
- if (RegisterGTM(PGXC_NODE_COORDINATOR, PostPortNumber, userDoption) < 0)
+ if (RegisterGTM(GTM_NODE_COORDINATOR, PostPortNumber, userDoption) < 0)
ereport(FATAL,
(errcode(ERRCODE_IO_ERROR),
errmsg("Can not register Coordinator on GTM")));
}
if (IS_PGXC_DATANODE)
{
- if (RegisterGTM(PGXC_NODE_DATANODE, PostPortNumber, userDoption) < 0)
+ if (RegisterGTM(GTM_NODE_DATANODE, PostPortNumber, userDoption) < 0)
ereport(FATAL,
(errcode(ERRCODE_IO_ERROR),
errmsg("Can not register Datanode on GTM")));
@@ -2315,9 +2315,9 @@ pmdie(SIGNAL_ARGS)
/* Unregister Node on GTM */
if (IS_PGXC_COORDINATOR)
- UnregisterGTM(PGXC_NODE_COORDINATOR);
+ UnregisterGTM(GTM_NODE_COORDINATOR);
else if (IS_PGXC_DATANODE)
- UnregisterGTM(PGXC_NODE_DATANODE);
+ UnregisterGTM(GTM_NODE_DATANODE);
#endif
/*
@@ -2388,9 +2388,9 @@ pmdie(SIGNAL_ARGS)
/* Unregister Node on GTM */
if (IS_PGXC_COORDINATOR)
- UnregisterGTM(PGXC_NODE_COORDINATOR);
+ UnregisterGTM(GTM_NODE_COORDINATOR);
else if (IS_PGXC_DATANODE)
- UnregisterGTM(PGXC_NODE_DATANODE);
+ UnregisterGTM(GTM_NODE_DATANODE);
#endif
pmState = PM_WAIT_BACKENDS;
}
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index 5524334126..fa179c29c1 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -2262,29 +2262,6 @@ get_pgxc_nodehost(Oid nodeid)
}
/*
- * get_pgxc_noderelated
- * Get node related for given Oid
- */
-Oid
-get_pgxc_noderelated(Oid nodeid)
-{
- HeapTuple tuple;
- Form_pgxc_node nodeForm;
- Oid result;
-
- tuple = SearchSysCache1(PGXCNODEOID, ObjectIdGetDatum(nodeid));
-
- if (!HeapTupleIsValid(tuple))
- elog(ERROR, "cache lookup failed for node %u", nodeid);
-
- nodeForm = (Form_pgxc_node) GETSTRUCT(tuple);
- result = nodeForm->node_related;
- ReleaseSysCache(tuple);
-
- return result;
-}
-
-/*
* is_pgxc_nodepreferred
* Determine if node is a preferred one
*/
diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c
index 30b38ccd1d..bdc8342f8c 100644
--- a/src/backend/utils/sort/tuplesort.c
+++ b/src/backend/utils/sort/tuplesort.c
@@ -3034,7 +3034,7 @@ getlen_datanode(Tuplesortstate *state, int tapenum, bool eofOK)
(errcode(ERRCODE_INTERNAL_ERROR),
errmsg("Failed to fetch from data node cursor")));
- nid = conn ? PGXCNodeGetNodeId(conn->nodeoid, PGXC_NODE_DATANODE_MASTER) : combiner->tapenodes[tapenum];
+ nid = conn ? PGXCNodeGetNodeId(conn->nodeoid, PGXC_NODE_DATANODE) : combiner->tapenodes[tapenum];
if (nid < 0)
ereport(ERROR,
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 2b8f691b37..dd6a2bb325 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -1496,7 +1496,7 @@ setup_nodeself(void)
PG_CMD_OPEN;
- PG_CMD_PRINTF1("CREATE NODE %s WITH (COORDINATOR MASTER);\n",
+ PG_CMD_PRINTF1("CREATE NODE %s WITH (type = 'coordinator');\n",
nodename);
PG_CMD_CLOSE;
diff --git a/src/gtm/client/fe-connect.c b/src/gtm/client/fe-connect.c
index db4c8dfb29..56bdb1fe47 100644
--- a/src/gtm/client/fe-connect.c
+++ b/src/gtm/client/fe-connect.c
@@ -179,7 +179,7 @@ connectOptions1(GTM_Conn *conn, const char *conninfo)
tmp = conninfo_getval(connOptions, "postmaster");
conn->is_postmaster = tmp ? atoi(tmp) : 0;
tmp = conninfo_getval(connOptions, "remote_type");
- conn->remote_type = tmp ? atoi(tmp) : PGXC_NODE_DEFAULT;
+ conn->remote_type = tmp ? atoi(tmp) : GTM_NODE_DEFAULT;
/*
* Free the option info - all is in conn now
diff --git a/src/gtm/client/fe-protocol.c b/src/gtm/client/fe-protocol.c
index 610b1b6db6..5f04373cfa 100644
--- a/src/gtm/client/fe-protocol.c
+++ b/src/gtm/client/fe-protocol.c
@@ -189,7 +189,7 @@ gtmpqGetError(GTM_Conn *conn, GTM_Result *result)
* If we are a GTM proxy, expect an additional proxy header in the incoming
* message.
*/
- if (conn->remote_type == PGXC_NODE_GTM_PROXY)
+ if (conn->remote_type == GTM_NODE_GTM_PROXY)
{
if (gtmpqGetnchar((char *)&result->gr_proxyhdr,
sizeof (GTM_ProxyMsgHeader), conn))
@@ -306,7 +306,7 @@ gtmpqParseSuccess(GTM_Conn *conn, GTM_Result *result)
return 1;
result->gr_msglen -= 4;
- if (conn->remote_type == PGXC_NODE_GTM_PROXY)
+ if (conn->remote_type == GTM_NODE_GTM_PROXY)
{
if (gtmpqGetnchar((char *)&result->gr_proxyhdr,
sizeof (GTM_ProxyMsgHeader), conn))
@@ -780,7 +780,7 @@ gtmpqFreeResultData(GTM_Result *result, GTM_PGXCNodeType remote_type)
* change though as we add more message types below and some of them may
* need cleanup even at the proxy level
*/
- if (remote_type == PGXC_NODE_GTM_PROXY)
+ if (remote_type == GTM_NODE_GTM_PROXY)
return;
switch (result->gr_type)
diff --git a/src/gtm/client/gtm_client.c b/src/gtm/client/gtm_client.c
index 365fc9b36d..d830971363 100644
--- a/src/gtm/client/gtm_client.c
+++ b/src/gtm/client/gtm_client.c
@@ -1150,7 +1150,7 @@ node_get_local_addr(GTM_Conn *conn, char *buf, size_t buflen, int *rc)
memset(local_port, 0, sizeof(local_port));
memset(buf, 0, buflen);
- if (conn->remote_type != PGXC_NODE_GTM_PROXY)
+ if (conn->remote_type != GTM_NODE_GTM_PROXY)
{
if (gtm_getnameinfo_all(&conn->laddr.addr, conn->laddr.salen,
local_host, sizeof(local_host),
diff --git a/src/gtm/client/test/test_seq.c b/src/gtm/client/test/test_seq.c
index 0a30f05e61..ad36f25677 100644
--- a/src/gtm/client/test/test_seq.c
+++ b/src/gtm/client/test/test_seq.c
@@ -19,7 +19,7 @@ main(int argc, char *argv[])
char connect_string[100];
//FIXME This statement is wrong
- sprintf(connect_string, "host=%s port=%d node_name=one remote_type=%d", PGXC_NODE_COORDINATOR);
+ sprintf(connect_string, "host=%s port=%d node_name=one remote_type=%d", GTM_NODE_COORDINATOR);
conn = PQconnectGTM(connect_string);
if (conn == NULL)
diff --git a/src/gtm/client/test/test_snap.c b/src/gtm/client/test/test_snap.c
index bdf1071bb4..a150fb9ff8 100644
--- a/src/gtm/client/test/test_snap.c
+++ b/src/gtm/client/test/test_snap.c
@@ -21,7 +21,7 @@ main(int argc, char *argv[])
for (ii = 0; ii < 3; ii++)
fork();
- sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d", PGXC_NODE_COORDINATOR);
+ sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d", GTM_NODE_COORDINATOR);
conn = PQconnectGTM(connect_string);
if (conn == NULL)
diff --git a/src/gtm/client/test/test_snapperf.c b/src/gtm/client/test/test_snapperf.c
index 3ef801216f..581924f4a8 100644
--- a/src/gtm/client/test/test_snapperf.c
+++ b/src/gtm/client/test/test_snapperf.c
@@ -24,7 +24,7 @@ main(int argc, char *argv[])
GTM_Conn *conn;
char connect_string[100];
- sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d", PGXC_NODE_COORDINATOR);
+ sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d", GTM_NODE_COORDINATOR);
conn = PQconnectGTM(connect_string);
if (conn == NULL)
diff --git a/src/gtm/client/test/test_txn.c b/src/gtm/client/test/test_txn.c
index 37d7194a8a..6415f1567c 100644
--- a/src/gtm/client/test/test_txn.c
+++ b/src/gtm/client/test/test_txn.c
@@ -23,7 +23,7 @@ main(int argc, char *argv[])
for (ii = 0; ii < 3; ii++)
fork();
- sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d", PGXC_NODE_COORDINATOR);
+ sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d", GTM_NODE_COORDINATOR);
conn = PQconnectGTM(connect_string);
if (conn == NULL)
diff --git a/src/gtm/client/test/test_txnperf.c b/src/gtm/client/test/test_txnperf.c
index f44526c4c3..53d0012cd2 100644
--- a/src/gtm/client/test/test_txnperf.c
+++ b/src/gtm/client/test/test_txnperf.c
@@ -132,7 +132,7 @@ main(int argc, char *argv[])
}
}
- sprintf(connect_string, "host=%s port=%d node_name=%s remote_type=%d", gtmhost, gtmport, tmp_name, PGXC_NODE_COORDINATOR);
+ sprintf(connect_string, "host=%s port=%d node_name=%s remote_type=%d", gtmhost, gtmport, tmp_name, GTM_NODE_COORDINATOR);
sprintf(system_cmd, "echo -------------------------------------------------------- >> %s", test_output);
system(system_cmd);
diff --git a/src/gtm/common/elog.c b/src/gtm/common/elog.c
index 3ca63558db..9098b0ade1 100644
--- a/src/gtm/common/elog.c
+++ b/src/gtm/common/elog.c
@@ -862,7 +862,7 @@ send_message_to_frontend(Port *myport, ErrorData *edata)
/* 'N' (Notice) is for nonfatal conditions, 'E' is for errors */
pq_beginmessage(&msgbuf, (edata->elevel < ERROR) ? 'N' : 'E');
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
diff --git a/src/gtm/main/gtm_seq.c b/src/gtm/main/gtm_seq.c
index 261af75e3a..05beef11e7 100644
--- a/src/gtm/main/gtm_seq.c
+++ b/src/gtm/main/gtm_seq.c
@@ -887,7 +887,7 @@ ProcessSequenceInitCommand(Port *myport, StringInfo message)
*/
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, SEQUENCE_INIT_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -897,7 +897,7 @@ ProcessSequenceInitCommand(Port *myport, StringInfo message)
pq_sendbytes(&buf, seqkey.gsk_key, seqkey.gsk_keylen);
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -982,7 +982,7 @@ ProcessSequenceAlterCommand(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, SEQUENCE_ALTER_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -992,7 +992,7 @@ ProcessSequenceAlterCommand(Port *myport, StringInfo message)
pq_sendbytes(&buf, seqkey.gsk_key, seqkey.gsk_keylen);
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if ( GetMyThreadInfo->thr_conn->standby )
@@ -1080,7 +1080,7 @@ ProcessSequenceListCommand(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, SEQUENCE_LIST_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1112,7 +1112,7 @@ ProcessSequenceListCommand(Port *myport, StringInfo message)
elog(LOG, "ProcessSequenceListCommand() done.");
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
}
@@ -1140,7 +1140,7 @@ ProcessSequenceGetCurrentCommand(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, SEQUENCE_GET_CURRENT_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1151,7 +1151,7 @@ ProcessSequenceGetCurrentCommand(Port *myport, StringInfo message)
pq_sendbytes(&buf, (char *)&seqval, sizeof (GTM_Sequence));
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -1197,7 +1197,7 @@ ProcessSequenceGetNextCommand(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, SEQUENCE_GET_NEXT_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1208,7 +1208,7 @@ ProcessSequenceGetNextCommand(Port *myport, StringInfo message)
pq_sendbytes(&buf, (char *)&seqval, sizeof (GTM_Sequence));
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -1275,7 +1275,7 @@ ProcessSequenceSetValCommand(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, SEQUENCE_SET_VAL_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1285,7 +1285,7 @@ ProcessSequenceSetValCommand(Port *myport, StringInfo message)
pq_sendbytes(&buf, seqkey.gsk_key, seqkey.gsk_keylen);
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -1332,7 +1332,7 @@ ProcessSequenceResetCommand(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, SEQUENCE_RESET_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1342,7 +1342,7 @@ ProcessSequenceResetCommand(Port *myport, StringInfo message)
pq_sendbytes(&buf, seqkey.gsk_key, seqkey.gsk_keylen);
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -1388,7 +1388,7 @@ ProcessSequenceCloseCommand(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, SEQUENCE_CLOSE_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1398,7 +1398,7 @@ ProcessSequenceCloseCommand(Port *myport, StringInfo message)
pq_sendbytes(&buf, seqkey.gsk_key, seqkey.gsk_keylen);
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -1460,7 +1460,7 @@ ProcessSequenceRenameCommand(Port *myport, StringInfo message)
/* Send a SUCCESS message back to the client */
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, SEQUENCE_RENAME_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1470,7 +1470,7 @@ ProcessSequenceRenameCommand(Port *myport, StringInfo message)
pq_sendbytes(&buf, newseqkey.gsk_key, newseqkey.gsk_keylen);
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
diff --git a/src/gtm/main/gtm_snap.c b/src/gtm/main/gtm_snap.c
index 5e8904fa5f..5d94479933 100644
--- a/src/gtm/main/gtm_snap.c
+++ b/src/gtm/main/gtm_snap.c
@@ -343,7 +343,7 @@ ProcessGetSnapshotCommand(Port *myport, StringInfo message, bool get_gxid)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, get_gxid ? SNAPSHOT_GXID_GET_RESULT : SNAPSHOT_GET_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -360,7 +360,7 @@ ProcessGetSnapshotCommand(Port *myport, StringInfo message, bool get_gxid)
sizeof(GlobalTransactionId) * snapshot->sn_xcnt);
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
return;
@@ -424,7 +424,7 @@ ProcessGetSnapshotCommandMulti(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, SNAPSHOT_GET_MULTI_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -440,7 +440,7 @@ ProcessGetSnapshotCommandMulti(Port *myport, StringInfo message)
sizeof(GlobalTransactionId) * snapshot->sn_xcnt);
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
diff --git a/src/gtm/main/gtm_standby.c b/src/gtm/main/gtm_standby.c
index 6e5a31d32d..d18118dc5d 100644
--- a/src/gtm/main/gtm_standby.c
+++ b/src/gtm/main/gtm_standby.c
@@ -45,7 +45,7 @@ gtm_standby_start_startup(void)
elog(LOG, "Connecting the GTM active on %s:%d...", active_address, active_port);
sprintf(connect_string, "host=%s port=%d node_name=%s remote_type=%d",
- active_address, active_port, NodeName, PGXC_NODE_GTM);
+ active_address, active_port, NodeName, GTM_NODE_GTM);
GTM_ActiveConn = PQconnectGTM(connect_string);
if (GTM_ActiveConn == NULL)
@@ -267,7 +267,7 @@ gtm_standby_register_self(const char *node_name, int port, const char *datadir)
standbyPortNumber = port;
standbyDataDir= (char *)datadir;
- rc = node_register_internal(GTM_ActiveConn, PGXC_NODE_GTM, standbyHostName, standbyPortNumber,
+ rc = node_register_internal(GTM_ActiveConn, GTM_NODE_GTM, standbyHostName, standbyPortNumber,
standbyNodeName, standbyDataDir, NODE_DISCONNECTED);
if (rc < 0)
{
@@ -292,14 +292,14 @@ gtm_standby_activate_self(void)
elog(LOG, "Updating the standby-GTM status to \"CONNECTED\"...");
- rc = node_unregister(GTM_ActiveConn, PGXC_NODE_GTM, standbyNodeName);
+ rc = node_unregister(GTM_ActiveConn, GTM_NODE_GTM, standbyNodeName);
if (rc < 0)
{
elog(LOG, "Failed to unregister old standby-GTM status.");
return 0;
}
- rc = node_register_internal(GTM_ActiveConn, PGXC_NODE_GTM, standbyHostName, standbyPortNumber,
+ rc = node_register_internal(GTM_ActiveConn, GTM_NODE_GTM, standbyHostName, standbyPortNumber,
standbyNodeName, standbyDataDir, NODE_CONNECTED);
if (rc < 0)
@@ -327,7 +327,7 @@ find_standby_node_info(void)
size_t n;
int i;
- n = pgxcnode_find_by_type(PGXC_NODE_GTM, node, 1024);
+ n = pgxcnode_find_by_type(GTM_NODE_GTM, node, 1024);
for (i = 0 ; i < n ; i++)
{
diff --git a/src/gtm/main/gtm_txn.c b/src/gtm/main/gtm_txn.c
index 594bade372..a5cd72b3ab 100644
--- a/src/gtm/main/gtm_txn.c
+++ b/src/gtm/main/gtm_txn.c
@@ -1001,7 +1001,7 @@ ProcessBeginTransactionCommand(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, TXN_BEGIN_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1011,7 +1011,7 @@ ProcessBeginTransactionCommand(Port *myport, StringInfo message)
pq_sendbytes(&buf, (char *)&timestamp, sizeof (GTM_Timestamp));
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
return;
}
@@ -1061,7 +1061,7 @@ ProcessBeginTransactionGetGXIDCommand(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, TXN_BEGIN_GETGXID_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1071,7 +1071,7 @@ ProcessBeginTransactionGetGXIDCommand(Port *myport, StringInfo message)
pq_sendbytes(&buf, (char *)&timestamp, sizeof (GTM_Timestamp));
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -1141,7 +1141,7 @@ ProcessBeginTransactionGetGXIDAutovacuumCommand(Port *myport, StringInfo message
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, TXN_BEGIN_GETGXID_AUTOVACUUM_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1150,7 +1150,7 @@ ProcessBeginTransactionGetGXIDAutovacuumCommand(Port *myport, StringInfo message
pq_sendbytes(&buf, (char *)&gxid, sizeof(gxid));
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -1238,7 +1238,7 @@ ProcessBeginTransactionGetGXIDCommandMulti(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, TXN_BEGIN_GETGXID_MULTI_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1249,7 +1249,7 @@ ProcessBeginTransactionGetGXIDCommandMulti(Port *myport, StringInfo message)
pq_sendbytes(&buf, (char *)&(timestamp), sizeof (GTM_Timestamp));
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -1333,7 +1333,7 @@ ProcessCommitTransactionCommand(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, TXN_COMMIT_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1343,7 +1343,7 @@ ProcessCommitTransactionCommand(Port *myport, StringInfo message)
pq_sendint(&buf, status, sizeof(status));
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -1424,7 +1424,7 @@ ProcessCommitPreparedTransactionCommand(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, TXN_COMMIT_PREPARED_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1434,7 +1434,7 @@ ProcessCommitPreparedTransactionCommand(Port *myport, StringInfo message)
pq_sendint(&buf, status[0], 4);
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -1526,7 +1526,7 @@ ProcessGetGIDDataTransactionCommand(Port *myport, StringInfo message)
*/
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, TXN_GET_GID_DATA_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1549,7 +1549,7 @@ ProcessGetGIDDataTransactionCommand(Port *myport, StringInfo message)
/* End of message */
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -1619,7 +1619,7 @@ ProcessGXIDListCommand(Port *myport, StringInfo message)
*/
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, TXN_GXID_LIST_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1630,7 +1630,7 @@ ProcessGXIDListCommand(Port *myport, StringInfo message)
pq_sendbytes(&buf, data, actlen); /* serialized GTM_Transactions */
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
{
pq_flush(myport);
elog(LOG, "pq_flush()");
@@ -1693,7 +1693,7 @@ ProcessRollbackTransactionCommand(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, TXN_ROLLBACK_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1703,7 +1703,7 @@ ProcessRollbackTransactionCommand(Port *myport, StringInfo message)
pq_sendint(&buf, status, sizeof(status));
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -1782,7 +1782,7 @@ ProcessCommitTransactionCommandMulti(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, TXN_COMMIT_MULTI_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1792,7 +1792,7 @@ ProcessCommitTransactionCommandMulti(Port *myport, StringInfo message)
pq_sendbytes(&buf, (char *)status, sizeof(int) * txn_count);
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -1875,7 +1875,7 @@ ProcessRollbackTransactionCommandMulti(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, TXN_ROLLBACK_MULTI_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1885,7 +1885,7 @@ ProcessRollbackTransactionCommandMulti(Port *myport, StringInfo message)
pq_sendbytes(&buf, (char *)status, sizeof(int) * txn_count);
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -1975,7 +1975,7 @@ ProcessStartPreparedTransactionCommand(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, TXN_START_PREPARED_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -1984,7 +1984,7 @@ ProcessStartPreparedTransactionCommand(Port *myport, StringInfo message)
pq_sendbytes(&buf, (char *)&gxid, sizeof(GlobalTransactionId));
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -2060,7 +2060,7 @@ ProcessPrepareTransactionCommand(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, TXN_PREPARE_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -2069,7 +2069,7 @@ ProcessPrepareTransactionCommand(Port *myport, StringInfo message)
pq_sendbytes(&buf, (char *)&gxid, sizeof(gxid));
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -2132,7 +2132,7 @@ ProcessGetGXIDTransactionCommand(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, TXN_GET_GXID_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -2142,7 +2142,7 @@ ProcessGetGXIDTransactionCommand(Port *myport, StringInfo message)
pq_sendbytes(&buf, (char *)&gxid, sizeof(gxid));
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
return;
}
@@ -2177,7 +2177,7 @@ ProcessGetNextGXIDTransactionCommand(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, TXN_GET_NEXT_GXID_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -2186,7 +2186,7 @@ ProcessGetNextGXIDTransactionCommand(Port *myport, StringInfo message)
pq_sendint(&buf, next_gxid, sizeof(GlobalTransactionId));
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
return;
}
diff --git a/src/gtm/main/main.c b/src/gtm/main/main.c
index 44d40bae4b..48dcf6fbf8 100644
--- a/src/gtm/main/main.c
+++ b/src/gtm/main/main.c
@@ -1058,7 +1058,7 @@ ProcessCommand(Port *myport, StringInfo input_message)
GTM_MessageType mtype;
GTM_ProxyMsgHeader proxyhdr;
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
pq_copymsgbytes(input_message, (char *)&proxyhdr, sizeof (GTM_ProxyMsgHeader));
else
proxyhdr.ph_conid = InvalidGTMProxyConnID;
diff --git a/src/gtm/proxy/proxy_main.c b/src/gtm/proxy/proxy_main.c
index 928d80dc3f..85166ec70d 100644
--- a/src/gtm/proxy/proxy_main.c
+++ b/src/gtm/proxy/proxy_main.c
@@ -1104,7 +1104,7 @@ GTMProxy_ThreadMain(void *argp)
* Set up connection with the GTM server
*/
sprintf(gtm_connect_string, "host=%s port=%d node_name=%s remote_type=%d",
- GTMServerHost, GTMServerPortNumber, GTMProxyNodeName, PGXC_NODE_GTM_PROXY);
+ GTMServerHost, GTMServerPortNumber, GTMProxyNodeName, GTM_NODE_GTM_PROXY);
thrinfo->thr_gtm_conn = PQconnectGTM(gtm_connect_string);
@@ -2977,7 +2977,7 @@ DeleteLockFile(const char *filename)
static void
UnregisterProxy(void)
{
- GTM_PGXCNodeType type = PGXC_NODE_GTM_PROXY;
+ GTM_PGXCNodeType type = GTM_NODE_GTM_PROXY;
GTM_Result *res = NULL;
time_t finish_time;
@@ -3037,7 +3037,7 @@ failed:
static void
RegisterProxy(bool is_reconnect)
{
- GTM_PGXCNodeType type = PGXC_NODE_GTM_PROXY;
+ GTM_PGXCNodeType type = GTM_NODE_GTM_PROXY;
GTM_PGXCNodePort port = (GTM_PGXCNodePort) GTMProxyPortNumber;
GTM_Result *res = NULL;
char proxyname[] = "";
@@ -3125,7 +3125,7 @@ ConnectGTM(void)
GTM_Conn *conn;
sprintf(conn_str, "host=%s port=%d node_name=%s remote_type=%d postmaster=1",
- GTMServerHost, GTMServerPortNumber, GTMProxyNodeName, PGXC_NODE_GTM_PROXY_POSTMASTER);
+ GTMServerHost, GTMServerPortNumber, GTMProxyNodeName, GTM_NODE_GTM_PROXY_POSTMASTER);
conn = PQconnectGTM(conn_str);
if (GTMPQstatus(conn) != CONNECTION_OK)
@@ -3171,7 +3171,7 @@ workerThreadReconnectToGTMstandby(void)
/* Disconnect the current connection and re-connect to the new GTM */
GTMPQfinish(GetMyThreadInfo->thr_gtm_conn);
sprintf(gtm_connect_string, "host=%s port=%d node_name=%s remote_type=%d",
- NewGTMServerHost, NewGTMServerPortNumber, GTMProxyNodeName, PGXC_NODE_GTM_PROXY);
+ NewGTMServerHost, NewGTMServerPortNumber, GTMProxyNodeName, GTM_NODE_GTM_PROXY);
elog(LOG, "Worker thread connecting to %s", gtm_connect_string);
GetMyThreadInfo->thr_gtm_conn = PQconnectGTM(gtm_connect_string);
diff --git a/src/gtm/recovery/register.c b/src/gtm/recovery/register.c
index 21d416d5e5..5c779391ca 100644
--- a/src/gtm/recovery/register.c
+++ b/src/gtm/recovery/register.c
@@ -481,12 +481,12 @@ ProcessPGXCNodeRegister(Port *myport, StringInfo message)
status = pq_getmsgint(message, sizeof (GTM_PGXCNodeStatus));
- if ((type!=PGXC_NODE_GTM_PROXY) &&
- (type!=PGXC_NODE_GTM_PROXY_POSTMASTER) &&
- (type!=PGXC_NODE_COORDINATOR) &&
- (type!=PGXC_NODE_DATANODE) &&
- (type!=PGXC_NODE_GTM) &&
- (type!=PGXC_NODE_DEFAULT))
+ if ((type!=GTM_NODE_GTM_PROXY) &&
+ (type!=GTM_NODE_GTM_PROXY_POSTMASTER) &&
+ (type!=GTM_NODE_COORDINATOR) &&
+ (type!=GTM_NODE_DATANODE) &&
+ (type!=GTM_NODE_GTM) &&
+ (type!=GTM_NODE_DEFAULT))
ereport(ERROR,
(EINVAL,
errmsg("Unknown node type.")));
@@ -517,7 +517,7 @@ ProcessPGXCNodeRegister(Port *myport, StringInfo message)
*/
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, NODE_REGISTER_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -530,7 +530,7 @@ ProcessPGXCNodeRegister(Port *myport, StringInfo message)
pq_sendbytes(&buf, node_name, strlen(node_name));
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -606,7 +606,7 @@ ProcessPGXCNodeUnregister(Port *myport, StringInfo message)
*/
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, NODE_UNREGISTER_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -620,7 +620,7 @@ ProcessPGXCNodeUnregister(Port *myport, StringInfo message)
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
if (GetMyThreadInfo->thr_conn->standby)
@@ -697,7 +697,7 @@ ProcessPGXCNodeList(Port *myport, StringInfo message)
*/
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, NODE_LIST_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -716,7 +716,7 @@ ProcessPGXCNodeList(Port *myport, StringInfo message)
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
/*
diff --git a/src/gtm/recovery/replication.c b/src/gtm/recovery/replication.c
index a6789758b7..c8005652d2 100644
--- a/src/gtm/recovery/replication.c
+++ b/src/gtm/recovery/replication.c
@@ -59,7 +59,7 @@ ProcessBeginReplicationInitialSyncRequest(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, NODE_BEGIN_REPLICATION_INIT_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -67,7 +67,7 @@ ProcessBeginReplicationInitialSyncRequest(Port *myport, StringInfo message)
}
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
elog(LOG, "ProcessBeginReplicationInitialSyncRequest() ok.");
@@ -104,7 +104,7 @@ ProcessEndReplicationInitialSyncRequest(Port *myport, StringInfo message)
pq_beginmessage(&buf, 'S');
pq_sendint(&buf, NODE_END_REPLICATION_INIT_RESULT, 4);
- if (myport->remote_type == PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type == GTM_NODE_GTM_PROXY)
{
GTM_ProxyMsgHeader proxyhdr;
proxyhdr.ph_conid = myport->conn_id;
@@ -112,7 +112,7 @@ ProcessEndReplicationInitialSyncRequest(Port *myport, StringInfo message)
}
pq_endmessage(myport, &buf);
- if (myport->remote_type != PGXC_NODE_GTM_PROXY)
+ if (myport->remote_type != GTM_NODE_GTM_PROXY)
pq_flush(myport);
elog(LOG, "ProcessEndReplicationInitialSyncRequest() ok.");
diff --git a/src/gtm/test/test_common.c b/src/gtm/test/test_common.c
index dead4d1054..022e4f0554 100644
--- a/src/gtm/test/test_common.c
+++ b/src/gtm/test/test_common.c
@@ -30,7 +30,7 @@ void
connect1()
{
sprintf(connect_string, "host=localhost port=6666 node_name=one_zero_one remote_type=%d",
- PGXC_NODE_GTM);
+ GTM_NODE_GTM);
conn = PQconnectGTM(connect_string);
if (conn == NULL)
@@ -48,7 +48,7 @@ void
connect2()
{
sprintf(connect_string, "host=localhost port=6667 node_name=one_zero_two remote_type=%d",
- PGXC_NODE_GTM);
+ GTM_NODE_GTM);
conn = PQconnectGTM(connect_string);
if (conn == NULL)
diff --git a/src/gtm/test/test_connect.c b/src/gtm/test/test_connect.c
index d8f66e5e6d..83ee654fce 100644
--- a/src/gtm/test/test_connect.c
+++ b/src/gtm/test/test_connect.c
@@ -32,7 +32,7 @@ test01()
SETUP();
sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d",
- PGXC_NODE_GTM_PROXY);
+ GTM_NODE_GTM_PROXY);
conn = PQconnectGTM(connect_string);
if (conn == NULL)
@@ -56,7 +56,7 @@ test02()
SETUP();
sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d",
- PGXC_NODE_GTM_PROXY_POSTMASTER);
+ GTM_NODE_GTM_PROXY_POSTMASTER);
conn = PQconnectGTM(connect_string);
if (conn == NULL)
@@ -80,7 +80,7 @@ test03()
SETUP();
sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d",
- PGXC_NODE_COORDINATOR);
+ GTM_NODE_COORDINATOR);
conn = PQconnectGTM(connect_string);
if (conn == NULL)
@@ -104,7 +104,7 @@ test04()
SETUP();
sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d",
- PGXC_NODE_DATANODE);
+ GTM_NODE_DATANODE);
conn = PQconnectGTM(connect_string);
if (conn == NULL)
@@ -128,7 +128,7 @@ test05()
SETUP();
sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d",
- PGXC_NODE_GTM);
+ GTM_NODE_GTM);
conn = PQconnectGTM(connect_string);
if (conn == NULL)
@@ -152,7 +152,7 @@ test06()
SETUP();
sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d",
- PGXC_NODE_DEFAULT);
+ GTM_NODE_DEFAULT);
conn = PQconnectGTM(connect_string);
if (conn == NULL)
diff --git a/src/gtm/test/test_node.c b/src/gtm/test/test_node.c
index 5978606b9c..17dc070623 100644
--- a/src/gtm/test/test_node.c
+++ b/src/gtm/test/test_node.c
@@ -32,7 +32,7 @@ test_node_01()
SETUP();
- rc = node_register(conn, PGXC_NODE_DATANODE, 6666, "one", "/tmp/pgxc/data/gtm");
+ rc = node_register(conn, GTM_NODE_DATANODE, 6666, "one", "/tmp/pgxc/data/gtm");
_ASSERT( rc >= 0 );
TEARDOWN();
@@ -45,7 +45,7 @@ test_node_02()
SETUP();
- rc = node_unregister(conn, PGXC_NODE_DATANODE, "One");
+ rc = node_unregister(conn, GTM_NODE_DATANODE, "One");
_ASSERT( rc >= 0 );
TEARDOWN();
@@ -86,7 +86,7 @@ test_node_04()
data = (GTM_PGXCNodeInfo *)malloc( sizeof(GTM_PGXCNodeInfo)*128 );
memset(data, 0, sizeof(GTM_PGXCNodeInfo)*128);
- rc = node_register(conn, PGXC_NODE_DATANODE, 6666, "one", "/tmp/pgxc/data/gtm");
+ rc = node_register(conn, GTM_NODE_DATANODE, 6666, "one", "/tmp/pgxc/data/gtm");
_ASSERT( rc>=0 );
rc = get_node_list(conn, data, 128);
@@ -110,17 +110,17 @@ test_node_05()
SETUP();
- rc = node_unregister(conn, PGXC_NODE_DATANODE, "One zero one");
+ rc = node_unregister(conn, GTM_NODE_DATANODE, "One zero one");
- rc = node_register(conn, PGXC_NODE_DATANODE, 6666, "One zero one", "/tmp/pgxc/data/gtm");
+ rc = node_register(conn, GTM_NODE_DATANODE, 6666, "One zero one", "/tmp/pgxc/data/gtm");
_ASSERT( rc>=0 );
sleep(5);
- rc = backend_disconnect(conn, true, PGXC_NODE_DATANODE, "One Zero one");
+ rc = backend_disconnect(conn, true, GTM_NODE_DATANODE, "One Zero one");
_ASSERT( rc>=0 );
- rc = node_unregister(conn, PGXC_NODE_DATANODE, "One zero one");
+ rc = node_unregister(conn, GTM_NODE_DATANODE, "One zero one");
_ASSERT( rc>=0 );
TEARDOWN();
diff --git a/src/gtm/test/test_node5.c b/src/gtm/test/test_node5.c
index 50b3840585..df0d63a9fe 100644
--- a/src/gtm/test/test_node5.c
+++ b/src/gtm/test/test_node5.c
@@ -39,7 +39,7 @@ test_node5_01()
*/
connect1();
- rc = node_register(conn, PGXC_NODE_DATANODE, 16666, "One zero zero one", "/tmp/pgxc/data/gtm");
+ rc = node_register(conn, GTM_NODE_DATANODE, 16666, "One zero zero one", "/tmp/pgxc/data/gtm");
_ASSERT( rc >= 0 );
GTMPQfinish(conn);
@@ -50,7 +50,7 @@ test_node5_01()
*/
connect2();
- rc = node_unregister(conn, PGXC_NODE_DATANODE, "One zero zero one");
+ rc = node_unregister(conn, GTM_NODE_DATANODE, "One zero zero one");
_ASSERT( rc >= 0 );
GTMPQfinish(conn);
@@ -70,10 +70,10 @@ test_node5_02()
*/
connect1();
- rc = node_register(conn, PGXC_NODE_DATANODE, 16666, "One zero zero one", "/tmp/pgxc/data/gtm");
+ rc = node_register(conn, GTM_NODE_DATANODE, 16666, "One zero zero one", "/tmp/pgxc/data/gtm");
_ASSERT( rc >= 0 );
- rc = node_unregister(conn, PGXC_NODE_DATANODE, "One zero zero one");
+ rc = node_unregister(conn, GTM_NODE_DATANODE, "One zero zero one");
_ASSERT( rc >= 0 );
GTMPQfinish(conn);
@@ -84,7 +84,7 @@ test_node5_02()
*/
connect2();
- rc = node_unregister(conn, PGXC_NODE_DATANODE, "One zero zero one");
+ rc = node_unregister(conn, GTM_NODE_DATANODE, "One zero zero one");
_ASSERT( rc<0 );
GTMPQfinish(conn);
@@ -104,7 +104,7 @@ test_node5_03()
*/
connect1();
- rc = node_register(conn, PGXC_NODE_DATANODE, 16666, "One zero zero one", "/tmp/pgxc/data/gtm");
+ rc = node_register(conn, GTM_NODE_DATANODE, 16666, "One zero zero one", "/tmp/pgxc/data/gtm");
_ASSERT( rc >= 0 );
system("killall -9 gtm");
@@ -114,7 +114,7 @@ test_node5_03()
GTMPQfinish(conn);
connect2();
- rc = node_unregister(conn, PGXC_NODE_DATANODE, "One zero zero one");
+ rc = node_unregister(conn, GTM_NODE_DATANODE, "One zero zero one");
_ASSERT( rc >= 0 );
GTMPQfinish(conn);
diff --git a/src/gtm/test/test_repli.c b/src/gtm/test/test_repli.c
index 440f3a5b25..1077baebd6 100644
--- a/src/gtm/test/test_repli.c
+++ b/src/gtm/test/test_repli.c
@@ -18,7 +18,7 @@ void
setUp()
{
sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d",
- PGXC_NODE_GTM);
+ GTM_NODE_GTM);
conn = PQconnectGTM(connect_string);
diff --git a/src/gtm/test/test_repli2.c b/src/gtm/test/test_repli2.c
index dd3a9c673f..b9ed50bcb6 100644
--- a/src/gtm/test/test_repli2.c
+++ b/src/gtm/test/test_repli2.c
@@ -18,7 +18,7 @@ void
setUp()
{
sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d",
- PGXC_NODE_GTM);
+ GTM_NODE_GTM);
conn = PQconnectGTM(connect_string);
@@ -41,10 +41,10 @@ test01()
node_get_local_addr(conn, host, sizeof(host));
- rc = node_register_internal(conn, PGXC_NODE_GTM, host, 6667, "One zero One", "/tmp/pgxc/data/gtm_standby", NODE_DISCONNECTED);
+ rc = node_register_internal(conn, GTM_NODE_GTM, host, 6667, "One zero One", "/tmp/pgxc/data/gtm_standby", NODE_DISCONNECTED);
_ASSERT(rc == 0);
- rc = node_unregister(conn, PGXC_NODE_GTM, "One zero one");
+ rc = node_unregister(conn, GTM_NODE_GTM, "One zero one");
_ASSERT(rc == 0);
TEARDOWN();
@@ -66,10 +66,10 @@ test02()
*
* See pgxcnode_add_info() for more details.
*/
- rc = node_register_internal(conn, PGXC_NODE_GTM, host, 6667, "One zero One", "/tmp/pgxc/data/gtm_standby", NODE_CONNECTED);
+ rc = node_register_internal(conn, GTM_NODE_GTM, host, 6667, "One zero One", "/tmp/pgxc/data/gtm_standby", NODE_CONNECTED);
_ASSERT(rc == 0);
- rc = node_register_internal(conn, PGXC_NODE_GTM, host, 6667, "One zero One", "/tmp/pgxc/data/gtm_standby", NODE_CONNECTED);
+ rc = node_register_internal(conn, GTM_NODE_GTM, host, 6667, "One zero One", "/tmp/pgxc/data/gtm_standby", NODE_CONNECTED);
_ASSERT(rc != 0);
TEARDOWN();
@@ -82,7 +82,7 @@ test03()
SETUP();
- rc = node_unregister(conn, PGXC_NODE_GTM, "One zero one");
+ rc = node_unregister(conn, GTM_NODE_GTM, "One zero one");
_ASSERT( rc==0 );
TEARDOWN();
@@ -95,7 +95,7 @@ test04()
SETUP();
- rc = node_unregister(conn, PGXC_NODE_GTM, "One zero one");
+ rc = node_unregister(conn, GTM_NODE_GTM, "One zero one");
_ASSERT( rc!=0 );
TEARDOWN();
diff --git a/src/gtm/test/test_scenario.c b/src/gtm/test/test_scenario.c
index 8cbdd674c9..059da6fa7f 100644
--- a/src/gtm/test/test_scenario.c
+++ b/src/gtm/test/test_scenario.c
@@ -18,7 +18,7 @@ void
setUp()
{
sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d",
- PGXC_NODE_GTM);
+ GTM_NODE_GTM);
conn = PQconnectGTM(connect_string);
@@ -47,12 +47,12 @@ test01()
/*
* starting
*/
- rc = node_register_internal(conn, PGXC_NODE_GTM, host, 6667, "One zero two", "/tmp/pgxc/data/gtm_standby", NODE_DISCONNECTED);
+ rc = node_register_internal(conn, GTM_NODE_GTM, host, 6667, "One zero two", "/tmp/pgxc/data/gtm_standby", NODE_DISCONNECTED);
_ASSERT(rc == 0);
- rc = node_unregister(conn, PGXC_NODE_GTM, "One zero two");
+ rc = node_unregister(conn, GTM_NODE_GTM, "One zero two");
_ASSERT(rc == 0);
- rc = node_register_internal(conn, PGXC_NODE_GTM, host, 6667, "One zero two", "/tmp/pgxc/data/gtm_standby", NODE_CONNECTED);
+ rc = node_register_internal(conn, GTM_NODE_GTM, host, 6667, "One zero two", "/tmp/pgxc/data/gtm_standby", NODE_CONNECTED);
_ASSERT(rc == 0);
sleep(10);
@@ -71,7 +71,7 @@ test01()
/*
* closing
*/
- rc = node_unregister(conn, PGXC_NODE_GTM, "One zero two");
+ rc = node_unregister(conn, GTM_NODE_GTM, "One zero two");
_ASSERT( rc==0 );
tearDown();
diff --git a/src/gtm/test/test_standby.c b/src/gtm/test/test_standby.c
index 24599a2dda..8a447571ed 100644
--- a/src/gtm/test/test_standby.c
+++ b/src/gtm/test/test_standby.c
@@ -38,7 +38,7 @@ test_standby_01()
system("killall -9 gtm_standby");
sprintf(connect_string, "host=localhost port=6666 node_name=one_zero_one remote_type=%d",
- PGXC_NODE_GTM);
+ GTM_NODE_GTM);
conn = PQconnectGTM(connect_string);
diff --git a/src/gtm/test/test_startup.c b/src/gtm/test/test_startup.c
index 98b806457f..3bc91ba2f5 100644
--- a/src/gtm/test/test_startup.c
+++ b/src/gtm/test/test_startup.c
@@ -38,7 +38,7 @@ test_startup_01()
sleep(1);
sprintf(connect_string, "host=localhost port=6666 node_name=one_zero_one remote_type=%d",
- PGXC_NODE_DEFAULT);
+ GTM_NODE_DEFAULT);
conn = PQconnectGTM(connect_string);
_ASSERT(conn != NULL);
@@ -73,7 +73,7 @@ test_startup_01()
* connecting to the standby
*/
sprintf(connect_string, "host=localhost port=6667 node_name=one_zero_two remote_type=%d",
- PGXC_NODE_DEFAULT);
+ GTM_NODE_DEFAULT);
conn = PQconnectGTM(connect_string);
_ASSERT(conn != NULL);
diff --git a/src/gtm/test/test_txn.c b/src/gtm/test/test_txn.c
index 391e116f70..29d7bc9767 100644
--- a/src/gtm/test/test_txn.c
+++ b/src/gtm/test/test_txn.c
@@ -183,7 +183,7 @@ int
main(int argc, char *argv[])
{
sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d",
- PGXC_NODE_GTM);
+ GTM_NODE_GTM);
test_txn_01();
test_txn_02();
@@ -195,7 +195,7 @@ main(int argc, char *argv[])
* connect to standby. must be prevented.
*/
sprintf(connect_string, "host=localhost port=6667 node_name=one remote_type=%d",
- PGXC_NODE_GTM);
+ GTM_NODE_GTM);
test_txn_51();
test_txn_52();
diff --git a/src/gtm/test2/test_connect2.c b/src/gtm/test2/test_connect2.c
index 8784f55b05..b3be3ed0f4 100644
--- a/src/gtm/test2/test_connect2.c
+++ b/src/gtm/test2/test_connect2.c
@@ -15,7 +15,7 @@ void
setUp()
{
sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d",
- PGXC_NODE_GTM);
+ GTM_NODE_GTM);
conn = PQconnectGTM(connect_string);
if (conn == NULL)
diff --git a/src/gtm/test2/test_standby.c b/src/gtm/test2/test_standby.c
index 24599a2dda..8a447571ed 100644
--- a/src/gtm/test2/test_standby.c
+++ b/src/gtm/test2/test_standby.c
@@ -38,7 +38,7 @@ test_standby_01()
system("killall -9 gtm_standby");
sprintf(connect_string, "host=localhost port=6666 node_name=one_zero_one remote_type=%d",
- PGXC_NODE_GTM);
+ GTM_NODE_GTM);
conn = PQconnectGTM(connect_string);
diff --git a/src/gtm/test2/test_startup.c b/src/gtm/test2/test_startup.c
index 98b806457f..3bc91ba2f5 100644
--- a/src/gtm/test2/test_startup.c
+++ b/src/gtm/test2/test_startup.c
@@ -38,7 +38,7 @@ test_startup_01()
sleep(1);
sprintf(connect_string, "host=localhost port=6666 node_name=one_zero_one remote_type=%d",
- PGXC_NODE_DEFAULT);
+ GTM_NODE_DEFAULT);
conn = PQconnectGTM(connect_string);
_ASSERT(conn != NULL);
@@ -73,7 +73,7 @@ test_startup_01()
* connecting to the standby
*/
sprintf(connect_string, "host=localhost port=6667 node_name=one_zero_two remote_type=%d",
- PGXC_NODE_DEFAULT);
+ GTM_NODE_DEFAULT);
conn = PQconnectGTM(connect_string);
_ASSERT(conn != NULL);
diff --git a/src/gtm/test2/test_txn.c b/src/gtm/test2/test_txn.c
index 391e116f70..29d7bc9767 100644
--- a/src/gtm/test2/test_txn.c
+++ b/src/gtm/test2/test_txn.c
@@ -183,7 +183,7 @@ int
main(int argc, char *argv[])
{
sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d",
- PGXC_NODE_GTM);
+ GTM_NODE_GTM);
test_txn_01();
test_txn_02();
@@ -195,7 +195,7 @@ main(int argc, char *argv[])
* connect to standby. must be prevented.
*/
sprintf(connect_string, "host=localhost port=6667 node_name=one remote_type=%d",
- PGXC_NODE_GTM);
+ GTM_NODE_GTM);
test_txn_51();
test_txn_52();
diff --git a/src/gtm/test2/test_txn2.c b/src/gtm/test2/test_txn2.c
index 3f4c24e74a..eb5786bfd6 100644
--- a/src/gtm/test2/test_txn2.c
+++ b/src/gtm/test2/test_txn2.c
@@ -17,7 +17,7 @@ void
setUp()
{
sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d",
- PGXC_NODE_GTM);
+ GTM_NODE_GTM);
conn = PQconnectGTM(connect_string);
if (conn == NULL)
diff --git a/src/gtm/test2/test_txn3.c b/src/gtm/test2/test_txn3.c
index fbec77e29c..af22642760 100644
--- a/src/gtm/test2/test_txn3.c
+++ b/src/gtm/test2/test_txn3.c
@@ -17,7 +17,7 @@ void
setUp()
{
sprintf(connect_string, "host=localhost port=6666 node_name=one remote_type=%d",
- PGXC_NODE_GTM);
+ GTM_NODE_GTM);
conn = PQconnectGTM(connect_string);
if (conn == NULL)
diff --git a/src/include/catalog/pgxc_node.h b/src/include/catalog/pgxc_node.h
index 4b65542089..de0d55e2e0 100644
--- a/src/include/catalog/pgxc_node.h
+++ b/src/include/catalog/pgxc_node.h
@@ -34,12 +34,6 @@ CATALOG(pgxc_node,9015) BKI_SHARED_RELATION
char node_type;
/*
- * If this node is a slave, identify its master.
- * For master nodes this is InvalidOid
- */
- Oid node_related;
-
- /*
* Port number of the node to connect to
*/
int4 node_port;
@@ -62,21 +56,18 @@ CATALOG(pgxc_node,9015) BKI_SHARED_RELATION
typedef FormData_pgxc_node *Form_pgxc_node;
-#define Natts_pgxc_node 7
+#define Natts_pgxc_node 6
#define Anum_pgxc_node_name 1
#define Anum_pgxc_node_type 2
-#define Anum_pgxc_node_related 3
-#define Anum_pgxc_node_port 4
-#define Anum_pgxc_node_host 5
-#define Anum_pgxc_node_is_primary 6
-#define Anum_pgxc_node_is_preferred 7
+#define Anum_pgxc_node_port 3
+#define Anum_pgxc_node_host 4
+#define Anum_pgxc_node_is_primary 5
+#define Anum_pgxc_node_is_preferred 6
/* Possible types of nodes */
-#define PGXC_NODE_COORD_MASTER 'C'
-#define PGXC_NODE_DATANODE_MASTER 'D'
-#define PGXC_NODE_COORD_SLAVE 'S'
-#define PGXC_NODE_DATANODE_SLAVE 'X'
+#define PGXC_NODE_COORDINATOR 'C'
+#define PGXC_NODE_DATANODE 'D'
#define PGXC_NODE_NONE 'N'
#endif /* PGXC_NODE_H */
diff --git a/src/include/gtm/gtm_c.h b/src/include/gtm/gtm_c.h
index 8a2c59960d..5e108db50b 100644
--- a/src/include/gtm/gtm_c.h
+++ b/src/include/gtm/gtm_c.h
@@ -48,12 +48,12 @@ typedef uint32 GTM_PGXCNodePort;
/* Possible type of nodes for registration */
typedef enum GTM_PGXCNodeType
{
- PGXC_NODE_GTM_PROXY,
- PGXC_NODE_GTM_PROXY_POSTMASTER, /* Used by Proxy to communicate with GTM and not use Proxy headers */
- PGXC_NODE_COORDINATOR,
- PGXC_NODE_DATANODE,
- PGXC_NODE_GTM,
- PGXC_NODE_DEFAULT /* In case nothing is associated to connection */
+ GTM_NODE_GTM_PROXY,
+ GTM_NODE_GTM_PROXY_POSTMASTER, /* Used by Proxy to communicate with GTM and not use Proxy headers */
+ GTM_NODE_COORDINATOR,
+ GTM_NODE_DATANODE,
+ GTM_NODE_GTM,
+ GTM_NODE_DEFAULT /* In case nothing is associated to connection */
} GTM_PGXCNodeType;
/*
diff --git a/src/include/parser/kwlist.h b/src/include/parser/kwlist.h
index 20e6cd304f..71136c4c49 100644
--- a/src/include/parser/kwlist.h
+++ b/src/include/parser/kwlist.h
@@ -190,9 +190,6 @@ PG_KEYWORD("hash", HASH, UNRESERVED_KEYWORD)
PG_KEYWORD("having", HAVING, RESERVED_KEYWORD)
PG_KEYWORD("header", HEADER_P, UNRESERVED_KEYWORD)
PG_KEYWORD("hold", HOLD, UNRESERVED_KEYWORD)
-#ifdef PGXC
-PG_KEYWORD("hostip", HOSTIP, UNRESERVED_KEYWORD)
-#endif
PG_KEYWORD("hour", HOUR_P, UNRESERVED_KEYWORD)
PG_KEYWORD("identity", IDENTITY_P, UNRESERVED_KEYWORD)
PG_KEYWORD("if", IF_P, UNRESERVED_KEYWORD)
@@ -246,9 +243,6 @@ PG_KEYWORD("localtimestamp", LOCALTIMESTAMP, RESERVED_KEYWORD)
PG_KEYWORD("location", LOCATION, UNRESERVED_KEYWORD)
PG_KEYWORD("lock", LOCK_P, UNRESERVED_KEYWORD)
PG_KEYWORD("mapping", MAPPING, UNRESERVED_KEYWORD)
-#ifdef PGXC
-PG_KEYWORD("master", MASTER, UNRESERVED_KEYWORD)
-#endif
PG_KEYWORD("match", MATCH, UNRESERVED_KEYWORD)
PG_KEYWORD("maxvalue", MAXVALUE, UNRESERVED_KEYWORD)
PG_KEYWORD("minute", MINUTE_P, UNRESERVED_KEYWORD)
@@ -268,7 +262,6 @@ PG_KEYWORD("next", NEXT, UNRESERVED_KEYWORD)
PG_KEYWORD("no", NO, UNRESERVED_KEYWORD)
#ifdef PGXC
PG_KEYWORD("node", NODE, UNRESERVED_KEYWORD)
-PG_KEYWORD("nodeport", NODEPORT, UNRESERVED_KEYWORD)
#endif
PG_KEYWORD("none", NONE, COL_NAME_KEYWORD)
PG_KEYWORD("not", NOT, RESERVED_KEYWORD)
@@ -330,9 +323,6 @@ PG_KEYWORD("recursive", RECURSIVE, UNRESERVED_KEYWORD)
PG_KEYWORD("ref", REF, UNRESERVED_KEYWORD)
PG_KEYWORD("references", REFERENCES, RESERVED_KEYWORD)
PG_KEYWORD("reindex", REINDEX, UNRESERVED_KEYWORD)
-#ifdef PGXC
-PG_KEYWORD("related", RELATED, UNRESERVED_KEYWORD)
-#endif
PG_KEYWORD("relative", RELATIVE_P, UNRESERVED_KEYWORD)
PG_KEYWORD("release", RELEASE, UNRESERVED_KEYWORD)
PG_KEYWORD("rename", RENAME, UNRESERVED_KEYWORD)
@@ -379,9 +369,6 @@ PG_KEYWORD("share", SHARE, UNRESERVED_KEYWORD)
PG_KEYWORD("show", SHOW, UNRESERVED_KEYWORD)
PG_KEYWORD("similar", SIMILAR, TYPE_FUNC_NAME_KEYWORD)
PG_KEYWORD("simple", SIMPLE, UNRESERVED_KEYWORD)
-#ifdef PGXC
-PG_KEYWORD("slave", SLAVE, UNRESERVED_KEYWORD)
-#endif
PG_KEYWORD("smallint", SMALLINT, COL_NAME_KEYWORD)
PG_KEYWORD("some", SOME, RESERVED_KEYWORD)
PG_KEYWORD("stable", STABLE, UNRESERVED_KEYWORD)
diff --git a/src/include/pgxc/nodemgr.h b/src/include/pgxc/nodemgr.h
index 18e3054456..d82e1a0d5e 100644
--- a/src/include/pgxc/nodemgr.h
+++ b/src/include/pgxc/nodemgr.h
@@ -26,9 +26,7 @@ extern int NumCoordSlaves;
extern int NumDataNodeSlaves;
extern void PgxcNodeListAndCount(Oid **coOids, Oid **dnOids,
- Oid **coslaveOids, Oid **dnslaveOids,
- int *num_coords, int *num_dns,
- int *num_co_slaves, int *num_dn_slaves);
+ int *num_coords, int *num_dns);
extern void PgxcNodeAlter(AlterNodeStmt *stmt);
extern void PgxcNodeCreate(CreateNodeStmt *stmt);
extern void PgxcNodeRemove(DropNodeStmt *stmt);
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index 6757af0f28..3f70c4cd9b 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -139,7 +139,6 @@ extern Oid get_pgxc_nodeoid(const char *nodename);
extern char get_pgxc_nodetype(Oid nodeid);
extern int get_pgxc_nodeport(Oid nodeid);
extern char *get_pgxc_nodehost(Oid nodeid);
-extern Oid get_pgxc_noderelated(Oid nodeid);
extern bool is_pgxc_nodepreferred(Oid nodeid);
extern bool is_pgxc_nodeprimary(Oid nodeid);
extern Oid get_pgxc_groupoid(const char *groupname);
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 90ebeae2d2..636e955391 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -933,32 +933,32 @@ setup_connection_information(void)
{
header(_("setting connection information"));
/* Datanodes on Coordinator 1*/
- psql_command_node("postgres", PGXC_COORD_1, "CREATE NODE %s WITH (HOSTIP = 'localhost',"
- "NODE MASTER, NODEPORT = %d);",
+ psql_command_node("postgres", PGXC_COORD_1, "CREATE NODE %s WITH (HOST = 'localhost',"
+ " type = 'datanode', PORT = %d);",
(char *)get_node_name(PGXC_DATANODE_1),
get_port_number(PGXC_DATANODE_1));
- psql_command_node("postgres", PGXC_COORD_1, "CREATE NODE %s WITH (HOSTIP = 'localhost',"
- "NODE MASTER, NODEPORT = %d);",
+ psql_command_node("postgres", PGXC_COORD_1, "CREATE NODE %s WITH (HOST = 'localhost',"
+ " type = 'datanode', PORT = %d);",
(char *)get_node_name(PGXC_DATANODE_2),
get_port_number(PGXC_DATANODE_2));
/* Datanodes on Coordinator 2 */
- psql_command_node("postgres", PGXC_COORD_2, "CREATE NODE %s WITH (HOSTIP = 'localhost',"
- "NODE MASTER, NODEPORT = %d);",
+ psql_command_node("postgres", PGXC_COORD_2, "CREATE NODE %s WITH (HOST = 'localhost',"
+ " type = 'datanode', PORT = %d);",
(char *)get_node_name(PGXC_DATANODE_1),
get_port_number(PGXC_DATANODE_1));
- psql_command_node("postgres", PGXC_COORD_2, "CREATE NODE %s WITH (HOSTIP = 'localhost',"
- "NODE MASTER, NODEPORT = %d);",
+ psql_command_node("postgres", PGXC_COORD_2, "CREATE NODE %s WITH (HOST = 'localhost',"
+ " type = 'datanode', PORT = %d);",
(char *)get_node_name(PGXC_DATANODE_2),
get_port_number(PGXC_DATANODE_2));
/* Remote Coordinator on Coordinator 1 */
- psql_command_node("postgres", PGXC_COORD_1, "CREATE NODE %s WITH (HOSTIP = 'localhost',"
- " COORDINATOR MASTER, NODEPORT = %d);",
+ psql_command_node("postgres", PGXC_COORD_1, "CREATE NODE %s WITH (HOST = 'localhost',"
+ " type = 'coordinator', PORT = %d);",
(char *)get_node_name(PGXC_COORD_2),
get_port_number(PGXC_COORD_2));
/* Remote Coordinator on Coordinator 2 */
- psql_command_node("postgres", PGXC_COORD_2, "CREATE NODE %s WITH (HOSTIP = 'localhost',"
- " COORDINATOR MASTER, NODEPORT = %d);",
+ psql_command_node("postgres", PGXC_COORD_2, "CREATE NODE %s WITH (HOST = 'localhost',"
+ " type = 'coordinator', PORT = %d);",
(char *)get_node_name(PGXC_COORD_1),
get_port_number(PGXC_COORD_1));