Fix several compiler warnings
authorPavan Deolasee <[email protected]>
Fri, 11 Mar 2016 08:48:50 +0000 (14:18 +0530)
committerPavan Deolasee <[email protected]>
Fri, 11 Mar 2016 08:48:50 +0000 (14:18 +0530)
13 files changed:
src/backend/access/rmgrdesc/barrierdesc.c
src/backend/access/transam/xact.c
src/backend/nodes/equalfuncs.c
src/backend/pgxc/pool/execRemote.c
src/backend/pgxc/pool/pgxcnode.c
src/backend/tcop/postgres.c
src/gtm/client/fe-connect.c
src/gtm/main/gtm_txn.c
src/gtm/proxy/gtm_proxy_opt.c
src/gtm/proxy/proxy_main.c
src/include/gtm/gtm_txn.h
src/include/postmaster/clustermon.h
src/include/utils/builtins.h

index 931fbc4fe0dc36e1debbb8289f95252a5243ea22..f683be390048c252152f4c269d2c2da2a00fee02 100644 (file)
@@ -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);
 }
 
index 2927469fa929c22e8b4f48bdea6277634b5b52af..7986aa75eab75b448c4fc9dfce9b632f855d6aa4 100644 (file)
@@ -3252,7 +3252,9 @@ AbortTransaction(void)
        if (!is_parallel_worker)
        {
 #ifdef XCP
-               if (!IsConnFromDatanode())
+               if (IsConnFromDatanode())
+                       latestXid = InvalidTransactionId;
+               else
 #endif
                        latestXid = RecordTransactionAbort(false);
        }
index 6c4b02fcab66e855558cb2daf81bc63428d12f07..2f698d996690bca17061d4f55abda578221fd6d3 100644 (file)
@@ -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;
index c0d418a3c7222d6d02e4e881075598f87567131a..42abd29171b6ecac31d036196116bdd017604664 100644 (file)
@@ -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
@@ -3332,113 +3332,6 @@ pgxc_start_command_on_connection(PGXCNodeHandle *connection,
        return true;
 }
 
-/*
- * 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 = &params->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 = &params->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
index 579cb4b30ac4c5b405bca7ab0afc12b601ed6ae4..ee8be9b837a280d087c4fda3323de98c2d9b0c65 100644 (file)
@@ -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);
index 1edd77d944d3178d1204fddf7300af779636fe83..581e694d8dc4281e0d2650435f4e92c153cd43c6 100644 (file)
@@ -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;
index d3b6f760f9224280a58f759b43a0e01d2da65d18..58b39007fa8413846e83bbe7fc09dd2a102832a1 100644 (file)
@@ -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;
index 999c06e05ddf948523edaab75fff7c6b925f6c0e..80199073ca1cefdd1a4a4f16917dc791576624e0 100644 (file)
@@ -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);
index 96be9b56fc833c24229f7bbdb16092e0775cb9b1..6a5bd5edd96ad02e8891f7a81f1b7b03106a3045 100644 (file)
@@ -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
  */
index a13e93ddc0856e1b67c48bb4869c4e40fd8259c1..5c0eefb14931279dc13aff4e36a7ce8fa7b862a2 100644 (file)
@@ -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)
        {
index 86c7986811381f5ca4b4bea9c0869077095ba1c6..9ed35c6cc809737292eb1c69775e08f31e6eb865 100644 (file)
@@ -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 */
index ca9dc1b304ff14ecf65da9d932c342ec8db3996c..eb5bb84701f15b5cf1a79a1ad16571276a6d38e8 100644 (file)
@@ -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);
index 5b0033cc80e99361b424456585f6a53ab53e9e51..31a9fda1a3074c9acd99ac0a0e511c7e57491690 100644 (file)
@@ -1323,12 +1323,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 */