diff options
author | Pavan Deolasee | 2016-02-17 12:37:21 +0000 |
---|---|---|
committer | Pavan Deolasee | 2016-10-18 09:58:31 +0000 |
commit | e3a034e84f12a8103984205634ccc936d7d8240a (patch) | |
tree | 45dbe44d205ccf3926f31bbc9ab9ec207c8aca2e | |
parent | 653aae1ca78f90f114110e7c1442fa4b10e2034b (diff) |
Fix a few compiler warnings.
-rw-r--r-- | src/backend/access/transam/gtm.c | 2 | ||||
-rw-r--r-- | src/backend/access/transam/transam.c | 1 | ||||
-rw-r--r-- | src/backend/access/transam/xact.c | 1 | ||||
-rw-r--r-- | src/backend/bootstrap/bootstrap.c | 1 | ||||
-rw-r--r-- | src/backend/optimizer/util/pgxcship.c | 2 | ||||
-rw-r--r-- | src/backend/pgxc/pool/execRemote.c | 39 | ||||
-rw-r--r-- | src/backend/pgxc/pool/pgxcnode.c | 2 | ||||
-rw-r--r-- | src/backend/pgxc/squeue/squeue.c | 1 | ||||
-rw-r--r-- | src/backend/postmaster/clustermon.c | 19 | ||||
-rw-r--r-- | src/backend/storage/ipc/ipci.c | 1 | ||||
-rw-r--r-- | src/backend/storage/ipc/procarray.c | 3 | ||||
-rw-r--r-- | src/backend/tcop/postgres.c | 8 | ||||
-rw-r--r-- | src/backend/utils/init/postinit.c | 1 | ||||
-rw-r--r-- | src/gtm/client/gtm_client.c | 8 | ||||
-rw-r--r-- | src/gtm/common/gtm_opt_handler.c | 1 | ||||
-rw-r--r-- | src/gtm/main/gtm_txn.c | 12 | ||||
-rw-r--r-- | src/include/access/gtm.h | 2 | ||||
-rw-r--r-- | src/include/gtm/gtm_client.h | 8 | ||||
-rw-r--r-- | src/include/gtm/gtm_txn.h | 1 | ||||
-rw-r--r-- | src/include/postgres.h | 15 | ||||
-rw-r--r-- | src/include/postmaster/clustermon.h | 7 |
21 files changed, 70 insertions, 65 deletions
diff --git a/src/backend/access/transam/gtm.c b/src/backend/access/transam/gtm.c index 64f39d19ad..210e70b175 100644 --- a/src/backend/access/transam/gtm.c +++ b/src/backend/access/transam/gtm.c @@ -681,7 +681,7 @@ UnregisterGTM(GTM_PGXCNodeType type) * Report BARRIER */ int -ReportBarrierGTM(char *barrier_id) +ReportBarrierGTM(const char *barrier_id) { if (!gtm_backup_barrier) return EINVAL; diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c index 71e3015d37..878a4b768a 100644 --- a/src/backend/access/transam/transam.c +++ b/src/backend/access/transam/transam.c @@ -25,6 +25,7 @@ #include "utils/snapmgr.h" #ifdef PGXC +#include "storage/procarray.h" #include "utils/builtins.h" #endif diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 0b0662bf7d..8ead0c0b9b 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -2464,6 +2464,7 @@ CommitTransaction(void) * durably commit. */ #ifdef XCP + latestXid = InvalidTransactionId; if (!IsConnFromDatanode()) #endif latestXid = RecordTransactionCommit(); diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index d2248df540..06d55d7b64 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -33,6 +33,7 @@ #include "nodes/makefuncs.h" #include "pg_getopt.h" #include "postmaster/bgwriter.h" +#include "postmaster/clustermon.h" #include "postmaster/startup.h" #include "postmaster/walwriter.h" #include "replication/walreceiver.h" diff --git a/src/backend/optimizer/util/pgxcship.c b/src/backend/optimizer/util/pgxcship.c index 5a90dd11af..7b7a4d181b 100644 --- a/src/backend/optimizer/util/pgxcship.c +++ b/src/backend/optimizer/util/pgxcship.c @@ -1454,7 +1454,7 @@ pgxc_find_dist_equijoin_qual(Relids varnos_1, /* If no quals, no equijoin */ if (!quals) - return false; + return NULL; /* * Make a copy of the argument bitmaps, it will be modified by * bms_first_member(). diff --git a/src/backend/pgxc/pool/execRemote.c b/src/backend/pgxc/pool/execRemote.c index 9657ab0157..033182defb 100644 --- a/src/backend/pgxc/pool/execRemote.c +++ b/src/backend/pgxc/pool/execRemote.c @@ -1184,7 +1184,7 @@ FetchTuple(ResponseCombiner *combiner) for (;;) { Datum value = (Datum) 0; - bool isnull; + bool isnull = false; int numnodes; int i; @@ -4139,6 +4139,25 @@ FinishRemotePreparedTransaction(char *prepareGID, bool commit) bool prepared_local = false; /* + * Get the list of nodes involved in this transaction. + * + * This function returns the GXID of the prepared transaction. It also + * returns a fresh GXID which can be used for running COMMIT PREPARED + * commands on the remote nodes. Both these GXIDs can then be either + * committed or aborted together. + * + * XXX While I understand that we get the prepared and a new GXID with a + * single call, it doesn't look nicer and create confusion. We should + * probably split them into two parts. This is used only for explicit 2PC + * which should not be very common in XC + */ + if (GetGIDDataGTM(prepareGID, &gxid, &prepare_gxid, &nodestring) < 0) + ereport(ERROR, + (errcode(ERRCODE_INTERNAL_ERROR), + errmsg("prepared transaction with identifier \"%s\" does not exist", + prepareGID))); + + /* * Please note that with xc_maintenance_mode = on, COMMIT/ROLLBACK PREPARED will not * propagate to remote nodes. Only GTM status is cleaned up. */ @@ -4158,24 +4177,6 @@ FinishRemotePreparedTransaction(char *prepareGID, bool commit) return false; } - /* - * Get the list of nodes involved in this transaction. - * - * This function returns the GXID of the prepared transaction. It also - * returns a fresh GXID which can be used for running COMMIT PREPARED - * commands on the remote nodes. Both these GXIDs can then be either - * committed or aborted together. - * - * XXX While I understand that we get the prepared and a new GXID with a - * single call, it doesn't look nicer and create confusion. We should - * probably split them into two parts. This is used only for explicit 2PC - * which should not be very common in XC - */ - if (GetGIDDataGTM(prepareGID, &gxid, &prepare_gxid, &nodestring) < 0) - ereport(ERROR, - (errcode(ERRCODE_INTERNAL_ERROR), - errmsg("prepared transaction with identifier \"%s\" does not exist", - prepareGID))); prepared_local = pgxc_node_remote_finish(prepareGID, commit, nodestring, gxid, prepare_gxid); diff --git a/src/backend/pgxc/pool/pgxcnode.c b/src/backend/pgxc/pool/pgxcnode.c index b103403280..f367486720 100644 --- a/src/backend/pgxc/pool/pgxcnode.c +++ b/src/backend/pgxc/pool/pgxcnode.c @@ -525,7 +525,7 @@ retry: if (poll_val == 0) { /* Handle timeout */ - elog(DEBUG1, "timeout %d while waiting for any response from %d connections", timeout_ms,conn_count); + elog(DEBUG1, "timeout %ld while waiting for any response from %d connections", timeout_ms,conn_count); for (i = 0; i < conn_count; i++) connections[i]->state = DN_CONNECTION_STATE_ERROR_FATAL; return NO_ERROR_OCCURED; diff --git a/src/backend/pgxc/squeue/squeue.c b/src/backend/pgxc/squeue/squeue.c index 5ede9d5373..6b96208fa9 100644 --- a/src/backend/pgxc/squeue/squeue.c +++ b/src/backend/pgxc/squeue/squeue.c @@ -1469,7 +1469,6 @@ SharedQueueRelease(const char *sqname) { volatile SQueueSync *sqsync = sq->sq_sync; int i; - char ntype = PGXC_NODE_DATANODE; Assert(sqsync && sqsync->queue == sq); diff --git a/src/backend/postmaster/clustermon.c b/src/backend/postmaster/clustermon.c index e2dda4f7f3..d987aa1eaf 100644 --- a/src/backend/postmaster/clustermon.c +++ b/src/backend/postmaster/clustermon.c @@ -26,6 +26,7 @@ #include <sys/time.h> #include <unistd.h> +#include "access/gtm.h" #include "access/transam.h" #include "access/xact.h" #include "gtm/gtm_c.h" @@ -36,7 +37,9 @@ #include "postmaster/clustermon.h" #include "postmaster/fork_process.h" #include "postmaster/postmaster.h" +#include "storage/ipc.h" #include "storage/proc.h" +#include "storage/procarray.h" #include "storage/spin.h" #include "tcop/tcopprot.h" #include "utils/memutils.h" @@ -49,7 +52,6 @@ static bool am_clustermon = false; /* Flags set by signal handlers */ static volatile sig_atomic_t got_SIGHUP = false; -static volatile sig_atomic_t got_SIGUSR2 = false; static volatile sig_atomic_t got_SIGTERM = false; /* Memory context for long-lived data */ @@ -59,7 +61,6 @@ static ClusterMonitorCtlData *ClusterMonitorCtl = NULL; static void cm_sighup_handler(SIGNAL_ARGS); static void cm_sigterm_handler(SIGNAL_ARGS); static void ClusterMonitorSetReportedGlobalXmin(GlobalTransactionId xmin); -static GlobalTransactionId ClusterMonitorGetReportedGlobalXmin(void); static void ClusterMonitorSetReportingGlobalXmin(GlobalTransactionId xmin); /* PID of clustser monitoring process */ @@ -214,7 +215,7 @@ ClusterMonitorInit(void) { elog(DEBUG1, "Failed (status %d) to report RecentGlobalXmin " "- reported RecentGlobalXmin %d, received " - "RecentGlobalXmin %d, " "received latestCompletedXid", + "RecentGlobalXmin %d, " "received latestCompletedXid %d", status, oldestXmin, newOldestXmin, latestCompletedXid); if (status == GTM_ERRCODE_TOO_OLD_XMIN || @@ -415,18 +416,6 @@ ClusterMonitorSetReportedGlobalXmin(GlobalTransactionId xmin) SpinLockRelease(&ClusterMonitorCtl->mutex); } -static GlobalTransactionId -ClusterMonitorGetReportedGlobalXmin(void) -{ - GlobalTransactionId reported_xmin; - - SpinLockAcquire(&ClusterMonitorCtl->mutex); - reported_xmin = ClusterMonitorCtl->reported_recent_global_xmin; - SpinLockRelease(&ClusterMonitorCtl->mutex); - - return reported_xmin; -} - static void ClusterMonitorSetReportingGlobalXmin(GlobalTransactionId xmin) { diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c index 6804367fa3..e3383e31a2 100644 --- a/src/backend/storage/ipc/ipci.c +++ b/src/backend/storage/ipc/ipci.c @@ -33,6 +33,7 @@ #include "pgxc/nodemgr.h" #endif #include "postmaster/autovacuum.h" +#include "postmaster/clustermon.h" #include "postmaster/bgworker_internals.h" #include "postmaster/bgwriter.h" #include "postmaster/postmaster.h" diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index b7fc75d52d..59826501fd 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -4407,9 +4407,6 @@ ProcArrayCheckXminConsistency(TransactionId global_xmin) void SetLatestCompletedXid(TransactionId latestCompletedXid) { - int index; - ProcArrayStruct *arrayP = procArray; - if (!TransactionIdIsValid(latestCompletedXid)) return; /* diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 99f075c839..8e1b7bfe45 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -33,14 +33,6 @@ #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/time.h> -#include <sys/resource.h> -#endif - -#ifndef HAVE_GETRUSAGE -#include "rusagestub.h" -#endif #include "access/parallel.h" #include "access/printtup.h" diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index e33bc65a89..f5c17fa7cf 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -45,6 +45,7 @@ #include "pgxc/pgxc.h" #endif #include "postmaster/autovacuum.h" +#include "postmaster/clustermon.h" #include "postmaster/postmaster.h" #include "replication/walsender.h" #include "storage/bufmgr.h" diff --git a/src/gtm/client/gtm_client.c b/src/gtm/client/gtm_client.c index be1f6b27cd..fadaa384e5 100644 --- a/src/gtm/client/gtm_client.c +++ b/src/gtm/client/gtm_client.c @@ -422,7 +422,7 @@ send_failed: int bkup_begin_transaction(GTM_Conn *conn, GTM_IsolationLevel isolevel, bool read_only, - char *global_sessionid, + const char *global_sessionid, uint32 client_id, GTM_Timestamp timestamp) { uint32 global_sessionid_len = global_sessionid ? @@ -459,7 +459,7 @@ send_failed: int bkup_begin_transaction_gxid(GTM_Conn *conn, GlobalTransactionId gxid, GTM_IsolationLevel isolevel, bool read_only, - char *global_sessionid, + const char *global_sessionid, uint32 client_id, GTM_Timestamp timestamp) { uint32 global_sessionid_len = global_sessionid ? @@ -495,7 +495,7 @@ send_failed: GlobalTransactionId begin_transaction(GTM_Conn *conn, GTM_IsolationLevel isolevel, - char *global_sessionid, + const char *global_sessionid, GTM_Timestamp *timestamp) { bool txn_read_only = false; @@ -1996,7 +1996,7 @@ int bkup_begin_transaction_multi(GTM_Conn *conn, int txn_count, GlobalTransactionId *gxid, GTM_IsolationLevel *isolevel, bool *read_only, - char *txn_global_sessionid[], + const char *txn_global_sessionid[], uint32 *client_id, GTMProxy_ConnID *txn_connid) { diff --git a/src/gtm/common/gtm_opt_handler.c b/src/gtm/common/gtm_opt_handler.c index 34415ba2c5..533d38ec7e 100644 --- a/src/gtm/common/gtm_opt_handler.c +++ b/src/gtm/common/gtm_opt_handler.c @@ -15,6 +15,7 @@ #include <unistd.h> #include <stdlib.h> +#include "postgres.h" #include "mb/pg_wchar.h" #include "gtm/path.h" #include "gtm/assert.h" diff --git a/src/gtm/main/gtm_txn.c b/src/gtm/main/gtm_txn.c index bc678f9770..18f01832c3 100644 --- a/src/gtm/main/gtm_txn.c +++ b/src/gtm/main/gtm_txn.c @@ -1611,7 +1611,7 @@ ProcessBeginTransactionGetGXIDCommandMulti(Port *myport, StringInfo message) GTM_IsolationLevel txn_isolation_level[GTM_MAX_GLOBAL_TRANSACTIONS]; bool txn_read_only[GTM_MAX_GLOBAL_TRANSACTIONS]; uint32 txn_global_sessionid_len; - char *txn_global_sessionid[GTM_MAX_GLOBAL_TRANSACTIONS]; + const char *txn_global_sessionid[GTM_MAX_GLOBAL_TRANSACTIONS]; int txn_count, new_txn_count; StringInfoData buf; GTM_TransactionHandle txn[GTM_MAX_GLOBAL_TRANSACTIONS]; @@ -1729,7 +1729,7 @@ ProcessBkupBeginTransactionGetGXIDCommandMulti(Port *myport, StringInfo message) GTM_IsolationLevel txn_isolation_level[GTM_MAX_GLOBAL_TRANSACTIONS]; bool txn_read_only[GTM_MAX_GLOBAL_TRANSACTIONS]; uint32 txn_global_sessionid_len; - char *txn_global_sessionid[GTM_MAX_GLOBAL_TRANSACTIONS]; + const char *txn_global_sessionid[GTM_MAX_GLOBAL_TRANSACTIONS]; GTMProxy_ConnID txn_connid[GTM_MAX_GLOBAL_TRANSACTIONS]; uint32 txn_client_id[GTM_MAX_GLOBAL_TRANSACTIONS]; int ii; @@ -1769,7 +1769,7 @@ ProcessCommitTransactionCommand(Port *myport, StringInfo message, bool is_backup MemoryContext oldContext; int status = STATUS_OK; int waited_xid_count; - GlobalTransactionId *waited_xids; + GlobalTransactionId *waited_xids = NULL; const char *data = pq_getmsgbytes(message, sizeof (gxid)); @@ -1783,7 +1783,7 @@ ProcessCommitTransactionCommand(Port *myport, StringInfo message, bool is_backup waited_xid_count = pq_getmsgint(message, sizeof (int)); if (waited_xid_count > 0) { - waited_xids = pq_getmsgbytes(message, + waited_xids = (GlobalTransactionId *) pq_getmsgbytes(message, waited_xid_count * sizeof (GlobalTransactionId)); } @@ -1870,7 +1870,7 @@ ProcessCommitPreparedTransactionCommand(Port *myport, StringInfo message, bool i int status[txn_count]; int ii; int waited_xid_count; - GlobalTransactionId *waited_xids; + GlobalTransactionId *waited_xids = NULL; for (ii = 0; ii < txn_count; ii++) { @@ -1887,7 +1887,7 @@ ProcessCommitPreparedTransactionCommand(Port *myport, StringInfo message, bool i waited_xid_count = pq_getmsgint(message, sizeof (int)); if (waited_xid_count > 0) { - waited_xids = pq_getmsgbytes(message, + waited_xids = (GlobalTransactionId *) pq_getmsgbytes(message, waited_xid_count * sizeof (GlobalTransactionId)); } diff --git a/src/include/access/gtm.h b/src/include/access/gtm.h index 67cea55bd4..bf7c889c66 100644 --- a/src/include/access/gtm.h +++ b/src/include/access/gtm.h @@ -61,7 +61,7 @@ extern int AlterSequenceGTM(char *seqname, GTM_Sequence increment, extern int DropSequenceGTM(char *name, GTM_SequenceKeyType type); extern int RenameSequenceGTM(char *seqname, const char *newseqname); /* Barrier */ -extern int ReportBarrierGTM(char *barrier_id); +extern int ReportBarrierGTM(const char *barrier_id); extern int ReportGlobalXmin(GlobalTransactionId gxid, GlobalTransactionId *global_xmin, GlobalTransactionId *latest_completed_xid); diff --git a/src/include/gtm/gtm_client.h b/src/include/gtm/gtm_client.h index df785e6fa2..ddb092ab48 100644 --- a/src/include/gtm/gtm_client.h +++ b/src/include/gtm/gtm_client.h @@ -185,14 +185,14 @@ size_t get_sequence_list(GTM_Conn *, GTM_SeqInfo **); * Transaction Management API */ GlobalTransactionId begin_transaction(GTM_Conn *conn, GTM_IsolationLevel isolevel, - char *global_sessionid, + const char *global_sessionid, GTM_Timestamp *timestamp); int bkup_begin_transaction(GTM_Conn *conn, GTM_IsolationLevel isolevel, - bool read_only, char *global_sessionid, + bool read_only, const char *global_sessionid, uint32 client_id, GTM_Timestamp timestamp); int bkup_begin_transaction_gxid(GTM_Conn *conn, GlobalTransactionId gxid, GTM_IsolationLevel isolevel, bool read_only, - char *global_sessionid, + const char *global_sessionid, uint32 client_id, GTM_Timestamp timestamp); GlobalTransactionId begin_transaction_autovacuum(GTM_Conn *conn, GTM_IsolationLevel isolevel); @@ -231,7 +231,7 @@ int bkup_begin_transaction_multi(GTM_Conn *conn, int txn_count, GlobalTransactionId *gxid, GTM_IsolationLevel *isolevel, bool *read_only, - char *txn_global_sessionid[], + const char *txn_global_sessionid[], uint32 *client_id, GTMProxy_ConnID *txn_connid); int diff --git a/src/include/gtm/gtm_txn.h b/src/include/gtm/gtm_txn.h index d746105af3..0a7b38b29c 100644 --- a/src/include/gtm/gtm_txn.h +++ b/src/include/gtm/gtm_txn.h @@ -188,6 +188,7 @@ GTM_TransactionStates GTM_GetStatus(GTM_TransactionHandle txn); GTM_TransactionStates GTM_GetStatusGXID(GlobalTransactionId gxid); int GTM_GetAllTransactions(GTM_TransactionInfo txninfo[], uint32 txncnt); void GTM_RemoveAllTransInfos(uint32 client_id, int backend_id); +uint32 GTMGetFirstClientIdentifier(void); uint32 GTMGetLastClientIdentifier(void); GTM_Snapshot GTM_GetSnapshotData(GTM_TransactionInfo *my_txninfo, diff --git a/src/include/postgres.h b/src/include/postgres.h index c0e43643c2..142d781344 100644 --- a/src/include/postgres.h +++ b/src/include/postgres.h @@ -49,6 +49,15 @@ #include "utils/elog.h" #include "utils/palloc.h" +#ifdef HAVE_SYS_RESOURCE_H +#include <sys/time.h> +#include <sys/resource.h> +#endif + +#ifndef HAVE_GETRUSAGE +#include "rusagestub.h" +#endif + /* ---------------------------------------------------------------- * Section 1: variable-length datatypes (TOAST support) * ---------------------------------------------------------------- @@ -723,4 +732,10 @@ extern void ExceptionalCondition(const char *conditionName, //#define PGXC_COORD // for PGXC coordinator compiling //#define PGXC_DATANODE // for PGXC data node compiling + +extern void ResetUsageCommon(struct rusage *save_r, struct timeval *save_t); +extern void ResetUsage(void); +extern void ShowUsageCommon(const char *title, struct rusage *save_r, struct + timeval *save_t); + #endif /* POSTGRES_H */ diff --git a/src/include/postmaster/clustermon.h b/src/include/postmaster/clustermon.h index 2cd0aefc01..953d6787eb 100644 --- a/src/include/postmaster/clustermon.h +++ b/src/include/postmaster/clustermon.h @@ -16,6 +16,8 @@ #ifndef CLUSTERMON_H #define CLUSTERMON_H +#include "gtm/gtm_c.h" + typedef struct { slock_t mutex; @@ -33,7 +35,10 @@ extern bool IsClusterMonitorProcess(void); extern int StartClusterMonitor(void); GlobalTransactionId ClusterMonitorGetGlobalXmin(void); void ClusterMonitorSetGlobalXmin(GlobalTransactionId xmin); -GlobalTransactionId ClusterMonitorGetReportingXmin(void); +extern GlobalTransactionId ClusterMonitorGetReportingGlobalXmin(void); + +Size ClusterMonitorShmemSize(void); +void ClusterMonitorShmemInit(void); #ifdef EXEC_BACKEND extern void ClusterMonitorIAm(void); |