summaryrefslogtreecommitdiff
path: root/databases/pgcluster/files/patch-pgrp:replicate.c
diff options
context:
space:
mode:
authorJun Kuriyama <kuriyama@FreeBSD.org>2004-06-25 05:38:30 +0000
committerJun Kuriyama <kuriyama@FreeBSD.org>2004-06-25 05:38:30 +0000
commitfd7debda486f84c0277ea4fb2849f1949e8fcb54 (patch)
treec6b2bc2982c4960aa7f54aa00cc73051fb0fbbd3 /databases/pgcluster/files/patch-pgrp:replicate.c
parentUpdate to 0.5.0. (diff)
Upgrade to 1.0.7 stable release.
Notes
Notes: svn path=/head/; revision=112195
Diffstat (limited to 'databases/pgcluster/files/patch-pgrp:replicate.c')
-rw-r--r--databases/pgcluster/files/patch-pgrp:replicate.c120
1 files changed, 74 insertions, 46 deletions
diff --git a/databases/pgcluster/files/patch-pgrp:replicate.c b/databases/pgcluster/files/patch-pgrp:replicate.c
index acf3bfe47797..8d3c0ae82abb 100644
--- a/databases/pgcluster/files/patch-pgrp:replicate.c
+++ b/databases/pgcluster/files/patch-pgrp:replicate.c
@@ -1,15 +1,6 @@
---- src/pgcluster/pgrp/replicate.c 9 May 2004 11:21:36 -0000 1.1.1.10
-+++ src/pgcluster/pgrp/replicate.c 9 May 2004 11:51:34 -0000 1.6
-@@ -150,7 +150,7 @@
- ptr = Dbserver_Tbl_Begin;
- while (ptr != NULL)
- {
-- show_debug("search host(%d):port(%d):db(%s)",ptr->hostIP,ptr->port,ptr->dbName);
-+ show_debug("search host(%08x):port(%d):db(%s)",ptr->hostIP,ptr->port,ptr->dbName);
- if ((ptr->useFlag == DB_TBL_USE) &&
- (ptr->hostIP == host) &&
- (ptr->port == host_ptr->port) &&
-@@ -380,6 +380,7 @@
+--- src/pgcluster/pgrp/replicate.c.orig Thu Jun 24 22:12:48 2004
++++ src/pgcluster/pgrp/replicate.c Thu Jun 24 22:20:38 2004
+@@ -237,6 +237,7 @@
show_error("insertTransactionTbl failed");
return (TransactionTbl *)NULL;
}
@@ -17,7 +8,7 @@
return ptr;
}
-@@ -568,8 +569,10 @@
+@@ -386,8 +387,10 @@
set_function("PGRadd_HostTbl");
ptr = PGRget_HostTbl(conf_data->hostName, conf_data->port);
@@ -28,7 +19,7 @@
PGRset_host_status(ptr,useFlag);
return ptr;
}
-@@ -593,6 +596,7 @@
+@@ -411,6 +414,7 @@
{
(ptr + 1) -> useFlag = DB_TBL_END;
}
@@ -36,20 +27,13 @@
ptr->hostNum = cnt;
memcpy(ptr->hostName,conf_data->hostName,sizeof(ptr->hostName));
ptr->port = conf_data->port;
-@@ -611,19 +615,22 @@
+@@ -429,14 +433,17 @@
set_function("PGRget_master");
host_tbl = Host_Tbl_Begin;
+ show_debug("start get_master loop");
while(host_tbl->useFlag != DB_TBL_END)
{
-- show_debug("name %s flg %d port %d recoveryPort %d ",
-+ show_debug(" %s:%d flg %d recoveryPort %d",
- host_tbl->hostName,
-- host_tbl->useFlag,
- host_tbl->port,
-+ host_tbl->useFlag,
- host_tbl->recoveryPort);
if (host_tbl->useFlag == DB_TBL_USE)
{
+ show_debug("found master");
@@ -61,7 +45,7 @@
return (HostTbl *)NULL;
}
-@@ -638,6 +645,9 @@
+@@ -451,6 +458,9 @@
PGRsem_lock(SemID,SEM_NUM_OF_RECOVERY);
if (Recovery_Status_Inf != (RecoveryStatusInf *)NULL)
{
@@ -71,16 +55,7 @@
Recovery_Status_Inf->recovery_status = status;
}
PGRsem_unlock(SemID,SEM_NUM_OF_RECOVERY);
-@@ -786,7 +796,7 @@
- {
- if (Recovery_Status_Inf->useFlag != DB_TBL_FREE)
- {
-- show_debug("check recovered host %d",Recovery_Status_Inf->useFlag);
-+ show_debug("check recovered host (useFlag=%d)",Recovery_Status_Inf->useFlag);
- ptr = PGRadd_HostTbl((HostTbl *)&(Recovery_Status_Inf->target_host),Recovery_Status_Inf->useFlag);
- if (ptr == (HostTbl *) NULL)
- {
-@@ -817,6 +827,8 @@
+@@ -629,6 +639,8 @@
if (target != (HostTbl*)NULL)
{
memcpy((HostTbl *)&(Recovery_Status_Inf->target_host),target,sizeof(HostTbl));
@@ -89,7 +64,7 @@
PGRset_host_status(target,useFlag);
}
-@@ -1032,6 +1044,7 @@
+@@ -845,6 +857,7 @@
{
return STATUS_ERROR;
}
@@ -97,24 +72,15 @@
if (host_ptr->useFlag != status)
{
host_ptr->useFlag = status;
-@@ -1257,6 +1270,7 @@
- show_debug("send_replicate_packet_to_server query=%s",query);
+@@ -1028,6 +1041,7 @@
}
+ conn = transaction_tbl->conn;
+ set_function("PGRsend_replicate_packet_to_server");
if (conn == NULL)
{
show_error("[%d@%s] may be down",host_ptr->port,host_ptr->hostName);
-@@ -1332,7 +1346,7 @@
-
- if (res == NULL)
- {
-- show_error("PQexec error ");
-+ show_error("PQexec error");
- if ( header->cmdSts != CMD_STS_NOTICE )
- {
- PGRset_host_status(host_ptr,DB_TBL_ERROR);
-@@ -1532,6 +1546,7 @@
+@@ -1268,6 +1282,7 @@
len = strlen(hostName);
ptr = Host_Tbl_Begin;
@@ -122,3 +88,65 @@
if (len > sizeof(ptr->hostName))
{
len = sizeof(ptr->hostName);
+@@ -1709,7 +1724,7 @@
+ gettimeofday(&tv,NULL);
+ header->tv.tv_sec = htonl(tv.tv_sec);
+ header->tv.tv_usec = htonl(tv.tv_usec);
+- show_debug("query :: %s\n",query);
++ show_debug("query :: %s",query);
+
+ /* save header for logging */
+ if (is_need_sync_time(header) == true)
+@@ -1965,18 +1980,18 @@
+ /* set function name */
+ set_function("PGRreplicate_packet_send");
+
+- show_debug("cmdSts=%c\n",header->cmdSts);
+- show_debug("cmdType=%c\n",header->cmdType);
+- show_debug("port=%d\n",ntohs(header->port));
+- show_debug("pid=%d\n",ntohs(header->pid));
+- show_debug("except_host=%s\n",header->except_host);
+- show_debug("from_host=%s\n",header->from_host);
+- show_debug("dbName=%s\n",header->dbName);
+- show_debug("userName=%s\n",header->userName);
+- show_debug("recieve sec=%u\n",ntohl(header->tv.tv_sec));
+- show_debug("recieve usec=%u\n",ntohl(header->tv.tv_usec));
+- show_debug("query_size=%d\n",ntohl(header->query_size));
+- show_debug("query=%s\n",query);
++ show_debug("cmdSts=%c",header->cmdSts);
++ show_debug("cmdType=%c",header->cmdType);
++ show_debug("port=%d",ntohs(header->port));
++ show_debug("pid=%d",ntohs(header->pid));
++ show_debug("except_host=%s",header->except_host);
++ show_debug("from_host=%s",header->from_host);
++ show_debug("dbName=%s",header->dbName);
++ show_debug("userName=%s",header->userName);
++ show_debug("recieve sec=%u",ntohl(header->tv.tv_sec));
++ show_debug("recieve usec=%u",ntohl(header->tv.tv_usec));
++ show_debug("query_size=%d",ntohl(header->query_size));
++ show_debug("query=%s",query);
+
+ /*
+ * loop while registrated cluster DB exist
+@@ -2004,7 +2019,7 @@
+ */
+ if (is_master_in_recovery(ptr->hostName, ptr->port) == true)
+ {
+- show_debug("%s skipped\n",ptr->hostName);
++ show_debug("%s skipped",ptr->hostName);
+ ptr ++;
+ continue;
+ }
+@@ -2228,10 +2243,10 @@
+ set_function("PGRreplicate_packet_send_each_server");
+
+ host = ptr->hostName;
+- show_debug("except:%d@%s host:%d@%s\n",
++ show_debug("except:%d@%s host:%d@%s",
+ ntohs(header->port),header->except_host,
+ ptr->port,ptr->hostName);
+- show_debug("send replicate to:%s\n",host);
++ show_debug("send replicate to:%s",host);
+ /*
+ * send query to cluster DB
+ */