summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael P2011-08-08 06:54:49 +0000
committerMichael P2011-08-08 06:56:50 +0000
commit52fde6ac488b392203d642bc1b54d124ec4843ed (patch)
treea10d841ff80a3330bd87a9c6be5fabf7a3632607
parentf1a32c6227136d722aead50b8d4a85fceba7523f (diff)
Clean up compilation warnings
90% of compilation warnings are cleaned with this commit. There are still warnings remaining due to the strong dependance between GTM and PGXC main code.
-rw-r--r--src/backend/access/common/heaptuple.c4
-rw-r--r--src/backend/access/hash/hashfunc.c2
-rw-r--r--src/backend/access/transam/gtm.c2
-rw-r--r--src/backend/commands/copy.c188
-rw-r--r--src/backend/commands/dbcommands.c4
-rw-r--r--src/backend/nodes/copyfuncs.c3
-rw-r--r--src/backend/nodes/readfuncs.c16
-rw-r--r--src/backend/optimizer/plan/planner.c2
-rw-r--r--src/backend/optimizer/util/pathnode.c2
-rw-r--r--src/backend/parser/analyze.c3
-rw-r--r--src/backend/parser/gram.y4
-rw-r--r--src/backend/pgxc/barrier/barrier.c4
-rw-r--r--src/backend/pgxc/plan/planner.c32
-rw-r--r--src/backend/pgxc/pool/execRemote.c3
-rw-r--r--src/backend/pgxc/pool/pgxcnode.c2
-rw-r--r--src/backend/pgxc/pool/poolmgr.c18
-rw-r--r--src/backend/rewrite/rewriteHandler.c5
-rw-r--r--src/backend/tcop/postgres.c2
-rw-r--r--src/backend/utils/adt/ruleutils.c4
-rw-r--r--src/backend/utils/error/elog.c1
-rw-r--r--src/backend/utils/mmgr/mcxt.c6
-rw-r--r--src/backend/utils/sort/tuplesort.c2
-rw-r--r--src/gtm/common/mcxt.c8
-rw-r--r--src/gtm/gtm_ctl/gtm_ctl.c2
-rw-r--r--src/gtm/main/gtm_seq.c6
-rw-r--r--src/gtm/main/gtm_txn.c1
-rw-r--r--src/gtm/path/path.c12
-rw-r--r--src/gtm/proxy/proxy_main.c1
-rw-r--r--src/include/access/gtm.h2
-rw-r--r--src/include/pgxc/barrier.h4
-rw-r--r--src/include/pgxc/pgxcnode.h5
-rw-r--r--src/include/pgxc/planner.h2
32 files changed, 78 insertions, 274 deletions
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index cb1f8f89fd..5caae51be1 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -1137,6 +1137,7 @@ slot_deform_datarow(TupleTableSlot *slot)
StringInfo buffer;
uint16 n16;
uint32 n32;
+ MemoryContext oldcontext;
if (slot->tts_tupleDescriptor == NULL || slot->tts_dataRow == NULL)
return;
@@ -1162,7 +1163,7 @@ slot_deform_datarow(TupleTableSlot *slot)
* Ensure info about input functions is available as long as slot lives
* as well as deformed values
*/
- MemoryContext oldcontext = MemoryContextSwitchTo(slot->tts_mcxt);
+ oldcontext = MemoryContextSwitchTo(slot->tts_mcxt);
if (slot->tts_attinmeta == NULL)
slot->tts_attinmeta = TupleDescGetAttInMetadata(slot->tts_tupleDescriptor);
@@ -1170,7 +1171,6 @@ slot_deform_datarow(TupleTableSlot *slot)
buffer = makeStringInfo();
for (i = 0; i < attnum; i++)
{
- Form_pg_attribute attr = slot->tts_tupleDescriptor->attrs[i];
int len;
/* get size */
diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c
index e00696eb66..3c30fa2110 100644
--- a/src/backend/access/hash/hashfunc.c
+++ b/src/backend/access/hash/hashfunc.c
@@ -542,7 +542,7 @@ compute_hash(Oid type, Datum value, int *pErr)
*pErr = 0;
- if (value == NULL)
+ if (!value)
{
*pErr = 1;
return 0;
diff --git a/src/backend/access/transam/gtm.c b/src/backend/access/transam/gtm.c
index f05e38de86..77cfdc6388 100644
--- a/src/backend/access/transam/gtm.c
+++ b/src/backend/access/transam/gtm.c
@@ -440,7 +440,7 @@ SetValGTM(char *seqname, GTM_Sequence nextval, bool iscalled)
* GTM_SEQ_DB_NAME, DB name part of sequence key
*/
int
-DropSequenceGTM(const char *name, GTM_SequenceKeyType type)
+DropSequenceGTM(char *name, GTM_SequenceKeyType type)
{
GTM_SequenceKeyData seqkey;
CheckConnection();
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index bfaf6e2860..36fc32d437 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -339,12 +339,6 @@ static bool CopyGetInt16(CopyState cstate, int16 *val);
#ifdef PGXC
static ExecNodes *build_copy_statement(CopyState cstate, List *attnamelist,
TupleDesc tupDesc, bool is_from, List *force_quote, List *force_notnull);
-/*
- * A kluge here making this static to avoid having to move the
- * CopyState definition to a header file making it harder to merge
- * with the vanilla PostgreSQL code
- */
-static CopyState insertstate;
#endif
/*
@@ -2521,10 +2515,10 @@ BeginCopyFrom(Relation rel,
tmp |= (1 << 16);
tmp = htonl(tmp);
- appendBinaryStringInfo(&cstate->line_buf, &tmp, 4);
+ appendBinaryStringInfo(&cstate->line_buf, (char *) &tmp, 4);
tmp = 0;
tmp = htonl(tmp);
- appendBinaryStringInfo(&cstate->line_buf, &tmp, 4);
+ appendBinaryStringInfo(&cstate->line_buf, (char *) &tmp, 4);
if (DataNodeCopyInBinaryForAll(cstate->line_buf.data, 19, cstate->connections))
ereport(ERROR,
@@ -2748,7 +2742,7 @@ NextCopyFrom(CopyState cstate, ExprContext *econtext,
enlargeStringInfo(&cstate->line_buf, sizeof(uint16));
/* Receive field count directly from datanodes */
fld_count = htons(fld_count);
- appendBinaryStringInfo(&cstate->line_buf, &fld_count, sizeof(uint16));
+ appendBinaryStringInfo(&cstate->line_buf, (char *) &fld_count, sizeof(uint16));
}
#endif
@@ -2781,7 +2775,7 @@ NextCopyFrom(CopyState cstate, ExprContext *econtext,
enlargeStringInfo(&cstate->line_buf, sizeof(uint16));
/* Receive field count directly from datanodes */
fld_count = htons(fld_count);
- appendBinaryStringInfo(&cstate->line_buf, &fld_count, sizeof(uint16));
+ appendBinaryStringInfo(&cstate->line_buf, (char *) &fld_count, sizeof(uint16));
}
#endif
@@ -2807,7 +2801,7 @@ NextCopyFrom(CopyState cstate, ExprContext *econtext,
enlargeStringInfo(&cstate->line_buf, sizeof(uint16));
fld_count = htons(fld_count);
- appendBinaryStringInfo(&cstate->line_buf, &fld_count, sizeof(uint16));
+ appendBinaryStringInfo(&cstate->line_buf, (char *) &fld_count, sizeof(uint16));
}
#endif
@@ -3792,7 +3786,7 @@ CopyReadBinaryAttribute(CopyState cstate,
/* Get the field size from Datanode */
enlargeStringInfo(&cstate->line_buf, sizeof(int32));
nSize = htonl(fld_size);
- appendBinaryStringInfo(&cstate->line_buf, &nSize, sizeof(int32));
+ appendBinaryStringInfo(&cstate->line_buf, (char *) &nSize, sizeof(int32));
}
#endif
@@ -4379,174 +4373,4 @@ build_copy_statement(CopyState cstate, List *attnamelist,
}
return exec_nodes;
}
-
-/*
- * Use COPY for handling INSERT SELECT
- * It may be a bit better to use binary mode here, but
- * we have not implemented binary support for COPY yet.
- *
- * We borrow some code from CopyTo and DoCopy here.
- * We do not refactor them so that it is later easier to remerge
- * with vanilla PostgreSQL
- */
-void
-DoInsertSelectCopy(EState *estate, TupleTableSlot *slot)
-{
- ExecNodes *exec_nodes;
- HeapTuple tuple;
- Datum *values;
- bool *nulls;
- Datum dist_col_value;
- Oid dist_col_type;
- MemoryContext oldcontext;
- CopyState cstate;
-
-
- Assert(IS_PGXC_COORDINATOR);
-
- /* See if we need to initialize COPY (first tuple) */
- if (estate->es_processed == 0)
- {
- ListCell *lc;
- List *attnamelist = NIL;
- ResultRelInfo *resultRelInfo = estate->es_result_relation_info;
- Form_pg_attribute *attr;
-
- oldcontext = MemoryContextSwitchTo(estate->es_query_cxt);
- exec_nodes = makeNode(ExecNodes);
-
- /*
- * We use the cstate struct here, though we do not need everything
- * We will just use the properties we are interested in here.
- */
- insertstate = (CopyStateData *) palloc0(sizeof(CopyStateData));
- cstate = insertstate;
-
- cstate->rowcontext = AllocSetContextCreate(CurrentMemoryContext,
- "COPY TO",
- ALLOCSET_DEFAULT_MINSIZE,
- ALLOCSET_DEFAULT_INITSIZE,
- ALLOCSET_DEFAULT_MAXSIZE);
-
- cstate->rel = resultRelInfo->ri_RelationDesc;
- cstate->tupDesc = RelationGetDescr(cstate->rel);
-
- foreach(lc, estate->es_plannedstmt->planTree->targetlist)
- {
- TargetEntry *target = (TargetEntry *) lfirst(lc);
- attnamelist = lappend(attnamelist, makeString(target->resname));
- }
- cstate->attnumlist = CopyGetAttnums(cstate->tupDesc, cstate->rel, attnamelist);
-
- /* We use fe_msgbuf as a per-row buffer regardless of copy_dest */
- cstate->fe_msgbuf = makeStringInfo();
- attr = cstate->tupDesc->attrs;
-
- if (cstate->idx_dist_by_col >= 0)
- dist_col_type = attr[cstate->idx_dist_by_col]->atttypid;
- else
- dist_col_type = UNKNOWNOID;
-
- /* Get info about the columns we need to process. */
- cstate->out_functions = (FmgrInfo *) palloc(cstate->tupDesc->natts * sizeof(FmgrInfo));
- foreach(lc, cstate->attnumlist)
- {
- int attnum = lfirst_int(lc);
- Oid out_func_oid;
- bool isvarlena;
-
- if (cstate->binary)
- getTypeBinaryOutputInfo(attr[attnum - 1]->atttypid,
- &out_func_oid,
- &isvarlena);
- else
- getTypeOutputInfo(attr[attnum - 1]->atttypid,
- &out_func_oid,
- &isvarlena);
- fmgr_info(out_func_oid, &cstate->out_functions[attnum - 1]);
- }
-
- /* Set defaults for omitted options */
- if (!cstate->delim)
- cstate->delim = cstate->csv_mode ? "," : "\t";
-
- if (!cstate->null_print)
- cstate->null_print = cstate->csv_mode ? "" : "\\N";
- cstate->null_print_len = strlen(cstate->null_print);
- cstate->null_print_client = cstate->null_print; /* default */
-
- if (cstate->csv_mode)
- {
- if (!cstate->quote)
- cstate->quote = "\"";
- if (!cstate->escape)
- cstate->escape = cstate->quote;
- }
-
- exec_nodes = build_copy_statement(cstate, attnamelist,
- cstate->tupDesc, true, NULL, NULL);
-
- cstate->connections = DataNodeCopyBegin(cstate->query_buf.data,
- exec_nodes->nodelist,
- GetActiveSnapshot(),
- true);
-
- if (!cstate->connections)
- ereport(ERROR,
- (errcode(ERRCODE_CONNECTION_EXCEPTION),
- errmsg("Failed to initialize data nodes for COPY")));
-
- cstate->copy_dest = COPY_BUFFER;
-
- MemoryContextSwitchTo(oldcontext);
- }
- cstate = insertstate;
-
- values = (Datum *) palloc(cstate->tupDesc->natts * sizeof(Datum));
- nulls = (bool *) palloc(cstate->tupDesc->natts * sizeof(bool));
-
- /* Process Tuple */
- /* We need to format the line for sending to data nodes */
- tuple = ExecMaterializeSlot(slot);
-
- /* Deconstruct the tuple ... faster than repeated heap_getattr */
- heap_deform_tuple(tuple, cstate->tupDesc, values, nulls);
-
- /* Format the input tuple for sending */
- CopyOneRowTo(cstate, 0, values, nulls);
-
- /* Get dist column, if any */
- if (cstate->idx_dist_by_col >= 0 && !nulls[cstate->idx_dist_by_col])
- dist_col_value = values[cstate->idx_dist_by_col];
- else
- dist_col_type = UNKNOWNOID;
-
- /* Send item to the appropriate data node(s) (buffer) */
- if (DataNodeCopyIn(cstate->fe_msgbuf->data,
- cstate->fe_msgbuf->len,
- GetRelationNodes(cstate->rel_loc, dist_col_value, dist_col_type, RELATION_ACCESS_INSERT),
- cstate->connections))
- ereport(ERROR,
- (errcode(ERRCODE_CONNECTION_EXCEPTION),
- errmsg("Copy failed on a data node")));
-
- resetStringInfo(cstate->fe_msgbuf);
- estate->es_processed++;
-}
-
-/*
- *
- */
-void
-EndInsertSelectCopy(void)
-{
- Assert(IS_PGXC_COORDINATOR);
-
- DataNodeCopyFinish(
- insertstate->connections,
- primary_data_node,
- COMBINE_TYPE_NONE);
- pfree(insertstate->connections);
- MemoryContextDelete(insertstate->rowcontext);
-}
#endif
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 63f2fbb31d..8f6ee8ac68 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -887,8 +887,8 @@ dropdb(const char *dbname, bool missing_ok)
#ifdef PGXC
/* Drop sequences on gtm that are on the database dropped. */
- if(IS_PGXC_COORDINATOR && !IsConnFromCoord())
- if(DropSequenceGTM(dbname, GTM_SEQ_DB_NAME))
+ if (IS_PGXC_COORDINATOR && !IsConnFromCoord())
+ if (DropSequenceGTM((char *)dbname, GTM_SEQ_DB_NAME))
elog(ERROR, "Deletion of sequences on database %s not completed", dbname);
#endif
}
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 64ea9f5f68..3b26d4a68e 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -1003,7 +1003,8 @@ _copyRemoteQuery(RemoteQuery *from)
COPY_STRING_FIELD(statement);
COPY_STRING_FIELD(cursor);
COPY_SCALAR_FIELD(num_params);
- COPY_POINTER_FIELD(param_types, sizeof(from->param_types[0]) * from->num_params);
+ COPY_POINTER_FIELD(param_types,
+ sizeof(from->param_types[0]) * from->num_params);
COPY_SCALAR_FIELD(exec_type);
COPY_SCALAR_FIELD(paramval_data);
COPY_SCALAR_FIELD(paramval_len);
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index d6338e3ea9..a3aee7c900 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -1290,22 +1290,6 @@ _readRangeTblEntry(void)
READ_DONE();
}
-#ifdef PGXC
-/*
- * _readDistributeBy
- */
-static DistributeBy *
-_readDistributeBy(void)
-{
- READ_LOCALS(DistributeBy);
-
- READ_ENUM_FIELD(disttype, DistributionType);
- READ_STRING_FIELD(colname);
-
- READ_DONE();
-}
-#endif
-
/*
* parseNodeString
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 326cc9cc70..4002b4f38b 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -267,6 +267,8 @@ standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
case CMD_DELETE:
top_plan = create_remotedelete_plan(root, top_plan);
break;
+ default:
+ break;
}
#endif
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index 4e7b456704..9efb8542dc 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -1445,7 +1445,7 @@ create_remotequery_path(PlannerInfo *root, RelOptInfo *rel)
* execute query against remote query multiple times.
* Subject for future optimization
*/
- pathnode = create_material_path(rel, pathnode);
+ pathnode = (Path *) create_material_path(rel, pathnode);
return pathnode;
}
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 1483187f55..f212ee1c09 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -42,6 +42,7 @@
#include "parser/parsetree.h"
#include "rewrite/rewriteManip.h"
#ifdef PGXC
+#include "miscadmin.h"
#include "pgxc/pgxc.h"
#include "access/gtm.h"
#include "pgxc/planner.h"
@@ -2382,7 +2383,7 @@ transformExecDirectStmt(ParseState *pstate, ExecDirectStmt *stmt)
step->exec_nodes = (ExecNodes *) palloc(sizeof(ExecNodes));
step->exec_nodes->primarynodelist = NIL;
step->exec_nodes->nodelist = NIL;
- step->exec_nodes->en_expr = NIL;
+ step->exec_nodes->en_expr = NULL;
step->force_autocommit = false;
step->combine_type = COMBINE_TYPE_SAME;
step->read_only = true;
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 25dd548585..1cbb5e9314 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -8157,12 +8157,12 @@ CleanConnStmt: CLEAN CONNECTION TO COORDINATOR coord_list CleanConnDbName CleanC
CleanConnDbName: FOR DATABASE database_name { $$ = $3; }
| FOR database_name { $$ = $2; }
- | /* EMPTY */ { $$ = NIL; }
+ | /* EMPTY */ { $$ = NULL; }
;
CleanConnUserName: TO USER RoleId { $$ = $3; }
| TO RoleId { $$ = $2; }
- | /* EMPTY */ { $$ = NIL; }
+ | /* EMPTY */ { $$ = NULL; }
;
/* PGXC_END */
diff --git a/src/backend/pgxc/barrier/barrier.c b/src/backend/pgxc/barrier/barrier.c
index 9512cbc379..fac8f518da 100644
--- a/src/backend/pgxc/barrier/barrier.c
+++ b/src/backend/pgxc/barrier/barrier.c
@@ -31,10 +31,6 @@ static PGXCNodeAllHandles *PrepareBarrier(const char *id);
static void ExecuteBarrier(const char *id);
static void EndBarrier(PGXCNodeAllHandles *handles, const char *id);
-extern void ProcessCreateBarrierPrepare(const char *id);
-extern void ProcessCreateBarrierEnd(const char *id);
-extern void ProcessCreateBarrierExecute(const char *id);
-
/*
* Prepare ourselves for an incoming BARRIER. We must disable all new 2PC
* commits and let the ongoing commits to finish. We then remember the
diff --git a/src/backend/pgxc/plan/planner.c b/src/backend/pgxc/plan/planner.c
index e3499134db..83e08be10f 100644
--- a/src/backend/pgxc/plan/planner.c
+++ b/src/backend/pgxc/plan/planner.c
@@ -707,7 +707,6 @@ examine_conditions_walker(Node *expr_node, XCWalkerContext *context)
/* Find referenced portal and figure out what was the last fetch node */
Portal portal;
QueryDesc *queryDesc;
- PlanState *state;
CurrentOfExpr *cexpr = (CurrentOfExpr *) expr_node;
char *cursor_name = cexpr->cursor_name;
char *node_cursor;
@@ -1046,13 +1045,13 @@ examine_conditions_walker(Node *expr_node, XCWalkerContext *context)
if (IsA(arg1, RelabelType))
{
- rt = arg1;
+ rt = (RelabelType *) arg1;
arg1 = rt->arg;
}
if (IsA(arg2, RelabelType))
{
- rt = arg2;
+ rt = (RelabelType *)arg2;
arg2 = rt->arg;
}
@@ -1789,7 +1788,7 @@ get_plan_nodes_walker(Node *query_node, XCWalkerContext *context)
context->query_step->exec_nodes->nodelist =
list_copy(rel_loc_info->nodeList);
context->query_step->exec_nodes->en_expr = NULL;
- context->query_step->exec_nodes->en_relid = NULL;
+ context->query_step->exec_nodes->en_relid = InvalidOid;
context->query_step->exec_nodes->accesstype = context->accessType;
}
}
@@ -2938,29 +2937,6 @@ pgxc_planner(Query *query, int cursorOptions, ParamListInfo boundParams)
/*
- * Free Query_Step struct
- */
-static void
-free_query_step(RemoteQuery *query_step)
-{
- if (query_step == NULL)
- return;
-
- pfree(query_step->sql_statement);
- if (query_step->cursor)
- pfree(query_step->cursor);
- if (query_step->exec_nodes)
- {
- if (query_step->exec_nodes->nodelist)
- list_free(query_step->exec_nodes->nodelist);
- if (query_step->exec_nodes->primarynodelist)
- list_free(query_step->exec_nodes->primarynodelist);
- }
- pfree(query_step);
-}
-
-
-/*
* See if we can reduce the passed in RemoteQuery nodes to a single step.
*
* We need to check when we can further collapse already collapsed nodes.
@@ -3230,7 +3206,7 @@ AddRemoteQueryNode(List *stmts, const char *queryString, RemoteQueryExecType rem
{
RemoteQuery *step = makeNode(RemoteQuery);
step->combine_type = COMBINE_TYPE_SAME;
- step->sql_statement = queryString;
+ step->sql_statement = (char *) queryString;
step->exec_type = remoteExecType;
step->is_temp = is_temp;
result = lappend(result, step);
diff --git a/src/backend/pgxc/pool/execRemote.c b/src/backend/pgxc/pool/execRemote.c
index 121245d696..e9d2d17232 100644
--- a/src/backend/pgxc/pool/execRemote.c
+++ b/src/backend/pgxc/pool/execRemote.c
@@ -1370,19 +1370,16 @@ is_data_node_ready(PGXCNodeHandle * conn)
break;
case 'Z': /* ReadyForQuery */
- {
/*
* Return result depends on previous connection state.
* If it was PORTAL_SUSPENDED coordinator want to send down
* another EXECUTE to fetch more rows, otherwise it is done
* with the connection
*/
- int result = suspended ? RESPONSE_SUSPENDED : RESPONSE_COMPLETE;
conn->transaction_status = msg[0];
conn->state = DN_CONNECTION_STATE_IDLE;
conn->combiner = NULL;
return true;
- }
}
}
/* never happen, but keep compiler quiet */
diff --git a/src/backend/pgxc/pool/pgxcnode.c b/src/backend/pgxc/pool/pgxcnode.c
index 4e71cc5172..ad86b2582a 100644
--- a/src/backend/pgxc/pool/pgxcnode.c
+++ b/src/backend/pgxc/pool/pgxcnode.c
@@ -31,6 +31,7 @@
#include "commands/prepare.h"
#include "gtm/gtm_c.h"
#include "pgxc/pgxcnode.h"
+#include "pgxc/execRemote.h"
#include "pgxc/locator.h"
#include "pgxc/pgxc.h"
#include "pgxc/poolmgr.h"
@@ -1074,7 +1075,6 @@ int
pgxc_node_send_bind(PGXCNodeHandle * handle, const char *portal,
const char *statement, int paramlen, char *params)
{
- uint16 n16;
int pnameLen;
int stmtLen;
int paramCodeLen;
diff --git a/src/backend/pgxc/pool/poolmgr.c b/src/backend/pgxc/pool/poolmgr.c
index c0d8d56aab..f31e445354 100644
--- a/src/backend/pgxc/pool/poolmgr.c
+++ b/src/backend/pgxc/pool/poolmgr.c
@@ -47,6 +47,7 @@
#include "pgxc/pgxc.h"
#include "pgxc/poolutils.h"
#include "../interfaces/libpq/libpq-fe.h"
+#include "../interfaces/libpq/libpq-int.h"
#include "postmaster/postmaster.h" /* For UnixSocketDir */
#include <stdlib.h>
#include <string.h>
@@ -133,9 +134,6 @@ static int *abort_pids(int *count,
static void pooler_die(SIGNAL_ARGS);
static void pooler_quickdie(SIGNAL_ARGS);
-/* Check status of connection */
-extern int pqReadReady(PGconn *conn);
-
/*
* Flags set by interrupt handlers for later service in the main loop.
*/
@@ -552,7 +550,7 @@ PoolManagerConnect(PoolHandle *handle, const char *database, const char *user_na
int
PoolManagerSetCommand(PoolCommandType command_type, const char *set_command)
{
- int n32;
+ int n32, res;
char msgtype = 's';
Assert(Handle);
@@ -591,7 +589,9 @@ PoolManagerSetCommand(PoolCommandType command_type, const char *set_command)
pool_flush(&Handle->port);
/* Get result */
- pool_recvres(&Handle->port);
+ res = pool_recvres(&Handle->port);
+
+ return res;
}
/*
@@ -614,6 +614,8 @@ agent_init(PoolAgent *agent, const char *database, const char *user_name)
/* create if not found */
if (agent->pool == NULL)
agent->pool = create_database_pool(database, user_name);
+
+ return;
}
@@ -1974,7 +1976,7 @@ acquire_connection(DatabasePool *dbPool, int node, char client_conn_type)
retry:
/* Make sure connection is ok */
- poll_result = pqReadReady(slot->conn);
+ poll_result = pqReadReady((PGconn *)slot->conn);
if (poll_result == 0)
break; /* ok, no data */
@@ -2173,7 +2175,7 @@ grow_pool(DatabasePool * dbPool, int index, char client_conn_type)
break;
}
- slot->xc_cancelConn = PQgetCancel(slot->conn);
+ slot->xc_cancelConn = (NODE_CANCEL *) PQgetCancel((PGconn *)slot->conn);
/* Insert at the end of the pool */
nodePool->slot[(nodePool->freeSize)++] = slot;
@@ -2193,7 +2195,7 @@ grow_pool(DatabasePool * dbPool, int index, char client_conn_type)
static void
destroy_slot(PGXCNodePoolSlot *slot)
{
- PQfreeCancel(slot->xc_cancelConn);
+ PQfreeCancel((PGcancel *)slot->xc_cancelConn);
PGXCNodeClose(slot->conn);
pfree(slot);
}
diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c
index 0b922a6927..f08fbbcd54 100644
--- a/src/backend/rewrite/rewriteHandler.c
+++ b/src/backend/rewrite/rewriteHandler.c
@@ -31,6 +31,7 @@
#ifdef PGXC
#include "pgxc/pgxc.h"
#include "pgxc/poolmgr.h"
+#include "optimizer/planner.h"
#endif
@@ -2477,7 +2478,7 @@ GetRelPartColPos(const Query *query, const char *partColName)
static void
ProcessHashValue(List **valuesList, const List *subList, const int node)
{
- valuesList[node - 1] = lappend(valuesList[node - 1], subList);
+ valuesList[node - 1] = lappend(valuesList[node - 1], (List *) subList);
}
/*
@@ -2502,7 +2503,7 @@ static void
DestroyValuesList(List **valuesList[])
{
pfree(*valuesList);
- *valuesList = NIL;
+ *valuesList = NULL;
}
/*
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index fc57a2450b..1efe280baf 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -4353,7 +4353,7 @@ PostgresMain(int argc, char *argv[], const char *username)
char *id;
command = pq_getmsgbyte(&input_message);
- id = pq_getmsgstring(&input_message);
+ id = (char *) pq_getmsgstring(&input_message);
pq_getmsgend(&input_message);
switch (command)
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 76ef9d0b69..bc41c14c31 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -2185,7 +2185,7 @@ deparse_context_for_remotequery(Alias *aliasname, Oid relid)
dpns->planstate = NULL;
dpns->ancestors = NIL;
dpns->outer_plan = dpns->inner_plan = NULL;
- dpns->outer_planstate = dpns->inner_planstate = NIL;
+ dpns->outer_planstate = dpns->inner_planstate = NULL;
dpns->remotequery = true;
/* Return a one-deep namespace stack */
@@ -2689,7 +2689,7 @@ get_query_def_from_valuesList(Query *query, StringInfo buf)
dpns.planstate = NULL;
dpns.ancestors = NIL;
dpns.outer_plan = dpns.inner_plan = NULL;
- dpns.outer_planstate = dpns.inner_planstate = NIL;
+ dpns.outer_planstate = dpns.inner_planstate = NULL;
dpns.remotequery = false;
/*
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index cefde432bc..5e0fee7a01 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -79,6 +79,7 @@
#include "utils/ps_status.h"
#ifdef PGXC
#include "pgxc/pgxc.h"
+#include "pgxc/execRemote.h"
#endif
diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c
index 8ebf918a89..887241be0a 100644
--- a/src/backend/utils/mmgr/mcxt.c
+++ b/src/backend/utils/mmgr/mcxt.c
@@ -739,6 +739,10 @@ void *current_memcontext()
return((void *)CurrentMemoryContext);
}
-Gen_Alloc genAlloc_class = {MemoryContextAlloc, MemoryContextAllocZero, repalloc, pfree, current_memcontext};
+Gen_Alloc genAlloc_class = {(void *)MemoryContextAlloc,
+ (void *)MemoryContextAllocZero,
+ (void *)repalloc,
+ (void *)pfree,
+ (void *)current_memcontext};
#endif
diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c
index b795fa65de..5c9f37dda1 100644
--- a/src/backend/utils/sort/tuplesort.c
+++ b/src/backend/utils/sort/tuplesort.c
@@ -3105,7 +3105,7 @@ getlen_datanode(Tuplesortstate *state, int tapenum, bool eofOK)
if (pgxc_node_receive(1, &conn, NULL))
ereport(ERROR,
(errcode(ERRCODE_INTERNAL_ERROR),
- errmsg(conn->error)));
+ errmsg("%s", conn->error)));
break;
case RESPONSE_COMPLETE:
/* EOF encountered, close the tape and report EOF */
diff --git a/src/gtm/common/mcxt.c b/src/gtm/common/mcxt.c
index 90c63f08f1..e214cfe1aa 100644
--- a/src/gtm/common/mcxt.c
+++ b/src/gtm/common/mcxt.c
@@ -769,4 +769,10 @@ void *current_memcontext(void)
{
return((void *)CurrentMemoryContext);
}
-Gen_Alloc genAlloc_class = {MemoryContextAlloc, MemoryContextAllocZero, repalloc, pfree, current_memcontext};
+
+Gen_Alloc genAlloc_class = {(void *)MemoryContextAlloc,
+ (void *)MemoryContextAllocZero,
+ (void *)repalloc,
+ (void *)pfree,
+ (void *)current_memcontext};
+
diff --git a/src/gtm/gtm_ctl/gtm_ctl.c b/src/gtm/gtm_ctl/gtm_ctl.c
index d37c009f37..b951f3da40 100644
--- a/src/gtm/gtm_ctl/gtm_ctl.c
+++ b/src/gtm/gtm_ctl/gtm_ctl.c
@@ -65,8 +65,6 @@ static char *log_file = NULL;
static char *gtm_path = NULL;
static char *gtm_app = NULL;
static char *argv0 = NULL;
-static char *reconnect_host = NULL;
-static char *reconnect_port = NULL;
static void
write_stderr(const char *fmt,...)
diff --git a/src/gtm/main/gtm_seq.c b/src/gtm/main/gtm_seq.c
index 2c2c7d6423..261af75e3a 100644
--- a/src/gtm/main/gtm_seq.c
+++ b/src/gtm/main/gtm_seq.c
@@ -22,6 +22,7 @@
#include "gtm/gtm_seq.h"
#include "gtm/gtm_serialize.h"
#include "gtm/gtm_standby.h"
+#include "gtm/standby_utils.h"
#include "gtm/libpq.h"
#include "gtm/libpq-int.h"
#include "gtm/pqformat.h"
@@ -639,7 +640,7 @@ GTM_SeqRename(GTM_SequenceKey seqkey, GTM_SequenceKey newseqkey)
/* Release first the structure as it has been taken previously */
seq_release_seqinfo(seqinfo);
- /* Close sequence properly, full name is here */
+ /* Close sequence properly, full name is here */
seqkey->gsk_type = GTM_SEQ_FULL_NAME;
/* Then close properly the old sequence */
GTM_SeqClose(seqkey);
@@ -685,7 +686,8 @@ GTM_SeqSetVal(GTM_SequenceKey seqkey, GTM_Sequence nextval, bool iscalled)
ereport(LOG,
(EINVAL,
errmsg("The sequence with the given key does not exist")));
- return InvalidSequenceValue;
+
+ return EINVAL;
}
GTM_RWLockAcquire(&seqinfo->gs_lock, GTM_LOCKMODE_WRITE);
diff --git a/src/gtm/main/gtm_txn.c b/src/gtm/main/gtm_txn.c
index 37b40a68e3..0b69de922d 100644
--- a/src/gtm/main/gtm_txn.c
+++ b/src/gtm/main/gtm_txn.c
@@ -23,6 +23,7 @@
#include "gtm/gtm_txn.h"
#include "gtm/gtm_serialize.h"
#include "gtm/gtm_standby.h"
+#include "gtm/standby_utils.h"
#include "gtm/libpq.h"
#include "gtm/libpq-int.h"
#include "gtm/pqformat.h"
diff --git a/src/gtm/path/path.c b/src/gtm/path/path.c
index a3604f3b92..32009a3bcf 100644
--- a/src/gtm/path/path.c
+++ b/src/gtm/path/path.c
@@ -24,7 +24,7 @@
#include <gtm/path.h>
-#define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\')
+#define IS_DIR_SEP_GTM(ch) ((ch) == '/' || (ch) == '\\')
#define skip_drive(path) (path)
@@ -146,16 +146,16 @@ trim_directory(char *path)
return;
/* back up over trailing slash(es) */
- for (p = path + strlen(path) - 1; IS_DIR_SEP(*p) && p > path; p--)
+ for (p = path + strlen(path) - 1; IS_DIR_SEP_GTM(*p) && p > path; p--)
;
/* back up over directory name */
- for (; !IS_DIR_SEP(*p) && p > path; p--)
+ for (; !IS_DIR_SEP_GTM(*p) && p > path; p--)
;
/* if multiple slashes before directory name, remove 'em all */
- for (; p > path && IS_DIR_SEP(*(p - 1)); p--)
+ for (; p > path && IS_DIR_SEP_GTM(*(p - 1)); p--)
;
/* don't erase a leading slash */
- if (p == path && IS_DIR_SEP(*p))
+ if (p == path && IS_DIR_SEP_GTM(*p))
p++;
*p = '\0';
}
@@ -173,7 +173,7 @@ trim_trailing_separator(char *path)
path = skip_drive(path);
p = path + strlen(path);
if (p > path)
- for (p--; p > path && IS_DIR_SEP(*p); p--)
+ for (p--; p > path && IS_DIR_SEP_GTM(*p); p--)
*p = '\0';
}
diff --git a/src/gtm/proxy/proxy_main.c b/src/gtm/proxy/proxy_main.c
index 1dc17e0d86..290556349c 100644
--- a/src/gtm/proxy/proxy_main.c
+++ b/src/gtm/proxy/proxy_main.c
@@ -1674,7 +1674,6 @@ static int
ReadCommand(GTMProxy_ConnectionInfo *conninfo, StringInfo inBuf)
{
int qtype;
- int rv;
int connIdx = conninfo->con_id;
int anyBackup;
int myLocalId;
diff --git a/src/include/access/gtm.h b/src/include/access/gtm.h
index 3a03d3c631..dbd454de45 100644
--- a/src/include/access/gtm.h
+++ b/src/include/access/gtm.h
@@ -57,6 +57,6 @@ extern int CreateSequenceGTM(char *seqname, GTM_Sequence increment,
extern int AlterSequenceGTM(char *seqname, GTM_Sequence increment,
GTM_Sequence minval, GTM_Sequence maxval, GTM_Sequence startval,
GTM_Sequence lastval, bool cycle, bool is_restart);
-extern int DropSequenceGTM(const char *name, GTM_SequenceKeyType type);
+extern int DropSequenceGTM(char *name, GTM_SequenceKeyType type);
extern int RenameSequenceGTM(char *seqname, const char *newseqname);
#endif /* ACCESS_GTM_H */
diff --git a/src/include/pgxc/barrier.h b/src/include/pgxc/barrier.h
index 37b506731c..3ec110ac06 100644
--- a/src/include/pgxc/barrier.h
+++ b/src/include/pgxc/barrier.h
@@ -34,6 +34,10 @@ typedef struct xl_barrier
#define XLOG_BARRIER_CREATE 0x00
+extern void ProcessCreateBarrierPrepare(const char *id);
+extern void ProcessCreateBarrierEnd(const char *id);
+extern void ProcessCreateBarrierExecute(const char *id);
+
extern void RequestBarrier(const char *id, char *completionTag);
extern void barrier_redo(XLogRecPtr lsn, XLogRecord *record);
extern void barrier_desc(StringInfo buf, uint8 xl_info, char *rec);
diff --git a/src/include/pgxc/pgxcnode.h b/src/include/pgxc/pgxcnode.h
index 1a89c84c0f..11ab03eea8 100644
--- a/src/include/pgxc/pgxcnode.h
+++ b/src/include/pgxc/pgxcnode.h
@@ -126,6 +126,11 @@ extern int pgxc_node_send_execute(PGXCNodeHandle * handle, const char *portal, i
extern int pgxc_node_send_close(PGXCNodeHandle * handle, bool is_statement,
const char *name);
extern int pgxc_node_send_sync(PGXCNodeHandle * handle);
+extern int pgxc_node_send_bind(PGXCNodeHandle * handle, const char *portal,
+ const char *statement, int paramlen, char *params);
+extern int pgxc_node_send_parse(PGXCNodeHandle * handle, const char* statement,
+ const char *query, short num_params, Oid *param_types);
+extern int pgxc_node_send_flush(PGXCNodeHandle * handle);
extern int pgxc_node_send_query_extended(PGXCNodeHandle *handle, const char *query,
const char *statement, const char *portal,
int num_params, Oid *param_types,
diff --git a/src/include/pgxc/planner.h b/src/include/pgxc/planner.h
index efba3c4e09..1c82d85e09 100644
--- a/src/include/pgxc/planner.h
+++ b/src/include/pgxc/planner.h
@@ -101,7 +101,7 @@ typedef struct
char *statement; /* if specified use it as a PreparedStatement name on data nodes */
char *cursor; /* if specified use it as a Portal name on data nodes */
int num_params; /* number of parameters specified for Prepared statement */
- const Oid *param_types; /* parameter types, this pointer is shared
+ Oid *param_types; /* parameter types, this pointer is shared
* across all the RemoteQuery nodes in the
* plan. So, don't change this once set.
*/