You can subscribe to this list here.
2010 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
(28) |
Jun
(12) |
Jul
(11) |
Aug
(12) |
Sep
(5) |
Oct
(19) |
Nov
(14) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(18) |
Feb
(30) |
Mar
(115) |
Apr
(89) |
May
(50) |
Jun
(44) |
Jul
(22) |
Aug
(13) |
Sep
(11) |
Oct
(30) |
Nov
(28) |
Dec
(39) |
2012 |
Jan
(38) |
Feb
(18) |
Mar
(43) |
Apr
(91) |
May
(108) |
Jun
(46) |
Jul
(37) |
Aug
(44) |
Sep
(33) |
Oct
(29) |
Nov
(36) |
Dec
(15) |
2013 |
Jan
(35) |
Feb
(611) |
Mar
(5) |
Apr
(55) |
May
(30) |
Jun
(28) |
Jul
(458) |
Aug
(34) |
Sep
(9) |
Oct
(39) |
Nov
(22) |
Dec
(32) |
2014 |
Jan
(16) |
Feb
(16) |
Mar
(42) |
Apr
(179) |
May
(7) |
Jun
(6) |
Jul
(9) |
Aug
|
Sep
(4) |
Oct
|
Nov
(3) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
1
(2) |
2
(3) |
3
|
4
(2) |
5
(3) |
6
(2) |
7
(8) |
8
(12) |
9
|
10
|
11
(17) |
12
(16) |
13
(4) |
14
(3) |
15
(5) |
16
|
17
|
18
(1) |
19
(3) |
20
(2) |
21
(1) |
22
(1) |
23
|
24
|
25
(3) |
26
(1) |
27
|
28
|
29
|
30
|
From: Koichi S. <koi...@us...> - 2011-04-26 06:36:55
|
Project "Postgres-XC". The branch, ha_support has been updated via ea7e9f087bfa99445cfc1efbce6f440b534023ac (commit) via 912be1eaccf2cc1e85409926efed836674bf4b80 (commit) from 2974169569091d02a67feaf2b5dcc93b575965e5 (commit) - Log ----------------------------------------------------------------- commit ea7e9f087bfa99445cfc1efbce6f440b534023ac Author: Koichi Suzuki <koi...@gm...> Date: Tue Apr 26 15:31:04 2011 +0900 This commit is to fix GTM-Proxy problems in registering nodes. Fixed files are as follows: src/gtm/client/gtm_client.c src/gtm/proxy/proxy_main.c src/gtm/recovery/register.c src/include/gtm/gtm_proxy.h The cause of the problem was message format mismatch in GTM-Proxy. MSG_NODE_REGISTER was not handled properly. I collected the order of the values and added missing information both when parsing incoming messge from clients and constructing outgoing message to GTM. This is needed before adding "reconnect" feature to GTM-Standby. diff --git a/src/gtm/client/gtm_client.c b/src/gtm/client/gtm_client.c index fe1a4e8..f22ebe4 100644 --- a/src/gtm/client/gtm_client.c +++ b/src/gtm/client/gtm_client.c @@ -1185,6 +1185,8 @@ node_get_local_addr(GTM_Conn *conn, char *buf, size_t buflen, int *rc) char remote_host[NI_MAXHOST]; char remote_port[NI_MAXSERV]; + *rc = 0; + memset(remote_host, 0, sizeof(remote_host)); memset(remote_port, 0, sizeof(remote_port)); memset(buf, 0, buflen); @@ -1238,15 +1240,25 @@ int node_register2(GTM_Conn *conn, GTM_PGXCNodeType type, const char *host, GTM GTM_PGXCNodeId proxynum = 0; if (gtmpqPutMsgStart('C', true, conn) || + /* Message Type */ gtmpqPutInt(MSG_NODE_REGISTER, sizeof (GTM_MessageType), conn) || + /* Node Type to Register */ gtmpqPutnchar((char *)&type, sizeof(GTM_PGXCNodeType), conn) || + /* Node Number to Register */ gtmpqPutnchar((char *)&nodenum, sizeof(GTM_PGXCNodeId), conn) || + /* Host name length */ gtmpqPutInt(strlen(host), sizeof (GTM_StrLen), conn) || + /* Host name (var-len) */ gtmpqPutnchar(host, strlen(host), conn) || + /* Port number */ gtmpqPutnchar((char *)&port, sizeof(GTM_PGXCNodePort), conn) || + /* Proxy ID (zero if connected to GTM directly) */ gtmpqPutnchar((char *)&proxynum, sizeof(GTM_PGXCNodeId), conn) || + /* Data Folder length */ gtmpqPutInt(strlen(datafolder), sizeof (GTM_StrLen), conn) || + /* Data Folder (var-len) */ gtmpqPutnchar(datafolder, strlen(datafolder), conn) || + /* Node Status */ gtmpqPutInt(status, sizeof(GTM_PGXCNodeStatus), conn)) goto send_failed; diff --git a/src/gtm/proxy/proxy_main.c b/src/gtm/proxy/proxy_main.c index 9e917ee..4ab6f94 100644 --- a/src/gtm/proxy/proxy_main.c +++ b/src/gtm/proxy/proxy_main.c @@ -1333,6 +1333,15 @@ ProcessPGXCNodeCommand(GTMProxy_ConnectionInfo *conninfo, GTM_Conn *gtm_conn, sizeof (GTM_PGXCNodeType)); memcpy(&cmd_data.cd_reg.nodenum, pq_getmsgbytes(message, sizeof (GTM_PGXCNodeId)), sizeof (GTM_PGXCNodeId)); + /* + * Now we have to waste the following host information. It is taken from + * the address field in the conn. + */ + len = pq_getmsgint(message, sizeof(GTM_StrLen)); + pq_getmsgbytes(message, len); + /* + * Then the next is the port number. + */ memcpy(&cmd_data.cd_reg.port, pq_getmsgbytes(message, sizeof (GTM_PGXCNodePort)), sizeof (GTM_PGXCNodePort)); memcpy(&cmd_data.cd_reg.proxynum, pq_getmsgbytes(message, sizeof (GTM_PGXCNodeId)), @@ -1340,6 +1349,11 @@ ProcessPGXCNodeCommand(GTMProxy_ConnectionInfo *conninfo, GTM_Conn *gtm_conn, len = pq_getmsgint(message, sizeof (int)); cmd_data.cd_reg.datafolder = (char *)pq_getmsgbytes(message, len); + + /* + * Now we have one more data to waste, "status" + */ + cmd_data.cd_reg.status = pq_getmsgint(message, sizeof(GTM_PGXCNodeStatus)); pq_getmsgend(message); /* Copy also remote host address in data to be proxied */ @@ -1586,16 +1600,29 @@ static void GTMProxy_ProxyPGXCNodeCommand(GTMProxy_ConnectionInfo *conninfo,GTM_ case MSG_NODE_REGISTER: /* Rebuild the message */ if (gtmpqPutMsgStart('C', true, gtm_conn) || + /* GTM Proxy Header */ gtmpqPutnchar((char *)&proxyhdr, sizeof (GTM_ProxyMsgHeader), gtm_conn) || + /* Message Type */ gtmpqPutInt(MSG_NODE_REGISTER, sizeof (GTM_MessageType), gtm_conn) || + /* Node Type to Register */ gtmpqPutnchar((char *)&cmd_data.cd_reg.type, sizeof(GTM_PGXCNodeType), gtm_conn) || + /* Node Number to Register */ gtmpqPutnchar((char *)&cmd_data.cd_reg.nodenum, sizeof(GTM_PGXCNodeId), gtm_conn) || - gtmpqPutnchar((char *)&cmd_data.cd_reg.port, sizeof(GTM_PGXCNodePort), gtm_conn) || - gtmpqPutnchar((char *)>MProxyID, sizeof(GTM_PGXCNodeId), gtm_conn) || + /* Host Name (length) */ gtmpqPutInt(strlen(cmd_data.cd_reg.ipaddress), sizeof (GTM_StrLen), gtm_conn) || + /* Host Name (var-len) */ gtmpqPutnchar(cmd_data.cd_reg.ipaddress, strlen(cmd_data.cd_reg.ipaddress), gtm_conn) || + /* Port Number */ + gtmpqPutnchar((char *)&cmd_data.cd_reg.port, sizeof(GTM_PGXCNodePort), gtm_conn) || + /* Proxy ID (zero if connected to GTM directly) */ + gtmpqPutnchar((char *)>MProxyID, sizeof(GTM_PGXCNodeId), gtm_conn) || + /* Data Folder length */ gtmpqPutInt(strlen(cmd_data.cd_reg.datafolder), 4, gtm_conn) || - gtmpqPutnchar(cmd_data.cd_reg.datafolder, strlen(cmd_data.cd_reg.datafolder), gtm_conn)) + /* Data folder name (var-len) */ + gtmpqPutnchar(cmd_data.cd_reg.datafolder, strlen(cmd_data.cd_reg.datafolder), gtm_conn) || + /* Node Status */ + gtmpqPutInt(cmd_data.cd_reg.status, sizeof(GTM_PGXCNodeStatus), gtm_conn)) + elog(ERROR, "Error proxing data"); break; diff --git a/src/gtm/recovery/register.c b/src/gtm/recovery/register.c index 5f44425..c5d72d8 100644 --- a/src/gtm/recovery/register.c +++ b/src/gtm/recovery/register.c @@ -35,8 +35,8 @@ #include "gtm/libpq.h" #include "gtm/pqformat.h" #include "gtm/gtm_msg.h" -#include "gtm/gtm_ip.h" #endif +#include "gtm/gtm_ip.h" #define GTM_NODE_FILE "register.node" #define NODE_HASH_TABLE_SIZE 16 @@ -419,7 +419,6 @@ ProcessPGXCNodeRegister(Port *myport, StringInfo message) int strlen; StringInfoData buf; GTM_PGXCNodeStatus status; - size_t hostlen; /* Get the Remote node IP and port to register it */ remote_host[0] = '\0'; @@ -427,7 +426,6 @@ ProcessPGXCNodeRegister(Port *myport, StringInfo message) memset(remote_host, 0, sizeof(remote_host)); -#ifdef NOT_USED if (myport->remote_type != PGXC_NODE_GTM_PROXY) { if (gtm_getnameinfo_all(&myport->raddr.addr, myport->raddr.salen, @@ -445,26 +443,14 @@ ProcessPGXCNodeRegister(Port *myport, StringInfo message) (errmsg_internal("gtm_getnameinfo_all() failed"))); } } -#endif - /* Read Node Type and number */ + /* Read Node Type */ memcpy(&type, pq_getmsgbytes(message, sizeof (GTM_PGXCNodeType)), sizeof (GTM_PGXCNodeType)); + /* Node Number */ memcpy(&nodenum, pq_getmsgbytes(message, sizeof (GTM_PGXCNodeId)), sizeof (GTM_PGXCNodeId)); - /* Read Host Name */ - hostlen = pq_getmsgint(message, sizeof (GTM_StrLen)); - memcpy(remote_host, pq_getmsgbytes(message, hostlen), hostlen); - - /* Read Port Number */ - memcpy(&port, pq_getmsgbytes(message, sizeof (GTM_PGXCNodePort)), - sizeof (GTM_PGXCNodePort)); - - /* Read Proxy ID number (0 if no proxy used) */ - memcpy(&proxynum, pq_getmsgbytes(message, sizeof (GTM_PGXCNodeId)), - sizeof (GTM_PGXCNodeId)); - /* * Message is received from a proxy, get also the remote node address * In the case a proxy registering itself, the remote address @@ -479,12 +465,19 @@ ProcessPGXCNodeRegister(Port *myport, StringInfo message) else ipaddress = remote_host; + /* Read Port Number */ + memcpy(&port, pq_getmsgbytes(message, sizeof (GTM_PGXCNodePort)), + sizeof (GTM_PGXCNodePort)); + + /* Read Proxy ID number (0 if no proxy used) */ + memcpy(&proxynum, pq_getmsgbytes(message, sizeof (GTM_PGXCNodeId)), + sizeof (GTM_PGXCNodeId)); + elog(LOG, "ProcessPGXCNodeRegister: ipaddress = %s", ipaddress); /* * Finish by reading Data Folder (length and then string) */ - strlen = pq_getmsgint(message, sizeof (GTM_StrLen)); datafolder = (char *)pq_getmsgbytes(message, strlen); diff --git a/src/include/gtm/gtm_proxy.h b/src/include/gtm/gtm_proxy.h index 4fcf5f0..2af5ef3 100644 --- a/src/include/gtm/gtm_proxy.h +++ b/src/include/gtm/gtm_proxy.h @@ -173,6 +173,7 @@ typedef union GTMProxy_CommandData GTM_PGXCNodeId proxynum; char *datafolder; char *ipaddress; + GTM_PGXCNodeStatus status; } cd_reg; } GTMProxy_CommandData; commit 912be1eaccf2cc1e85409926efed836674bf4b80 Author: Koichi Suzuki <koi...@gm...> Date: Fri Apr 8 16:32:19 2011 +0900 gtm_ctl.c comment refactoring. diff --git a/src/gtm/gtm_ctl/gtm_ctl.c b/src/gtm/gtm_ctl/gtm_ctl.c index 5092a47..55c11bf 100644 --- a/src/gtm/gtm_ctl/gtm_ctl.c +++ b/src/gtm/gtm_ctl/gtm_ctl.c @@ -618,6 +618,11 @@ do_reconnect(void) exit(1); } read_gtm_opts(); + /* + * Pass reconnect info to GTM-Proxy. + * + * Option arguments are written to newgtm file under -D directory. + */ reconnect_point_file_nam = malloc(strlen(gtm_data) + 8); if (reconnect_point_file_nam == NULL) { @@ -634,14 +639,6 @@ do_reconnect(void) fprintf(reconnect_point_file, "%s", gtm_opts); fclose(reconnect_point_file); free(reconnect_point_file_nam); - /* - * Beofore signaling, we need to set the host and port of the new target GTM. - * - * They should be written to "newgtm" file under -D directory. - * First line is the host name and the second line is port (all in - * text representation). - */ - /* === WIP 20110408 === */ if (kill((pid_t) pid, SIGUSR2) != 0) { write_stderr(_("%s: could not send promote signal (PID: %ld): %s\n"), progname, pid, ----------------------------------------------------------------------- Summary of changes: src/gtm/client/gtm_client.c | 12 ++++++++++++ src/gtm/gtm_ctl/gtm_ctl.c | 13 +++++-------- src/gtm/proxy/proxy_main.c | 33 ++++++++++++++++++++++++++++++--- src/gtm/recovery/register.c | 29 +++++++++++------------------ src/include/gtm/gtm_proxy.h | 1 + 5 files changed, 59 insertions(+), 29 deletions(-) hooks/post-receive -- Postgres-XC |