diff options
author | Pavan Deolasee | 2016-03-11 08:48:50 +0000 |
---|---|---|
committer | Pavan Deolasee | 2016-10-18 10:00:51 +0000 |
commit | 384c674902b961586d9c489c4ec79fe5a80b1ba6 (patch) | |
tree | a08ec2a2dec4eff1c8220b7bd1641d0208590874 | |
parent | efd792e41d087cc465d0e0c4272bdb98764bc003 (diff) |
Fix several compiler warnings
-rw-r--r-- | src/backend/access/rmgrdesc/barrierdesc.c | 3 | ||||
-rw-r--r-- | src/backend/access/transam/xact.c | 4 | ||||
-rw-r--r-- | src/backend/nodes/equalfuncs.c | 2 | ||||
-rw-r--r-- | src/backend/pgxc/pool/execRemote.c | 109 | ||||
-rw-r--r-- | src/backend/pgxc/pool/pgxcnode.c | 4 | ||||
-rw-r--r-- | src/backend/tcop/postgres.c | 2 | ||||
-rw-r--r-- | src/gtm/client/fe-connect.c | 2 | ||||
-rw-r--r-- | src/gtm/main/gtm_txn.c | 2 | ||||
-rw-r--r-- | src/gtm/proxy/gtm_proxy_opt.c | 7 | ||||
-rw-r--r-- | src/gtm/proxy/proxy_main.c | 14 | ||||
-rw-r--r-- | src/include/gtm/gtm_txn.h | 1 | ||||
-rw-r--r-- | src/include/postmaster/clustermon.h | 5 | ||||
-rw-r--r-- | src/include/utils/builtins.h | 2 |
13 files changed, 25 insertions, 132 deletions
diff --git a/src/backend/access/rmgrdesc/barrierdesc.c b/src/backend/access/rmgrdesc/barrierdesc.c index 931fbc4fe0..f683be3900 100644 --- a/src/backend/access/rmgrdesc/barrierdesc.c +++ b/src/backend/access/rmgrdesc/barrierdesc.c @@ -19,9 +19,10 @@ void barrier_desc(StringInfo buf, XLogReaderState *record) { char *rec = XLogRecGetData(record); +#ifdef USE_ASSERT_CHECKING uint8 info = XLogRecGetInfo(record); - Assert(info == XLOG_BARRIER_CREATE); +#endif appendStringInfo(buf, "BARRIER %s", rec); } diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index f3662e767b..dba183c772 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -3238,7 +3238,9 @@ AbortTransaction(void) if (!is_parallel_worker) { #ifdef XCP - if (!IsConnFromDatanode()) + if (IsConnFromDatanode()) + latestXid = InvalidTransactionId; + else #endif latestXid = RecordTransactionAbort(false); } diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c index 73e26b3261..dd33300f91 100644 --- a/src/backend/nodes/equalfuncs.c +++ b/src/backend/nodes/equalfuncs.c @@ -166,7 +166,7 @@ _equalVar(const Var *a, const Var *b) * Compare all fields in Var except varno */ bool -equalVarExceptVarno(const void *a, const void *b) +static equalVarExceptVarno(const void *a, const void *b) { if (a == b) return true; diff --git a/src/backend/pgxc/pool/execRemote.c b/src/backend/pgxc/pool/execRemote.c index ab0a96986c..8171f08912 100644 --- a/src/backend/pgxc/pool/execRemote.c +++ b/src/backend/pgxc/pool/execRemote.c @@ -1946,7 +1946,7 @@ pgxc_node_remote_cleanup_all(void) "RESET transaction_isolation;"; elog(DEBUG5, "pgxc_node_remote_cleanup_all - handles->co_conn_count %d," - "handles->dn_conn_count", handles->co_conn_count, + "handles->dn_conn_count %d", handles->co_conn_count, handles->dn_conn_count); /* * We must handle reader and writer connections both since even a read-only @@ -3333,113 +3333,6 @@ pgxc_start_command_on_connection(PGXCNodeHandle *connection, } /* - * Encode parameter values to format of DataRow message (the same format is - * used in Bind) to prepare for sending down to Datanodes. - * The buffer to store encoded value is palloc'ed and returned as the result - * parameter. Function returns size of the result - */ -int -ParamListToDataRow(ParamListInfo params, char** result) -{ - StringInfoData buf; - uint16 n16; - int i; - int real_num_params = 0; - - /* - * It is necessary to fetch parameters - * before looking at the output value. - */ - for (i = 0; i < params->numParams; i++) - { - ParamExternData *param; - - param = ¶ms->params[i]; - - if (!OidIsValid(param->ptype) && params->paramFetch != NULL) - (*params->paramFetch) (params, i + 1); - - /* - * This is the last parameter found as useful, so we need - * to include all the previous ones to keep silent the remote - * nodes. All the parameters prior to the last usable having no - * type available will be considered as NULL entries. - */ - if (OidIsValid(param->ptype)) - real_num_params = i + 1; - } - - /* - * If there are no parameters available, simply leave. - * This is possible in the case of a query called through SPI - * and using no parameters. - */ - if (real_num_params == 0) - { - *result = NULL; - return 0; - } - - initStringInfo(&buf); - - /* Number of parameter values */ - n16 = htons(real_num_params); - appendBinaryStringInfo(&buf, (char *) &n16, 2); - - /* Parameter values */ - for (i = 0; i < real_num_params; i++) - { - ParamExternData *param = ¶ms->params[i]; - uint32 n32; - - /* - * Parameters with no types are considered as NULL and treated as integer - * The same trick is used for dropped columns for remote DML generation. - */ - if (param->isnull || !OidIsValid(param->ptype)) - { - n32 = htonl(-1); - appendBinaryStringInfo(&buf, (char *) &n32, 4); - } - else - { - Oid typOutput; - bool typIsVarlena; - Datum pval; - char *pstring; - int len; - - /* Get info needed to output the value */ - getTypeOutputInfo(param->ptype, &typOutput, &typIsVarlena); - - /* - * If we have a toasted datum, forcibly detoast it here to avoid - * memory leakage inside the type's output routine. - */ - if (typIsVarlena) - pval = PointerGetDatum(PG_DETOAST_DATUM(param->value)); - else - pval = param->value; - - /* Convert Datum to string */ - pstring = OidOutputFunctionCall(typOutput, pval); - - /* copy data to the buffer */ - len = strlen(pstring); - n32 = htonl(len); - appendBinaryStringInfo(&buf, (char *) &n32, 4); - appendBinaryStringInfo(&buf, pstring, len); - } - } - - /* Take data from the buffer */ - *result = palloc(buf.len); - memcpy(*result, buf.data, buf.len); - pfree(buf.data); - return buf.len; -} - -/* * Execute utility statement on multiple Datanodes * It does approximately the same as * diff --git a/src/backend/pgxc/pool/pgxcnode.c b/src/backend/pgxc/pool/pgxcnode.c index 579cb4b30a..ee8be9b837 100644 --- a/src/backend/pgxc/pool/pgxcnode.c +++ b/src/backend/pgxc/pool/pgxcnode.c @@ -360,7 +360,7 @@ pgxc_node_all_free(void) for (i = 0; i < 2; i++) { - int num_nodes; + int num_nodes = 0; PGXCNodeHandle *array_handles; switch (i) @@ -1181,7 +1181,9 @@ pgxc_node_send_parse(PGXCNodeHandle * handle, const char* statement, /* message length */ int msgLen; int cnt_params; +#ifdef USE_ASSERT_CHECKING size_t old_outEnd = handle->outEnd; +#endif /* if there are parameters, param_types should exist */ Assert(num_params <= 0 || param_types); diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 109114e696..2c816d7ce2 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -753,7 +753,7 @@ ProcessClientWriteInterrupt(bool blocked) * we've seen a COMMIT or ABORT command; when we are in abort state, other * commands are not processed any further than the raw parse stage. */ -List * +static List * pg_parse_query_internal(const char *query_string, List **querysource_list) { List *raw_parsetree_list; diff --git a/src/gtm/client/fe-connect.c b/src/gtm/client/fe-connect.c index d3b6f760f9..58b39007fa 100644 --- a/src/gtm/client/fe-connect.c +++ b/src/gtm/client/fe-connect.c @@ -776,7 +776,7 @@ keep_going: /* We will come back to here until there is "server, but received %d bytes\n", msgLength); - if (gtmpqGetInt(&conn->my_id, 4, conn)) + if (gtmpqGetInt((int *)&conn->my_id, 4, conn)) { /* We'll come back when there is more data */ return PGRES_POLLING_READING; diff --git a/src/gtm/main/gtm_txn.c b/src/gtm/main/gtm_txn.c index 999c06e05d..80199073ca 100644 --- a/src/gtm/main/gtm_txn.c +++ b/src/gtm/main/gtm_txn.c @@ -2009,7 +2009,7 @@ ProcessGetGIDDataTransactionCommand(Port *myport, StringInfo message) { GTM_Conn *oldconn = GetMyThreadInfo->thr_conn->standby; int count = 0; - GTM_Timestamp timestamp; + GTM_Timestamp timestamp = 0; elog(DEBUG1, "calling bkup_begin_transaction_gxid() for auxiliary transaction for standby GTM %p.", GetMyThreadInfo->thr_conn->standby); diff --git a/src/gtm/proxy/gtm_proxy_opt.c b/src/gtm/proxy/gtm_proxy_opt.c index 96be9b56fc..6a5bd5edd9 100644 --- a/src/gtm/proxy/gtm_proxy_opt.c +++ b/src/gtm/proxy/gtm_proxy_opt.c @@ -71,13 +71,6 @@ extern char *GTMConfigFileName; Server_Message_Level_Options(); -static const struct config_enum_entry gtm_startup_mode_options[] = { - {"act", GTM_ACT_MODE, false}, - {"standby", GTM_STANDBY_MODE, false}, - {NULL, 0, false} -}; - - /* * GTM option variables that are exported from this module */ diff --git a/src/gtm/proxy/proxy_main.c b/src/gtm/proxy/proxy_main.c index a13e93ddc0..5c0eefb149 100644 --- a/src/gtm/proxy/proxy_main.c +++ b/src/gtm/proxy/proxy_main.c @@ -178,7 +178,9 @@ static void UnregisterProxy(void); static GTM_Conn *ConnectGTM(void); static void ReleaseCmdBackup(GTMProxy_CommandInfo *cmdinfo); static void workerThreadReconnectToGTM(void); +#ifdef USE_ASSERT_CHECKING static bool IsProxiedMessage(GTM_MessageType mtype); +#endif /* * One-time initialization. It's called immediately after the main process @@ -486,7 +488,7 @@ GTMProxy_SigleHandler(int signal) /* Main thread has nothing to do twith this signal and should not receive this. */ PG_SETMASK(&BlockSig); - elog(DEBUG1, "Detected SIGUSR2, thread:%ld", MyThreadID); + elog(DEBUG1, "Detected SIGUSR2, thread:%ld", (long) MyThreadID); if (MyThreadID == TopMostThreadID) { @@ -1707,6 +1709,7 @@ HandlePostCommand(GTMProxy_ConnectionInfo *conninfo, GTM_Conn *gtm_conn) } +#ifdef USE_ASSERT_CHECKING static bool IsProxiedMessage(GTM_MessageType mtype) { @@ -1742,6 +1745,7 @@ IsProxiedMessage(GTM_MessageType mtype) return false; } } +#endif static void ProcessResponse(GTMProxy_ThreadInfo *thrinfo, GTMProxy_CommandInfo *cmdinfo, @@ -1821,8 +1825,8 @@ ProcessResponse(GTMProxy_ThreadInfo *thrinfo, GTMProxy_CommandInfo *cmdinfo, pq_beginmessage(&buf, 'S'); pq_sendint(&buf, TXN_COMMIT_MULTI_RESULT, 4); - pq_sendbytes(&buf, &txn_count, sizeof (int)); - pq_sendbytes(&buf, &status, sizeof (int)); + pq_sendbytes(&buf, (const char *)&txn_count, sizeof (int)); + pq_sendbytes(&buf, (const char *)&status, sizeof (int)); pq_endmessage(cmdinfo->ci_conn->con_port, &buf); pq_flush(cmdinfo->ci_conn->con_port); } @@ -2121,8 +2125,7 @@ ProcessTransactionCommand(GTMProxy_ConnectionInfo *conninfo, GTM_Conn *gtm_conn, case MSG_TXN_COMMIT_MULTI: { - int txn_count = pq_getmsgint(message, sizeof (int)); - Assert (txn_count == 1); + (void) pq_getmsgint(message, sizeof (int)); } /* fall through */ case MSG_TXN_ROLLBACK: @@ -2959,7 +2962,6 @@ RegisterProxy(bool is_reconnect) char proxyname[] = ""; time_t finish_time; MemoryContext old_mcxt = NULL; - GlobalTransactionId xmin = InvalidGlobalTransactionId; if (is_reconnect) { diff --git a/src/include/gtm/gtm_txn.h b/src/include/gtm/gtm_txn.h index 86c7986811..9ed35c6cc8 100644 --- a/src/include/gtm/gtm_txn.h +++ b/src/include/gtm/gtm_txn.h @@ -48,6 +48,7 @@ extern GlobalTransactionId ReadNewGlobalTransactionId(void); extern GlobalTransactionId GTM_GetLatestCompletedXID(void); extern void SetGlobalTransactionIdLimit(GlobalTransactionId oldest_datfrozenxid); extern void SetNextGlobalTransactionId(GlobalTransactionId gxid); +extern void SetControlXid(GlobalTransactionId gxid); extern void GTM_SetShuttingDown(void); /* For restoration point backup */ diff --git a/src/include/postmaster/clustermon.h b/src/include/postmaster/clustermon.h index ca9dc1b304..eb5bb84701 100644 --- a/src/include/postmaster/clustermon.h +++ b/src/include/postmaster/clustermon.h @@ -35,8 +35,9 @@ extern bool IsClusterMonitorProcess(void); /* Functions to start cluster monitor process, called from postmaster */ int ClusterMonitorInit(void); extern int StartClusterMonitor(void); -GlobalTransactionId ClusterMonitorGetGlobalXmin(void); -void ClusterMonitorSetGlobalXmin(GlobalTransactionId xmin); +extern GlobalTransactionId ClusterMonitorGetGlobalXmin(void); +extern void ClusterMonitorSetGlobalXmin(GlobalTransactionId xmin); +extern GlobalTransactionId ClusterMonitorGetReportingGlobalXmin(void); #ifdef EXEC_BACKEND extern void ClusterMonitorIAm(void); diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index 6d766bddf6..f2b0fb077e 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -1311,12 +1311,10 @@ extern Datum stormdb_promote_standby(PG_FUNCTION_ARGS); extern Datum pgxc_is_committed(PG_FUNCTION_ARGS); extern Datum pgxc_is_inprogress(PG_FUNCTION_ARGS); #endif -#ifdef USE_MODULE_MSGIDS extern Datum pg_msgmodule_set(PG_FUNCTION_ARGS); extern Datum pg_msgmodule_change(PG_FUNCTION_ARGS); extern Datum pg_msgmodule_enable(PG_FUNCTION_ARGS); extern Datum pg_msgmodule_disable(PG_FUNCTION_ARGS); extern Datum pg_msgmodule_enable_all(PG_FUNCTION_ARGS); extern Datum pg_msgmodule_disable_all(PG_FUNCTION_ARGS); -#endif #endif /* BUILTINS_H */ |