diff options
| author | Michael P | 2010-12-14 01:09:29 +0000 |
|---|---|---|
| committer | Pavan Deolasee | 2011-05-19 16:45:25 +0000 |
| commit | 70a0cc86dc29fe971fa47718b4eba3b52d1259c3 (patch) | |
| tree | d117b5d1ea1187cf6fc19a5aa16122da30a916f7 /src/include | |
| parent | 688ecc154215357b1ae429dc872286d5bd1812af (diff) | |
Change Protocol connection between PGXC nodes and GTM/GTM-Proxy.
This patch uses several node types to identify what is connecting on GTM
PGXC_NODE_GTM_PROXY
PGXC_NODE_GTM_PROXY_POSTMASTER
PGXC_NODE_COORDINATOR
PGXC_NODE_DATANODE
If a Postmaster gets a connection on GTM, it also identifies itself like this.
This is a prerequisite for Node and Proxy registration on GTM.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/gtm/gtm.h | 4 | ||||
| -rw-r--r-- | src/include/gtm/gtm_c.h | 21 | ||||
| -rw-r--r-- | src/include/gtm/gtm_txn.h | 4 | ||||
| -rw-r--r-- | src/include/gtm/libpq-be.h | 5 | ||||
| -rw-r--r-- | src/include/gtm/libpq-int.h | 8 |
5 files changed, 26 insertions, 16 deletions
diff --git a/src/include/gtm/gtm.h b/src/include/gtm/gtm.h index 37e23a7ffa..77522b249a 100644 --- a/src/include/gtm/gtm.h +++ b/src/include/gtm/gtm.h @@ -131,10 +131,6 @@ extern MemoryContext TopMostMemoryContext; #if 0 -/* Coordinator registration */ -int GTM_RegisterCoordinator(GTM_CoordInfo *cinfo); -int GTM_UnregisterCoordinator(GTM_CoordinatorId cid); - #endif #endif diff --git a/src/include/gtm/gtm_c.h b/src/include/gtm/gtm_c.h index e8b9984721..f918592101 100644 --- a/src/include/gtm/gtm_c.h +++ b/src/include/gtm/gtm_c.h @@ -36,14 +36,26 @@ typedef uint32 GlobalTransactionId; /* 32-bit global transaction ids */ typedef uint32 PGXC_NodeId; -typedef uint32 GTM_CoordinatorId; typedef int16 GTMProxy_ConnID; -typedef uint32 GTM_GIDLen; +typedef uint32 GTM_StrLen; #define InvalidGTMProxyConnID -1 typedef pthread_t GTM_ThreadID; +typedef uint32 GTM_PGXCNodeId; +typedef uint32 GTM_PGXCNodePort; + +/* Possible type of nodes for registration */ +typedef enum GTM_PGXCNodeType +{ + PGXC_NODE_GTM_PROXY, + PGXC_NODE_GTM_PROXY_POSTMASTER, /* Used by Proxy to communicate with GTM and not use Proxy headers */ + PGXC_NODE_COORDINATOR, + PGXC_NODE_DATANODE, + PGXC_NODE_DEFAULT /* In case nothing is associated to connection */ +} GTM_PGXCNodeType; + /* * A unique handle to identify transaction at the GTM. It could just be * an index in an array or a pointer to the structure @@ -105,8 +117,9 @@ typedef struct GTM_SnapshotData typedef GTM_SnapshotData *GTM_Snapshot; typedef struct GTM_StartupPacket { - GTM_CoordinatorId sp_cid; - bool sp_isproxy; + GTM_PGXCNodeId sp_cid; + GTM_PGXCNodeType sp_remotetype; + bool sp_ispostmaster; } GTM_StartupPacket; #define InvalidGlobalTransactionId ((GlobalTransactionId) 0) diff --git a/src/include/gtm/gtm_txn.h b/src/include/gtm/gtm_txn.h index c883612e64..47444c6d4c 100644 --- a/src/include/gtm/gtm_txn.h +++ b/src/include/gtm/gtm_txn.h @@ -183,10 +183,10 @@ GTM_TransactionHandle GTM_GIDToHandle(char *gid); /* Transaction Control */ void GTM_InitTxnManager(void); -GTM_TransactionHandle GTM_BeginTransaction(GTM_CoordinatorId coord_id, +GTM_TransactionHandle GTM_BeginTransaction(GTM_PGXCNodeId pgxc_node_id, GTM_IsolationLevel isolevel, bool readonly); -int GTM_BeginTransactionMulti(GTM_CoordinatorId coord_id, +int GTM_BeginTransactionMulti(GTM_PGXCNodeId pgxc_node_id, GTM_IsolationLevel isolevel[], bool readonly[], GTMProxy_ConnID connid[], diff --git a/src/include/gtm/libpq-be.h b/src/include/gtm/libpq-be.h index 0a795def67..f8036fe7bc 100644 --- a/src/include/gtm/libpq-be.h +++ b/src/include/gtm/libpq-be.h @@ -47,8 +47,9 @@ typedef struct Port GTMProxy_ConnID conn_id; /* RequestID of this command */ - GTM_CoordinatorId coordinator_id; /* Coordinator ID */ - bool is_proxy; /* Is this a connection from GTM proxy ? */ + GTM_PGXCNodeType remote_type; /* Type of remote connection */ + GTM_PGXCNodeId pgxc_node_id; /* Coordinator ID */ + bool is_postmaster; /* Is remote a node postmaster? */ #define PQ_BUFFER_SIZE 8192 char PqSendBuffer[PQ_BUFFER_SIZE]; diff --git a/src/include/gtm/libpq-int.h b/src/include/gtm/libpq-int.h index 5956de8ff2..557a441d0f 100644 --- a/src/include/gtm/libpq-int.h +++ b/src/include/gtm/libpq-int.h @@ -42,9 +42,9 @@ struct gtm_conn * over above. */ char *pgport; /* the server's communication port */ char *connect_timeout; /* connection timeout (numeric string) */ - char *coordinator_id; /* coordinator id */ - int is_proxy; /* is this a connection to/from a proxy ? */ - + char *pgxc_node_id; /* PGXC Node id */ + int remote_type; /* is this a connection to/from a proxy ? */ + int is_postmaster; /* is this connection to/from a postmaster instance */ /* Optional file to write trace info to */ FILE *Pfdebug; @@ -121,7 +121,7 @@ extern int gtmpqWriteReady(GTM_Conn *conn); */ GTM_Result * GTMPQgetResult(GTM_Conn *conn); extern int gtmpqGetError(GTM_Conn *conn, GTM_Result *result); -void gtmpqFreeResultData(GTM_Result *result, bool is_proxy); +void gtmpqFreeResultData(GTM_Result *result, GTM_PGXCNodeType remote_type); #define SOCK_ERRNO errno #define SOCK_ERRNO_SET(e) (errno = (e)) |
