summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPavan Deolasee2010-05-13 01:55:34 +0000
committerPavan Deolasee2011-05-19 16:38:46 +0000
commit3741e829e5b045120d9c6077c32a27375cfafa02 (patch)
treed0170fcc6f2f554743b9f05e3eeead1d6c1d6fd4 /src
parent458f2058e628fe721b3d5fd42f7038a1403d97cc (diff)
Fix some stylistic issues with the code. Trying to make it more
consistent in general and with Postgres code in particular
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/gtm.c16
-rw-r--r--src/backend/catalog/pgxc_class.c14
-rw-r--r--src/backend/pgxc/locator/locator.c17
-rw-r--r--src/backend/pgxc/plan/planner.c49
-rw-r--r--src/backend/pgxc/pool/combiner.c2
-rw-r--r--src/backend/pgxc/pool/datanode.c119
-rw-r--r--src/backend/pgxc/pool/poolcomm.c26
-rw-r--r--src/backend/pgxc/pool/poolmgr.c73
-rw-r--r--src/backend/postmaster/postmaster.c2
-rw-r--r--src/include/pgxc/locator.h16
-rw-r--r--src/include/pgxc/planner.h15
-rw-r--r--src/include/pgxc/poolcomm.h20
-rw-r--r--src/include/pgxc/poolmgr.h18
13 files changed, 178 insertions, 209 deletions
diff --git a/src/backend/access/transam/gtm.c b/src/backend/access/transam/gtm.c
index 2ecc96a4ac..c3cb72b129 100644
--- a/src/backend/access/transam/gtm.c
+++ b/src/backend/access/transam/gtm.c
@@ -30,7 +30,8 @@ static GTM_Conn *conn;
if (GTMPQstatus(conn) != CONNECTION_OK) InitGTM()
-bool IsGTMConnected()
+bool
+IsGTMConnected()
{
return conn != NULL;
}
@@ -59,14 +60,14 @@ InitGTM()
}
void
-CloseGTM()
+CloseGTM(void)
{
GTMPQfinish(conn);
conn = NULL;
}
GlobalTransactionId
-BeginTranGTM()
+BeginTranGTM(void)
{
GlobalTransactionId xid = InvalidGlobalTransactionId;
@@ -89,7 +90,7 @@ BeginTranGTM()
}
GlobalTransactionId
-BeginTranAutovacuumGTM()
+BeginTranAutovacuumGTM(void)
{
GlobalTransactionId xid = InvalidGlobalTransactionId;
@@ -176,8 +177,9 @@ GetSnapshotGTM(GlobalTransactionId gxid, bool canbe_grouped)
*
*
*/
-int CreateSequenceGTM(char *seqname, GTM_Sequence increment, GTM_Sequence minval,
- GTM_Sequence maxval, GTM_Sequence startval, bool cycle)
+int
+CreateSequenceGTM(char *seqname, GTM_Sequence increment, GTM_Sequence minval,
+ GTM_Sequence maxval, GTM_Sequence startval, bool cycle)
{
GTM_SequenceKeyData seqkey;
CheckConnection();
@@ -222,5 +224,3 @@ DropSequenceGTM(char *seqname)
return conn ? close_sequence(conn, &seqkey) : -1;
}
-
-
diff --git a/src/backend/catalog/pgxc_class.c b/src/backend/catalog/pgxc_class.c
index a77f242357..bf54ca455e 100644
--- a/src/backend/catalog/pgxc_class.c
+++ b/src/backend/catalog/pgxc_class.c
@@ -21,11 +21,12 @@
#include "utils/syscache.h"
#include "pgxc/locator.h"
-void PgxcClassCreate(Oid pcrelid,
- char pclocatortype,
- int pcattnum,
- int pchashalgorithm,
- int pchashbuckets)
+void
+PgxcClassCreate(Oid pcrelid,
+ char pclocatortype,
+ int pcattnum,
+ int pchashalgorithm,
+ int pchashbuckets)
{
Relation pgxcclassrel;
HeapTuple htup;
@@ -78,7 +79,8 @@ void PgxcClassCreate(Oid pcrelid,
* arg1: Oid of the relation.
*
*/
-void RemovePgxcClass(Oid pcrelid)
+void
+RemovePgxcClass(Oid pcrelid)
{
Relation relation;
HeapTuple tup;
diff --git a/src/backend/pgxc/locator/locator.c b/src/backend/pgxc/locator/locator.c
index 2ab16b5c25..63c6359d5a 100644
--- a/src/backend/pgxc/locator/locator.c
+++ b/src/backend/pgxc/locator/locator.c
@@ -42,7 +42,8 @@
#include "catalog/namespace.h"
-/* PGXCTODO For prototype, relations use the same hash mapping table.
+/*
+ * PGXCTODO For prototype, relations use the same hash mapping table.
* Long term, make it a pointer in RelationLocInfo, and have
* similarly handled tables point to the same mapping table,
* to check faster for equivalency
@@ -151,9 +152,7 @@ static int
get_node_from_hash(int hash)
{
if (hash > HASH_SIZE || hash < 0)
- {
ereport(ERROR, (errmsg("Hash value out of range\n")));
- }
return mappingTable[hash];
}
@@ -203,7 +202,7 @@ GetRelationHashColumn(RelationLocInfo * rel_loc_info)
*
*/
bool
-IsHashColumn(RelationLocInfo * rel_loc_info, char *part_col_name)
+IsHashColumn(RelationLocInfo *rel_loc_info, char *part_col_name)
{
bool ret_value = false;
@@ -231,7 +230,7 @@ IsHashColumnForRelId(Oid relid, char *part_col_name)
}
-/**
+/*
* Update the round robin node for the relation
*
* PGXCTODO - may not want to bother with locking here, we could track
@@ -281,7 +280,7 @@ GetRoundRobinNode(Oid relid)
* The returned List is a copy, so it should be freed when finished.
*/
Exec_Nodes *
-GetRelationNodes(RelationLocInfo * rel_loc_info, long *partValue, int isRead)
+GetRelationNodes(RelationLocInfo *rel_loc_info, long *partValue, int isRead)
{
ListCell *prefItem;
ListCell *stepItem;
@@ -465,7 +464,7 @@ GetAllNodes(void)
}
-/**
+/*
* Build locator information associated with the specified relation.
*
*/
@@ -580,7 +579,7 @@ GetRelationLocInfo(Oid relid)
return ret_loc_info;
}
-/**
+/*
* Copy the RelationLocInfo struct
*/
RelationLocInfo *
@@ -608,7 +607,7 @@ CopyRelationLocInfo(RelationLocInfo * src_info)
}
-/**
+/*
* Free RelationLocInfo struct
*/
void
diff --git a/src/backend/pgxc/plan/planner.c b/src/backend/pgxc/plan/planner.c
index 078d1e42d4..57bb539d8d 100644
--- a/src/backend/pgxc/plan/planner.c
+++ b/src/backend/pgxc/plan/planner.c
@@ -36,7 +36,7 @@ typedef struct
Oid attrnum;
char *col_name;
long constant; /* assume long PGXCTODO - should be Datum */
-} Literal_Comparison;
+} Literal_Comparison;
/*
* This struct helps us detect special conditions to determine what nodes
@@ -55,7 +55,7 @@ typedef struct
char *base_rel_name;
RelationLocInfo *base_rel_loc_info;
-} Special_Conditions;
+} Special_Conditions;
/* If two relations are joined based on special location information */
typedef enum PGXCJoinType
@@ -63,7 +63,7 @@ typedef enum PGXCJoinType
JOIN_REPLICATED,
JOIN_COLOCATED_PARTITIONED,
JOIN_OTHER
-} PGXCJoinType;
+} PGXCJoinType;
/* used to track which tables are joined */
typedef struct
@@ -74,7 +74,7 @@ typedef struct
char *aliasname2;
PGXCJoinType join_type;
-} PGXC_Join;
+} PGXC_Join;
/* A list of List*'s, one for each relation. */
List *join_list = NULL;
@@ -178,7 +178,7 @@ find_or_create_pgxc_join(int relid1, char *aliasname1, int relid2, char *aliasna
* new_special_conditions - Allocate Special_Conditions struct and initialize
*/
static Special_Conditions *
-new_special_conditions()
+new_special_conditions(void)
{
Special_Conditions *special_conditions =
(Special_Conditions *) palloc0(sizeof(Special_Conditions));
@@ -190,7 +190,7 @@ new_special_conditions()
* free Special_Conditions struct
*/
static void
-free_special_relations(Special_Conditions * special_conditions)
+free_special_relations(Special_Conditions *special_conditions)
{
if (special_conditions == NULL)
return;
@@ -209,7 +209,7 @@ free_special_relations(Special_Conditions * special_conditions)
* frees join_list
*/
static void
-free_join_list()
+free_join_list(void)
{
if (join_list == NULL)
return;
@@ -260,7 +260,7 @@ get_numeric_constant(Expr *expr)
* to determine what the base table and column really is.
*/
static Var *
-get_base_var(Var * var, List *rtables)
+get_base_var(Var *var, List *rtables)
{
RangeTblEntry *rte;
@@ -287,7 +287,7 @@ get_base_var(Var * var, List *rtables)
* get_plan_nodes_insert - determine nodes on which to execute insert.
*/
static Exec_Nodes *
-get_plan_nodes_insert(Query * query)
+get_plan_nodes_insert(Query *query)
{
RangeTblEntry *rte;
RelationLocInfo *rel_loc_info;
@@ -297,9 +297,6 @@ get_plan_nodes_insert(Query * query)
long part_value;
long *part_value_ptr = NULL;
-
-
-
/* Looks complex (correlated?) - best to skip */
if (query->jointree != NULL && query->jointree->fromlist != NULL)
return NULL;
@@ -322,8 +319,8 @@ get_plan_nodes_insert(Query * query)
(errcode(ERRCODE_STATEMENT_TOO_COMPLEX),
(errmsg("Could not find relation for oid = %d", rte->relid))));
- if (rel_loc_info->locatorType == LOCATOR_TYPE_HASH
- && rel_loc_info->partAttrName != NULL)
+ if (rel_loc_info->locatorType == LOCATOR_TYPE_HASH &&
+ rel_loc_info->partAttrName != NULL)
{
/* It is a partitioned table, get value by looking in targetList */
foreach(lc, query->targetList)
@@ -347,9 +344,9 @@ get_plan_nodes_insert(Query * query)
constant = (Const *) checkexpr;
- if (constant->consttype == INT4OID
- || constant->consttype == INT2OID
- || constant->consttype == INT8OID)
+ if (constant->consttype == INT4OID ||
+ constant->consttype == INT2OID ||
+ constant->consttype == INT8OID)
{
part_value = (long) constant->constvalue;
part_value_ptr = &part_value;
@@ -389,7 +386,7 @@ get_plan_nodes_insert(Query * query)
*
*/
static bool
-examine_conditions(Special_Conditions * conditions, List *rtables, Node *expr_node)
+examine_conditions(Special_Conditions *conditions, List *rtables, Node *expr_node)
{
char *rel_name,
*rel_name2;
@@ -646,7 +643,7 @@ examine_conditions(Special_Conditions * conditions, List *rtables, Node *expr_no
* to help us decide which nodes to execute on.
*/
static bool
-examine_conditions_fromlist(Special_Conditions * conditions, List *rtables,
+examine_conditions_fromlist(Special_Conditions *conditions, List *rtables,
Node *treenode)
{
@@ -676,9 +673,7 @@ examine_conditions_fromlist(Special_Conditions * conditions, List *rtables,
return true;
}
else if (IsA(treenode, RangeTblRef))
- {
return true;
- }
else if (IsA(treenode, BoolExpr) ||IsA(treenode, OpExpr))
{
/* check base condition, if possible */
@@ -725,7 +720,7 @@ contains_only_pg_catalog (List *rtable)
* returns NULL if it appears to be a mutli-step query.
*/
static Exec_Nodes *
-get_plan_nodes(Query_Plan * query_plan, Query * query, bool isRead)
+get_plan_nodes(Query_Plan *query_plan, Query *query, bool isRead)
{
RangeTblEntry *rte;
ListCell *lc,
@@ -988,7 +983,7 @@ get_plan_nodes(Query_Plan * query_plan, Query * query, bool isRead)
* return NULL if it is not safe to be done in a single step.
*/
static Exec_Nodes *
-get_plan_nodes_command(Query_Plan * query_plan, Query * query)
+get_plan_nodes_command(Query_Plan *query_plan, Query *query)
{
switch (query->commandType)
@@ -1047,7 +1042,7 @@ get_plan_combine_type(Query *query, char baselocatortype)
* For now we only allow MAX in the first column, and return a list of one.
*/
static List *
-get_simple_aggregates(Query * query, Exec_Nodes *exec_nodes)
+get_simple_aggregates(Query *query, Exec_Nodes *exec_nodes)
{
List *simple_agg_list = NULL;
@@ -1383,7 +1378,7 @@ GetQueryPlan(Node *parsetree, const char *sql_statement, List *querytree_list)
* Free Query_Step struct
*/
static void
-free_query_step(Query_Step * query_step)
+free_query_step(Query_Step *query_step)
{
if (query_step == NULL)
return;
@@ -1405,7 +1400,7 @@ free_query_step(Query_Step * query_step)
* Free Query_Plan struct
*/
void
-FreeQueryPlan(Query_Plan * query_plan)
+FreeQueryPlan(Query_Plan *query_plan)
{
ListCell *item;
@@ -1413,9 +1408,7 @@ FreeQueryPlan(Query_Plan * query_plan)
return;
foreach(item, query_plan->query_step_list)
- {
free_query_step((Query_Step *) lfirst_int(item));
- }
pfree(query_plan->query_step_list);
pfree(query_plan);
diff --git a/src/backend/pgxc/pool/combiner.c b/src/backend/pgxc/pool/combiner.c
index f7c7f34552..ae6292ad41 100644
--- a/src/backend/pgxc/pool/combiner.c
+++ b/src/backend/pgxc/pool/combiner.c
@@ -89,7 +89,7 @@ parse_row_count(const char *message, size_t len, int *rowcount)
* returns a boolean indicating whether or not it was a short message
*/
static unsigned long
-parse_aggregate_value(SimpleAgg * simple_agg, char *msg_body, size_t len)
+parse_aggregate_value(SimpleAgg *simple_agg, char *msg_body, size_t len)
{
char *valstr;
diff --git a/src/backend/pgxc/pool/datanode.c b/src/backend/pgxc/pool/datanode.c
index 91f253371b..6a1aba8190 100644
--- a/src/backend/pgxc/pool/datanode.c
+++ b/src/backend/pgxc/pool/datanode.c
@@ -53,30 +53,30 @@ static DataNodeHandle **write_node_list = NULL;
static int write_node_count = 0;
static DataNodeHandle **get_handles(List *nodelist);
-static int get_transaction_nodes(DataNodeHandle ** connections);
+static int get_transaction_nodes(DataNodeHandle **connections);
static void release_handles(void);
-static void data_node_init(DataNodeHandle * handle, int sock);
-static void data_node_free(DataNodeHandle * handle);
+static void data_node_init(DataNodeHandle *handle, int sock);
+static void data_node_free(DataNodeHandle *handle);
-static int data_node_begin(int conn_count, DataNodeHandle ** connections, CommandDest dest, GlobalTransactionId gxid);
-static int data_node_commit(int conn_count, DataNodeHandle ** connections, CommandDest dest);
-static int data_node_rollback(int conn_count, DataNodeHandle ** connections, CommandDest dest);
+static int data_node_begin(int conn_count, DataNodeHandle **connections, CommandDest dest, GlobalTransactionId gxid);
+static int data_node_commit(int conn_count, DataNodeHandle **connections, CommandDest dest);
+static int data_node_rollback(int conn_count, DataNodeHandle **connections, CommandDest dest);
-static int ensure_in_buffer_capacity(size_t bytes_needed, DataNodeHandle * handle);
-static int ensure_out_buffer_capacity(size_t bytes_needed, DataNodeHandle * handle);
+static int ensure_in_buffer_capacity(size_t bytes_needed, DataNodeHandle *handle);
+static int ensure_out_buffer_capacity(size_t bytes_needed, DataNodeHandle *handle);
-static int data_node_send_query(DataNodeHandle * handle, const char *query);
-static int data_node_send_gxid(DataNodeHandle * handle, GlobalTransactionId gxid);
-static int data_node_send_snapshot(DataNodeHandle * handle, Snapshot snapshot);
+static int data_node_send_query(DataNodeHandle *handle, const char *query);
+static int data_node_send_gxid(DataNodeHandle *handle, GlobalTransactionId gxid);
+static int data_node_send_snapshot(DataNodeHandle *handle, Snapshot snapshot);
-static void add_error_message(DataNodeHandle * handle, const char *message);
+static void add_error_message(DataNodeHandle *handle, const char *message);
-static int data_node_read_data(DataNodeHandle * conn);
-static int handle_response(DataNodeHandle * conn, ResponseCombiner combiner);
+static int data_node_read_data(DataNodeHandle *conn);
+static int handle_response(DataNodeHandle *conn, ResponseCombiner combiner);
-static int get_int(DataNodeHandle * conn, size_t len, int *out);
-static int get_char(DataNodeHandle * conn, char *out);
+static int get_int(DataNodeHandle *conn, size_t len, int *out);
+static int get_char(DataNodeHandle *conn, char *out);
static void clear_write_node_list();
@@ -111,15 +111,18 @@ stat_transaction(int node_count)
total_transactions++;
if (autocommit)
total_autocommit++;
+
if (!statements_per_transaction)
{
statements_per_transaction = (int *) malloc((MAX_STATEMENTS_PER_TRAN + 1) * sizeof(int));
memset(statements_per_transaction, 0, (MAX_STATEMENTS_PER_TRAN + 1) * sizeof(int));
}
+
if (current_tran_statements > MAX_STATEMENTS_PER_TRAN)
statements_per_transaction[MAX_STATEMENTS_PER_TRAN]++;
else
statements_per_transaction[current_tran_statements]++;
+
current_tran_statements = 0;
if (node_count > 0 && node_count <= NumDataNodes)
{
@@ -137,7 +140,7 @@ stat_transaction(int node_count)
* To collect statistics: count a two-phase commit on nodes
*/
static void
-stat_2pc()
+stat_2pc(void)
{
if (autocommit)
autocommit_2pc++;
@@ -150,7 +153,7 @@ stat_2pc()
* Output collected statistics to the log
*/
static void
-stat_log()
+stat_log(void)
{
elog(DEBUG1, "Total Transactions: %d Total Statements: %d", total_transactions, total_statements);
elog(DEBUG1, "Autocommit: %d 2PC for Autocommit: %d 2PC for non-Autocommit: %d",
@@ -182,7 +185,7 @@ stat_log()
* Allocate and initialize memory to store DataNode handles.
*/
void
-InitMultinodeExecutor()
+InitMultinodeExecutor(void)
{
int i;
@@ -277,7 +280,7 @@ DataNodeConnect(char *connstr)
* Close specified connection
*/
void
-DataNodeClose(NODE_CONNECTION * conn)
+DataNodeClose(NODE_CONNECTION *conn)
{
/* Delegate call to the pglib */
PQfinish((PGconn *) conn);
@@ -288,7 +291,7 @@ DataNodeClose(NODE_CONNECTION * conn)
* Checks if connection active
*/
int
-DataNodeConnected(NODE_CONNECTION * conn)
+DataNodeConnected(NODE_CONNECTION *conn)
{
/* Delegate call to the pglib */
PGconn *pgconn = (PGconn *) conn;
@@ -309,7 +312,7 @@ DataNodeConnected(NODE_CONNECTION * conn)
* is destroyed in xact.c.
*/
static void
-data_node_free(DataNodeHandle * handle)
+data_node_free(DataNodeHandle *handle)
{
close(handle->sock);
handle->sock = NO_SOCKET;
@@ -322,7 +325,7 @@ data_node_free(DataNodeHandle * handle)
* Structure stores state info and I/O buffers
*/
static void
-data_node_init(DataNodeHandle * handle, int sock)
+data_node_init(DataNodeHandle *handle, int sock)
{
handle->sock = sock;
handle->transaction_status = 'I';
@@ -339,8 +342,8 @@ data_node_init(DataNodeHandle * handle, int sock)
* Handle responses from the Data node connections
*/
static void
-data_node_receive_responses(const int conn_count, DataNodeHandle ** connections,
- struct timeval * timeout, ResponseCombiner combiner)
+data_node_receive_responses(const int conn_count, DataNodeHandle **connections,
+ struct timeval *timeout, ResponseCombiner combiner)
{
int count = conn_count;
DataNodeHandle *to_receive[conn_count];
@@ -466,7 +469,7 @@ retry:
* Read up incoming messages from the Data ndoe connection
*/
static int
-data_node_read_data(DataNodeHandle * conn)
+data_node_read_data(DataNodeHandle *conn)
{
int someread = 0;
int nread;
@@ -602,7 +605,7 @@ retry:
* Get one character from the connection buffer and advance cursor
*/
static int
-get_char(DataNodeHandle * conn, char *out)
+get_char(DataNodeHandle *conn, char *out)
{
if (conn->inCursor < conn->inEnd)
{
@@ -616,7 +619,7 @@ get_char(DataNodeHandle * conn, char *out)
* Read an integer from the connection buffer and advance cursor
*/
static int
-get_int(DataNodeHandle * conn, size_t len, int *out)
+get_int(DataNodeHandle *conn, size_t len, int *out)
{
unsigned short tmp2;
unsigned int tmp4;
@@ -651,7 +654,7 @@ get_int(DataNodeHandle * conn, size_t len, int *out)
* and closing the connections.
*/
static int
-handle_response(DataNodeHandle * conn, ResponseCombiner combiner)
+handle_response(DataNodeHandle *conn, ResponseCombiner combiner)
{
char msg_type;
int msg_len;
@@ -787,7 +790,7 @@ handle_response(DataNodeHandle * conn, ResponseCombiner combiner)
* Send BEGIN command to the Data nodes and receive responses
*/
static int
-data_node_begin(int conn_count, DataNodeHandle ** connections, CommandDest dest, GlobalTransactionId gxid)
+data_node_begin(int conn_count, DataNodeHandle **connections, CommandDest dest, GlobalTransactionId gxid)
{
int i;
struct timeval *timeout = NULL;
@@ -814,13 +817,12 @@ data_node_begin(int conn_count, DataNodeHandle ** connections, CommandDest dest,
/* Clears the write node list */
static void
-clear_write_node_list()
+clear_write_node_list(void)
{
/* we just malloc once and use counter */
if (write_node_list == NULL)
- {
write_node_list = (DataNodeHandle **) malloc(NumDataNodes * sizeof(DataNodeHandle *));
- }
+
write_node_count = 0;
}
@@ -877,7 +879,7 @@ finish:
* Send COMMIT or PREPARE/COMMIT PREPARED down to the Data nodes and handle responses
*/
static int
-data_node_commit(int conn_count, DataNodeHandle ** connections, CommandDest dest)
+data_node_commit(int conn_count, DataNodeHandle **connections, CommandDest dest)
{
int i;
struct timeval *timeout = NULL;
@@ -1042,7 +1044,7 @@ release_handles(void)
* Send ROLLBACK command down to the Data nodes and handle responses
*/
static int
-data_node_rollback(int conn_count, DataNodeHandle ** connections, CommandDest dest)
+data_node_rollback(int conn_count, DataNodeHandle **connections, CommandDest dest)
{
int i;
struct timeval *timeout = NULL;
@@ -1572,7 +1574,7 @@ data_node_flush(DataNodeHandle *handle)
* Send specified statement down to the Data node
*/
static int
-data_node_send_query(DataNodeHandle * handle, const char *query)
+data_node_send_query(DataNodeHandle *handle, const char *query)
{
int strLen = strlen(query) + 1;
@@ -1603,7 +1605,7 @@ data_node_send_query(DataNodeHandle * handle, const char *query)
* Send the GXID down to the Data node
*/
static int
-data_node_send_gxid(DataNodeHandle * handle, GlobalTransactionId gxid)
+data_node_send_gxid(DataNodeHandle *handle, GlobalTransactionId gxid)
{
int msglen = 8;
int i32;
@@ -1631,7 +1633,7 @@ data_node_send_gxid(DataNodeHandle * handle, GlobalTransactionId gxid)
* Send the snapshot down to the Data node
*/
static int
-data_node_send_snapshot(DataNodeHandle * handle, Snapshot snapshot)
+data_node_send_snapshot(DataNodeHandle *handle, Snapshot snapshot)
{
int msglen;
int nval;
@@ -1685,7 +1687,7 @@ data_node_send_snapshot(DataNodeHandle * handle, Snapshot snapshot)
* at the convenient time
*/
static void
-add_error_message(DataNodeHandle * handle, const char *message)
+add_error_message(DataNodeHandle *handle, const char *message)
{
handle->transaction_status = 'E';
handle->state = DN_CONNECTION_STATE_ERROR_READY;
@@ -1694,9 +1696,7 @@ add_error_message(DataNodeHandle * handle, const char *message)
/* PGXCTODO append */
}
else
- {
handle->error = pstrdup(message);
- }
}
/*
@@ -1755,7 +1755,7 @@ get_handles(List *nodelist)
i = 0;
foreach(node_list_item, nodelist)
{
- int node = node_list_item->data.int_value;
+ int node = lfirst_int(node_list_item);
if (node > NumDataNodes || node <= 0)
elog(ERROR, "Node number: %d passed is not a known node", node);
@@ -1778,7 +1778,7 @@ get_handles(List *nodelist)
}
foreach(node_list_item, allocate)
{
- int node = node_list_item->data.int_value;
+ int node = lfirst_int(node_list_item);
int fdsock = fds[j++];
data_node_init(&handles[node - 1], fdsock);
@@ -1894,9 +1894,7 @@ DataNodeCopyBegin(const char *query, List *nodelist, Snapshot snapshot, bool is_
/* We normally clear for transactions, but if autocommit, clear here, too */
if (autocommit)
- {
clear_write_node_list();
- }
/* Check status of connections */
/* We want to track new "write" nodes, and new nodes in the current transaction
@@ -1936,6 +1934,7 @@ DataNodeCopyBegin(const char *query, List *nodelist, Snapshot snapshot, bool is_
pfree(copy_connections);
return NULL;
}
+
if (new_count > 0 && need_tran)
{
/* Start transaction on connections where it is not started */
@@ -1989,8 +1988,8 @@ DataNodeCopyBegin(const char *query, List *nodelist, Snapshot snapshot, bool is_
{
if (need_tran)
DataNodeCopyFinish(connections, 0, COMBINE_TYPE_NONE, DestNone);
- else
- if (!PersistentConnections) release_handles();
+ else if (!PersistentConnections)
+ release_handles();
}
pfree(connections);
@@ -2015,9 +2014,7 @@ DataNodeCopyIn(char *data_row, int len, Exec_Nodes *exec_nodes, DataNodeHandle**
int nLen = htonl(msgLen);
if (exec_nodes->primarynodelist)
- {
primary_handle = copy_connections[lfirst_int(list_head(exec_nodes->primarynodelist)) - 1];
- }
if (primary_handle)
{
@@ -2159,7 +2156,7 @@ DataNodeCopyIn(char *data_row, int len, Exec_Nodes *exec_nodes, DataNodeHandle**
}
int
-DataNodeCopyOut(Exec_Nodes *exec_nodes, DataNodeHandle** copy_connections, CommandDest dest, FILE* copy_file)
+DataNodeCopyOut(Exec_Nodes *exec_nodes, DataNodeHandle **copy_connections, CommandDest dest, FILE *copy_file)
{
ResponseCombiner combiner;
int conn_count = list_length(exec_nodes->nodelist) == 0 ? NumDataNodes : list_length(exec_nodes->nodelist);
@@ -2214,7 +2211,7 @@ DataNodeCopyOut(Exec_Nodes *exec_nodes, DataNodeHandle** copy_connections, Comma
* Finish copy process on all connections
*/
uint64
-DataNodeCopyFinish(DataNodeHandle** copy_connections, int primary_data_node,
+DataNodeCopyFinish(DataNodeHandle **copy_connections, int primary_data_node,
CombineType combine_type, CommandDest dest)
{
int i;
@@ -2258,14 +2255,10 @@ DataNodeCopyFinish(DataNodeHandle** copy_connections, int primary_data_node,
/* We need response right away, so send immediately */
if (data_node_flush(primary_handle) < 0)
- {
res = EOF;
- }
}
else
- {
res = EOF;
- }
combiner = CreateResponseCombiner(conn_count + 1, combine_type, dest);
data_node_receive_responses(1, &primary_handle, timeout, combiner);
@@ -2279,11 +2272,9 @@ DataNodeCopyFinish(DataNodeHandle** copy_connections, int primary_data_node,
{
/* msgType + msgLen */
if (ensure_out_buffer_capacity(handle->outEnd + 1 + 4, handle) != 0)
- {
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
- }
handle->outBuffer[handle->outEnd++] = 'c';
memcpy(handle->outBuffer + handle->outEnd, &nLen, 4);
@@ -2291,29 +2282,27 @@ DataNodeCopyFinish(DataNodeHandle** copy_connections, int primary_data_node,
/* We need response right away, so send immediately */
if (data_node_flush(handle) < 0)
- {
res = EOF;
- }
}
else
- {
res = EOF;
- }
}
need_tran = !autocommit || primary_handle || conn_count > 1;
if (!combiner)
combiner = CreateResponseCombiner(conn_count, combine_type, dest);
+
data_node_receive_responses(conn_count, connections, timeout, combiner);
+
if (!ValidateAndCloseCombiner(combiner) || res)
{
if (autocommit)
{
if (need_tran)
DataNodeRollback(DestNone);
- else
- if (!PersistentConnections) release_handles();
+ else if (!PersistentConnections)
+ release_handles();
}
return 0;
@@ -2323,8 +2312,8 @@ DataNodeCopyFinish(DataNodeHandle** copy_connections, int primary_data_node,
{
if (need_tran)
DataNodeCommit(DestNone);
- else
- if (!PersistentConnections) release_handles();
+ else if (!PersistentConnections)
+ release_handles();
}
// Verify status?
diff --git a/src/backend/pgxc/pool/poolcomm.c b/src/backend/pgxc/pool/poolcomm.c
index 03b785f954..4625261743 100644
--- a/src/backend/pgxc/pool/poolcomm.c
+++ b/src/backend/pgxc/pool/poolcomm.c
@@ -26,8 +26,8 @@
#include "utils/elog.h"
#include "miscadmin.h"
-static int pool_recvbuf(PoolPort * port);
-static int pool_discardbytes(PoolPort * port, size_t len);
+static int pool_recvbuf(PoolPort *port);
+static int pool_discardbytes(PoolPort *port, size_t len);
#ifdef HAVE_UNIX_SOCKETS
@@ -141,7 +141,7 @@ pool_connect(unsigned short port, const char *unixSocketName)
* Get one byte from the buffer, read data from the connection if buffer is empty
*/
int
-pool_getbyte(PoolPort * port)
+pool_getbyte(PoolPort *port)
{
while (port->RecvPointer >= port->RecvLength)
{
@@ -156,7 +156,7 @@ pool_getbyte(PoolPort * port)
* Get one byte from the buffer if it is not empty
*/
int
-pool_pollbyte(PoolPort * port)
+pool_pollbyte(PoolPort *port)
{
if (port->RecvPointer >= port->RecvLength)
{
@@ -170,7 +170,7 @@ pool_pollbyte(PoolPort * port)
* Read pooler protocol message from the buffer.
*/
int
-pool_getmessage(PoolPort * port, StringInfo s, int maxlen)
+pool_getmessage(PoolPort *port, StringInfo s, int maxlen)
{
int32 len;
@@ -242,7 +242,7 @@ pool_getmessage(PoolPort * port, StringInfo s, int maxlen)
* --------------------------------
*/
int
-pool_getbytes(PoolPort * port, char *s, size_t len)
+pool_getbytes(PoolPort *port, char *s, size_t len)
{
size_t amount;
@@ -273,7 +273,7 @@ pool_getbytes(PoolPort * port, char *s, size_t len)
* --------------------------------
*/
static int
-pool_discardbytes(PoolPort * port, size_t len)
+pool_discardbytes(PoolPort *port, size_t len)
{
size_t amount;
@@ -302,7 +302,7 @@ pool_discardbytes(PoolPort * port, size_t len)
* --------------------------------
*/
static int
-pool_recvbuf(PoolPort * port)
+pool_recvbuf(PoolPort *port)
{
if (port->RecvPointer > 0)
{
@@ -358,7 +358,7 @@ pool_recvbuf(PoolPort * port)
* Put a known number of bytes into the connection buffer
*/
int
-pool_putbytes(PoolPort * port, const char *s, size_t len)
+pool_putbytes(PoolPort *port, const char *s, size_t len)
{
size_t amount;
@@ -387,7 +387,7 @@ pool_putbytes(PoolPort * port, const char *s, size_t len)
* --------------------------------
*/
int
-pool_flush(PoolPort * port)
+pool_flush(PoolPort *port)
{
static int last_reported_send_errno = 0;
@@ -434,7 +434,7 @@ pool_flush(PoolPort * port)
* Put the pooler protocol message into the connection buffer
*/
int
-pool_putmessage(PoolPort * port, char msgtype, const char *s, size_t len)
+pool_putmessage(PoolPort *port, char msgtype, const char *s, size_t len)
{
uint n32;
@@ -460,7 +460,7 @@ pool_putmessage(PoolPort * port, char msgtype, const char *s, size_t len)
* connection
*/
int
-pool_sendfds(PoolPort * port, int *fds, int count)
+pool_sendfds(PoolPort *port, int *fds, int count)
{
struct iovec iov[1];
struct msghdr msg;
@@ -517,7 +517,7 @@ pool_sendfds(PoolPort * port, int *fds, int count)
* Read a message from the specified connection carrying file descriptors
*/
int
-pool_recvfds(PoolPort * port, int *fds, int count)
+pool_recvfds(PoolPort *port, int *fds, int count)
{
int r;
uint n32;
diff --git a/src/backend/pgxc/pool/poolmgr.c b/src/backend/pgxc/pool/poolmgr.c
index 02e5ddd5cd..e386b2bfa7 100644
--- a/src/backend/pgxc/pool/poolmgr.c
+++ b/src/backend/pgxc/pool/poolmgr.c
@@ -82,22 +82,22 @@ static PoolHandle *Handle = NULL;
static int server_fd = -1;
-static void agent_init(PoolAgent * agent, const char *database, List *nodes);
-static void agent_destroy(PoolAgent * agent);
+static void agent_init(PoolAgent *agent, const char *database, List *nodes);
+static void agent_destroy(PoolAgent *agent);
static void agent_create(void);
-static void agent_handle_input(PoolAgent * agent, StringInfo s);
+static void agent_handle_input(PoolAgent *agent, StringInfo s);
static DatabasePool *create_database_pool(const char *database, List *nodes);
-static void insert_database_pool(DatabasePool * pool);
+static void insert_database_pool(DatabasePool *pool);
static int destroy_database_pool(const char *database);
static DatabasePool *find_database_pool(const char *database);
static DatabasePool *remove_database_pool(const char *database);
-static int *agent_acquire_connections(PoolAgent * agent, List *nodelist);
-static DataNodePoolSlot *acquire_connection(DatabasePool * dbPool, int node);
-static void agent_release_connections(PoolAgent * agent, bool clean);
-static void release_connection(DatabasePool * dbPool, DataNodePoolSlot * slot, int index, bool clean);
-static void destroy_slot(DataNodePoolSlot * slot);
-static void grow_pool(DatabasePool * dbPool, int index);
-static void destroy_node_pool(DataNodePool * node_pool);
+static int *agent_acquire_connections(PoolAgent *agent, List *nodelist);
+static DataNodePoolSlot *acquire_connection(DatabasePool *dbPool, int node);
+static void agent_release_connections(PoolAgent *agent, bool clean);
+static void release_connection(DatabasePool *dbPool, DataNodePoolSlot *slot, int index, bool clean);
+static void destroy_slot(DataNodePoolSlot *slot);
+static void grow_pool(DatabasePool *dbPool, int index);
+static void destroy_node_pool(DataNodePool *node_pool);
static void PoolerLoop(void);
/* Signal handlers */
@@ -105,7 +105,7 @@ static void pooler_die(SIGNAL_ARGS);
static void pooler_quickdie(SIGNAL_ARGS);
/* Check status of connection */
-extern int pqReadReady(PGconn * conn);
+extern int pqReadReady(PGconn *conn);
/*
* Flags set by interrupt handlers for later service in the main loop.
@@ -505,7 +505,7 @@ GetPoolManagerHandle(void)
* Close handle
*/
void
-PoolManagerCloseHandle(PoolHandle * handle)
+PoolManagerCloseHandle(PoolHandle *handle)
{
close(Socket(handle->port));
free(handle);
@@ -561,7 +561,7 @@ agent_create(void)
* Invoked from Session process
*/
void
-PoolManagerConnect(PoolHandle * handle, const char *database, List *nodes)
+PoolManagerConnect(PoolHandle *handle, const char *database)
{
Assert(Handle);
Assert(database);
@@ -579,7 +579,7 @@ PoolManagerConnect(PoolHandle * handle, const char *database, List *nodes)
* Init PoolAgent
*/
static void
-agent_init(PoolAgent * agent, const char *database, List *nodes)
+agent_init(PoolAgent *agent, const char *database, List *nodes)
{
Assert(agent);
Assert(database);
@@ -602,7 +602,7 @@ agent_init(PoolAgent * agent, const char *database, List *nodes)
* Destroy PoolAgent
*/
static void
-agent_destroy(PoolAgent * agent)
+agent_destroy(PoolAgent *agent)
{
int i;
@@ -640,7 +640,7 @@ agent_destroy(PoolAgent * agent)
* Release handle to pool manager
*/
void
-PoolManagerDisconnect(PoolHandle * handle)
+PoolManagerDisconnect(PoolHandle *handle)
{
Assert(handle);
@@ -672,7 +672,7 @@ PoolManagerGetConnections(List *nodelist)
i = 1;
foreach(nodelist_item, nodelist)
{
- nodes[i++] = htonl(nodelist_item->data.int_value);
+ nodes[i++] = htonl(lfirst_int(nodelist_item));
}
pool_putmessage(&Handle->port, 'g', (char *) nodes, sizeof(int) * (list_length(nodelist) + 1));
pool_flush(&Handle->port);
@@ -763,7 +763,7 @@ agent_handle_input(PoolAgent * agent, StringInfo s)
* acquire connection
*/
static int *
-agent_acquire_connections(PoolAgent * agent, List *nodelist)
+agent_acquire_connections(PoolAgent *agent, List *nodelist)
{
int i;
int *result;
@@ -802,7 +802,7 @@ agent_acquire_connections(PoolAgent * agent, List *nodelist)
i = 0;
foreach(nodelist_item, nodelist)
{
- int node = nodelist_item->data.int_value;
+ int node = lfirst_int(nodelist_item);
/* Acquire from the pool if none */
if (agent->connections[node - 1] == NULL)
@@ -831,7 +831,7 @@ agent_acquire_connections(PoolAgent * agent, List *nodelist)
* Retun connections back to the pool
*/
void
-PoolManagerReleaseConnections()
+PoolManagerReleaseConnections(void)
{
Assert(Handle);
@@ -844,7 +844,7 @@ PoolManagerReleaseConnections()
* Release connections
*/
static void
-agent_release_connections(PoolAgent * agent, bool clean)
+agent_release_connections(PoolAgent *agent, bool clean)
{
int i;
@@ -860,9 +860,7 @@ agent_release_connections(PoolAgent * agent, bool clean)
/* Release connection */
if (slot)
- {
release_connection(agent->pool, slot, i, clean);
- }
agent->connections[i] = NULL;
}
}
@@ -880,7 +878,7 @@ create_database_pool(const char *database, List *nodes)
int i;
ListCell *l;
- Assert(nodes && nodes->length > 0);
+ Assert(nodes && list_length(nodes) > 0);
/* check if exist */
databasePool = find_database_pool(database);
@@ -978,7 +976,7 @@ destroy_database_pool(const char *database)
* Insert new database pool to the list
*/
static void
-insert_database_pool(DatabasePool * databasePool)
+insert_database_pool(DatabasePool *databasePool)
{
Assert(databasePool);
@@ -1020,8 +1018,7 @@ find_database_pool(const char *database)
/*
* Remove pool for specified database from the list
*/
-static DatabasePool
-*
+static DatabasePool *
remove_database_pool(const char *database)
{
DatabasePool *databasePool,
@@ -1060,7 +1057,7 @@ remove_database_pool(const char *database)
* Acquire connection
*/
static DataNodePoolSlot *
-acquire_connection(DatabasePool * dbPool, int node)
+acquire_connection(DatabasePool *dbPool, int node)
{
DataNodePool *nodePool;
DataNodePoolSlot *slot;
@@ -1091,10 +1088,7 @@ acquire_connection(DatabasePool * dbPool, int node)
poll_result = pqReadReady(slot->conn);
if (poll_result == 0)
- {
- /* ok, no data */
- break;
- }
+ break; /* ok, no data */
else if (poll_result < 0)
{
if (errno == EAGAIN || errno == EINTR)
@@ -1103,9 +1097,7 @@ acquire_connection(DatabasePool * dbPool, int node)
elog(WARNING, "Error in checking connection, errno = %d", errno);
}
else
- {
elog(WARNING, "Unexpected data on connection, cleaning.");
- }
destroy_slot(slot);
/* Decrement current max pool size */
@@ -1115,12 +1107,9 @@ acquire_connection(DatabasePool * dbPool, int node)
}
}
else
- {
- /* report problem */
ereport(LOG,
(errcode(ERRCODE_INSUFFICIENT_RESOURCES),
errmsg("connection pool is empty")));
- }
return slot;
}
@@ -1184,11 +1173,9 @@ grow_pool(DatabasePool * dbPool, int index)
/* Allocate new DBNode Pool */
nodePool = (DataNodePool *) palloc(sizeof(DataNodePool));
if (!nodePool)
- {
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
- }
/* initialize it */
nodePool->connstr = DataNodeConnStr(
@@ -1263,7 +1250,7 @@ grow_pool(DatabasePool * dbPool, int index)
* Destroy pool slot
*/
static void
-destroy_slot(DataNodePoolSlot * slot)
+destroy_slot(DataNodePoolSlot *slot)
{
DataNodeClose(slot->conn);
pfree(slot);
@@ -1274,7 +1261,7 @@ destroy_slot(DataNodePoolSlot * slot)
* Destroy node pool
*/
static void
-destroy_node_pool(DataNodePool * node_pool)
+destroy_node_pool(DataNodePool *node_pool)
{
int i;
@@ -1330,7 +1317,7 @@ PoolerLoop(void)
/* watch for incoming connections */
FD_ZERO(&rfds);
- FD_SET (server_fd, &rfds);
+ FD_SET(server_fd, &rfds);
nfds = server_fd;
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 0dd252cb62..67d20b848b 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -3152,7 +3152,7 @@ BackendStartup(Port *port)
if (IS_PGXC_COORDINATOR)
{
/* User is authenticated and dbname is known at this point */
- PoolManagerConnect(pool_handle, port->database_name, GetAllNodes());
+ PoolManagerConnect(pool_handle, port->database_name);
InitGTM();
}
#endif
diff --git a/src/include/pgxc/locator.h b/src/include/pgxc/locator.h
index 46a8f9ec58..5fea37a019 100644
--- a/src/include/pgxc/locator.h
+++ b/src/include/pgxc/locator.h
@@ -39,7 +39,7 @@ typedef struct
int nodeCount;
List *nodeList;
ListCell *roundRobinNode; /* points to next one to use */
-} RelationLocInfo;
+} RelationLocInfo;
/* track if tables use pg_catalog */
@@ -63,21 +63,21 @@ typedef struct
List *nodelist;
char baselocatortype;
TableUsageType tableusagetype; /* track pg_catalog usage */
-} Exec_Nodes;
+} Exec_Nodes;
extern char *PreferredDataNodes;
-extern void InitRelationLocInfo();
+extern void InitRelationLocInfo(void);
extern char GetLocatorType(Oid relid);
extern char ConvertToLocatorType(int disttype);
-extern char *GetRelationHashColumn(RelationLocInfo * rel_loc_info);
+extern char *GetRelationHashColumn(RelationLocInfo *rel_loc_info);
extern RelationLocInfo *GetRelationLocInfo(Oid relid);
-extern RelationLocInfo *CopyRelationLocInfo(RelationLocInfo * src_info);
-extern Exec_Nodes *GetRelationNodes(RelationLocInfo * rel_loc_info, long *partValue,
+extern RelationLocInfo *CopyRelationLocInfo(RelationLocInfo *src_info);
+extern Exec_Nodes *GetRelationNodes(RelationLocInfo *rel_loc_info, long *partValue,
int isRead);
-extern bool IsHashColumn(RelationLocInfo * rel_loc_info, char *part_col_name);
+extern bool IsHashColumn(RelationLocInfo *rel_loc_info, char *part_col_name);
extern bool IsHashColumnForRelId(Oid relid, char *part_col_name);
extern int GetRoundRobinNode(Oid relid);
@@ -85,6 +85,6 @@ extern bool IsHashDistributable(Oid col_type);
extern List *GetAllNodes(void);
extern List *GetAnyDataNode(void);
extern void RelationBuildLocator(Relation rel);
-extern void FreeRelationLocInfo(RelationLocInfo * relationLocInfo);
+extern void FreeRelationLocInfo(RelationLocInfo *relationLocInfo);
#endif /* LOCATOR_H */
diff --git a/src/include/pgxc/planner.h b/src/include/pgxc/planner.h
index 04ec6fcc0e..0da4472c91 100644
--- a/src/include/pgxc/planner.h
+++ b/src/include/pgxc/planner.h
@@ -34,7 +34,7 @@ typedef struct
CombineType combine_type;
List *simple_aggregates; /* simple aggregate to combine on this
* step */
-} Query_Step;
+} Query_Step;
/*
@@ -47,7 +47,7 @@ typedef struct
int exec_loc_type;
bool force_autocommit; /* For CREATE DATABASE */
List *query_step_list; /* List of QuerySteps */
-} Query_Plan;
+} Query_Plan;
/* For handling simple aggregates (no group by present)
@@ -60,7 +60,7 @@ typedef enum
AGG_TYPE_COUNT,
AGG_TYPE_SUM,
AGG_TYPE_AVG
-} SimpleAggType;
+} SimpleAggType;
/* For handling simple aggregates */
@@ -74,7 +74,7 @@ typedef struct
int data_len;
int agg_data_type;
int response_count;
-} SimpleAgg;
+} SimpleAgg;
/* forbid SQL if unsafe, useful to turn off for development */
extern bool StrictStatementChecking;
@@ -82,10 +82,9 @@ extern bool StrictStatementChecking;
/* forbid SELECT even multi-node ORDER BY */
extern bool StrictSelectChecking;
-extern Query_Plan *
- GetQueryPlan(Node *parsetree, const char *sql_statement, List *querytree_list);
-extern void
- FreeQueryPlan(Query_Plan * query_plan);
+extern Query_Plan *GetQueryPlan(Node *parsetree, const char *sql_statement,
+ List *querytree_list);
+extern void FreeQueryPlan(Query_Plan *query_plan);
extern bool IsHashDistributable(Oid col_type);
#endif /* PGXCPLANNER_H */
diff --git a/src/include/pgxc/poolcomm.h b/src/include/pgxc/poolcomm.h
index 3c62f0662e..9e286ab292 100644
--- a/src/include/pgxc/poolcomm.h
+++ b/src/include/pgxc/poolcomm.h
@@ -32,18 +32,18 @@ typedef struct
/* send buffer */
int SendPointer;
char SendBuffer[POOL_BUFFER_SIZE];
-} PoolPort;
+} PoolPort;
extern int pool_listen(unsigned short port, const char *unixSocketName);
extern int pool_connect(unsigned short port, const char *unixSocketName);
-extern int pool_getbyte(PoolPort * port);
-extern int pool_pollbyte(PoolPort * port);
-extern int pool_getmessage(PoolPort * port, StringInfo s, int maxlen);
-extern int pool_getbytes(PoolPort * port, char *s, size_t len);
-extern int pool_putmessage(PoolPort * port, char msgtype, const char *s, size_t len);
-extern int pool_putbytes(PoolPort * port, const char *s, size_t len);
-extern int pool_flush(PoolPort * port);
-extern int pool_sendfds(PoolPort * port, int *fds, int count);
-extern int pool_recvfds(PoolPort * port, int *fds, int count);
+extern int pool_getbyte(PoolPort *port);
+extern int pool_pollbyte(PoolPort *port);
+extern int pool_getmessage(PoolPort *port, StringInfo s, int maxlen);
+extern int pool_getbytes(PoolPort *port, char *s, size_t len);
+extern int pool_putmessage(PoolPort *port, char msgtype, const char *s, size_t len);
+extern int pool_putbytes(PoolPort *port, const char *s, size_t len);
+extern int pool_flush(PoolPort *port);
+extern int pool_sendfds(PoolPort *port, int *fds, int count);
+extern int pool_recvfds(PoolPort *port, int *fds, int count);
#endif /* POOLCOMM_H */
diff --git a/src/include/pgxc/poolmgr.h b/src/include/pgxc/poolmgr.h
index 6e88fca3bc..2c9128e7c7 100644
--- a/src/include/pgxc/poolmgr.h
+++ b/src/include/pgxc/poolmgr.h
@@ -30,14 +30,14 @@ typedef struct
char *port;
char *uname;
char *password;
-} DataNodeConnectionInfo;
+} DataNodeConnectionInfo;
/* Connection pool entry */
typedef struct
{
struct timeval released;
NODE_CONNECTION *conn;
-} DataNodePoolSlot;
+} DataNodePoolSlot;
/* Pool of connections to specified data nodes */
typedef struct
@@ -46,7 +46,7 @@ typedef struct
int freeSize; /* available connections */
int size; /* total pool size */
DataNodePoolSlot **slot;
-} DataNodePool;
+} DataNodePool;
/* All pools for specified database */
typedef struct databasepool
@@ -55,7 +55,7 @@ typedef struct databasepool
char *database;
DataNodePool **nodePools; /* one for each data node */
struct databasepool *next;
-} DatabasePool;
+} DatabasePool;
/* Agent of client session (Pool Manager side)
* Acts as a session manager, grouping connections together
@@ -66,14 +66,14 @@ typedef struct
PoolPort port;
DatabasePool *pool;
DataNodePoolSlot **connections; /* one for each data node */
-} PoolAgent;
+} PoolAgent;
/* Handle to the pool manager (Session's side) */
typedef struct
{
/* communication channel */
PoolPort port;
-} PoolHandle;
+} PoolHandle;
extern int NumDataNodes;
extern int MinPoolSize;
@@ -107,19 +107,19 @@ extern PoolHandle *GetPoolManagerHandle(void);
* Called from Postmaster(Coordinator) after fork. Close one end of the pipe and
* free memory occupied by PoolHandler
*/
-extern void PoolManagerCloseHandle(PoolHandle * handle);
+extern void PoolManagerCloseHandle(PoolHandle *handle);
/*
* Gracefully close connection to the PoolManager
*/
-extern void PoolManagerDisconnect(PoolHandle * handle);
+extern void PoolManagerDisconnect(PoolHandle *handle);
/*
* Called from Session process after fork(). Associate handle with session
* for subsequent calls. Associate session with specified database and
* initialize respective connection pool
*/
-extern void PoolManagerConnect(PoolHandle * handle, const char *database, List *nodes);
+extern void PoolManagerConnect(PoolHandle *handle, const char *database);
/* Get pooled connections */
extern int *PoolManagerGetConnections(List *nodelist);