1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-23 09:10:43 +00:00

Update to 1.0.6cv14.

This commit is contained in:
Jun Kuriyama 2004-05-13 15:27:47 +00:00
parent f8b245304c
commit 69579148d8
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=109073
6 changed files with 65 additions and 222 deletions

View File

@ -5,7 +5,7 @@
# $FreeBSD$
PORTNAME= pgcluster
PORTVERSION= 1.0.6c.a13
PORTVERSION= 1.0.6c.a14
CATEGORIES= databases
MASTER_SITES= ${MASTER_SITE_PGSQL}
MASTER_SITE_SUBDIR= v${BASEPGSQL}

View File

@ -1,4 +1,4 @@
MD5 (postgresql/postgresql-base-7.3.4.tar.gz) = 2b8600cc0f0c2d80271b533c394c886b
SIZE (postgresql/postgresql-base-7.3.4.tar.gz) = 7137288
MD5 (postgresql/pgcluster-1.0.6c.a13-patch.tar.gz) = 298e8510ecf293b7f3d7c91da46705a4
SIZE (postgresql/pgcluster-1.0.6c.a13-patch.tar.gz) = 197987
MD5 (postgresql/pgcluster-1.0.6c.a14-patch.tar.gz) = e4edd9b86f43a51929e826804830efd5
SIZE (postgresql/pgcluster-1.0.6c.a14-patch.tar.gz) = 207961

View File

@ -1,6 +1,6 @@
--- src/backend/libpq/replicate.c 17 Apr 2004 14:41:22 -0000 1.1.1.11
+++ src/backend/libpq/replicate.c 17 Apr 2004 14:44:29 -0000 1.6
@@ -635,6 +635,7 @@
--- src/backend/libpq/replicate.c 9 May 2004 11:21:32 -0000 1.1.1.12
+++ src/backend/libpq/replicate.c 9 May 2004 11:51:34 -0000 1.7
@@ -637,6 +637,7 @@
return NULL;
}
sock = get_replicate_server_socket( sp , socket_type);
@ -8,11 +8,10 @@
if (sock < 0)
{
if (Debug_pretty_print)
@@ -2067,6 +2068,30 @@
return 1;
}
return 0;
+}
@@ -2183,4 +2184,29 @@
free(result);
return false;
}
+
+extern Datum pgr_current_replicator(PG_FUNCTION_ARGS);
+PG_FUNCTION_INFO_V1(pgr_current_replicator);
@ -36,6 +35,6 @@
+ memcpy(VARDATA(result), buf, len);
+
+ PG_RETURN_TEXT_P(result);
}
+}
+
#endif /* USE_REPLICATION */

View File

@ -1,153 +1,8 @@
--- src/pgcluster/pgrp/main.c 16 Apr 2004 10:17:45 -0000 1.1.1.9
+++ src/pgcluster/pgrp/main.c 16 Apr 2004 10:21:06 -0000 1.6
@@ -156,7 +156,7 @@
char * query;
/* set function name */
- set_function("read_packet");
+ set_function("main::read_packet");
if (header == NULL)
{
@@ -179,7 +179,7 @@
}
if (r == 0)
{
- show_debug("connection closed");
+ show_debug("connection closed (sock=%d, header=%d, read=%d)", sock, header_size, read_size);
return NULL;
}
read_size += r;
@@ -311,18 +311,18 @@
/* set function name */
set_function("replicate_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
@@ -333,8 +333,10 @@
show_debug("useFlag[%d]",ptr->useFlag);
while(ptr->useFlag != DB_TBL_END)
{
+ set_function("replicate_packet_send");
same_host = false;
sem_num = ptr->hostNum;
+ show_debug("loop: cnt=%d, hostNum=%d, hostName=%s, port=%d, recoveryPort=%d, useFlag=%d", loop_cnt++, ptr->hostNum, ptr->hostName, ptr->port, ptr->recoveryPort, ptr->useFlag);
/*
* check the status of the cluster DB
*/
@@ -348,7 +350,7 @@
*/
if (PGRis_master_in_recovery(ptr->hostName, ptr->port) == true)
{
- show_debug("%s skipped\n",ptr->hostName);
+ show_debug("%s skipped",ptr->hostName);
ptr ++;
continue;
}
@@ -371,6 +373,8 @@
{
snprintf(PGR_Result,PGR_MESSAGE_BUFSIZE,"%d,%u,%u", PGR_SET_CURRENT_TIME_FUNC_NO,(unsigned int)ntohl(header->tv.tv_sec),(unsigned int)ntohl(header->tv.tv_usec));
}
+ set_function("replicate_packet_send");
+ show_debug("replicate_packet_send_each_server returns %d (useFlag=%d", rtn, ptr->useFlag);
show_debug("sem_lock[%d]",sem_num);
if (sem_num > 0)
PGRsem_lock(SemID,sem_num);
@@ -483,7 +487,7 @@
ptr ++;
PGR_Response_Inf->current_cluster ++;
- }
+ }
show_debug("replicate_packet_send end");
if (status == STATUS_ABORTED)
{
@@ -525,10 +529,10 @@
set_function("replicate_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
*/
@@ -539,6 +543,8 @@
}
rtn = PGRsend_replicate_packet_to_server( ptr, header,query,PGR_Result);
+ set_function("replicate_packet_send_each_server");
+ show_debug("PGRsend_replicate_packet_to_server() returns %d", rtn);
/*
if ((header->cmdSts == CMD_STS_QUERY ) &&
((header->cmdType == CMD_TYPE_INSERT) ||
@@ -597,7 +603,7 @@
}
send_ptr = PGR_Result;
buf_size = PGR_MESSAGE_BUFSIZE;
- show_debug("%d[%s]",buf_size,send_ptr);
+ show_debug("buf_size=%d[send_ptr=%s]",buf_size,send_ptr);
if (buf_size < 1)
buf_size = 1;
@@ -612,7 +618,7 @@
rtn = select(dest+1, (fd_set *)NULL, &wmask, (fd_set *)NULL, &timeout);
if (rtn && FD_ISSET(dest, &wmask))
{
- show_debug("return_result[%s]",send_ptr);
+ show_debug("select() and FD_ISSET() [send_ptr=%s]",send_ptr);
for (;;)
{
s = send(dest,send_ptr + send_size,buf_size - send_size ,0);
@@ -634,7 +640,7 @@
send_size += s;
if (send_size == buf_size)
{
- show_debug("%d send",send_size);
+ show_debug("%d bytes sent",send_size);
status = STATUS_OK;
if (wait == PGR_WAIT_ANSWER)
{
@@ -682,7 +688,7 @@
rtn = select(dest+1, &rmask, (fd_set *)NULL, (fd_set *)NULL, &timeout);
if (rtn && FD_ISSET(dest, &rmask))
{
- show_debug("read_answer selected");
+ show_debug("read_answer selected (dest=%d)", dest);
answer = NULL;
answer = read_packet(dest,&header);
if (answer == NULL)
@@ -773,6 +779,43 @@
return NULL;
}
--- src/pgcluster/pgrp/main.c 9 May 2004 11:21:36 -0000 1.1.1.10
+++ src/pgcluster/pgrp/main.c 9 May 2004 12:57:57 -0000 1.8
@@ -133,6 +133,43 @@
static void child_wait(SIGNAL_ARGS);
static void usage(void);
+static void
+dump_status(int fd)
@ -189,7 +44,7 @@
/*--------------------------------------------------------------------
* SYMBOL
* replicate_loop()
@@ -811,11 +854,11 @@
@@ -170,11 +207,11 @@
}
if (pid == 0)
{
@ -206,7 +61,7 @@
setpgid(0,pgid);
/* child loop */
@@ -833,20 +876,27 @@
@@ -192,16 +229,23 @@
FD_ZERO(&rmask);
FD_SET(sock,&rmask);
rtn = select(sock+1, &rmask, (fd_set *)NULL, (fd_set *)NULL, &timeout);
@ -218,62 +73,39 @@
- show_debug("replicate_loop selected\n");
+ show_debug("replicate_loop selected (sock=%d)", sock);
query = NULL;
query = read_packet(sock,&header);
query = PGRread_packet(sock,&header);
- if (query == NULL)
+ if (query == NULL && errno != 0)
{
- show_error("session closed");
+ show_error("read_packet failed (errno=%d)", errno);
if (PGR_Cascade == true)
{
PGRupper_session_closed();
}
show_error("session closed");
break;
}
+ if (header.cmdType == 'o') {
+ dump_status(sock);
+ break;
+ }
if (header.cmdSys == CMD_SYS_CASCADE )
if (header.cmdSts == 0)
{
PGR_Cascade = true;
@@ -869,7 +919,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);
RecoveryStatus = PGRget_recovery_status();
PGRcheck_recovered_host();
@@ -965,7 +1015,7 @@
show_error("fopen failed: (%s)",strerror(errno));
return STATUS_ERROR;
break;
@@ -247,7 +291,7 @@
}
- show_debug("%s open ok\n",fname);
+ show_debug("%s open ok",fname);
}
/*
* read configuration file
@@ -1130,7 +1180,7 @@
(LoadBalanceTbl + i)->port = -1;
(LoadBalanceTbl + i)->sock = -1;
}
- memset((LoadBalanceTbl + i),0,sizeof(RecoveryTbl));
+ memset((LoadBalanceTbl + i),0,sizeof(RecoveryTbl)); /* kuriyama: needed? */
PGR_Free_Conf_Data();
/* allocate result buffer of query */
@@ -1219,7 +1269,7 @@
-static void
+void
startup_replication_server(void)
{
ReplicateHeader header;
@@ -301,7 +345,7 @@
{
PGRreplicate_exit(0);
}
- show_debug("replicate main %d port bind OK \n",Port_Number);
+ show_debug("replicate main %d port bind OK",Port_Number);
start_up_replication_server();
@@ -1237,11 +1287,14 @@
/* cascade start up notice */
if (Cascade_Inf->upper != NULL)
@@ -326,11 +370,14 @@
*/
FD_ZERO(&rmask);
FD_SET(fd,&rmask);
@ -290,12 +122,12 @@
/*
* get recovery status.
*/
@@ -1597,12 +1650,12 @@
@@ -685,12 +732,12 @@
if (init_server_tbl(PGR_Data_Path) != STATUS_OK)
if (PGRset_Conf_Data(PGR_Data_Path) != STATUS_OK)
{
- show_debug("init_server_tbl error\n");
+ show_debug("init_server_tbl error");
- show_debug("PGRset_Conf_Data error\n");
+ show_debug("PGRset_Conf_Data error");
PGRreplicate_exit(0);
}
if (PGRinit_recovery() != STATUS_OK)
@ -305,7 +137,7 @@
PGRreplicate_exit(0);
}
pgid = getpgid(0);
@@ -1614,10 +1667,10 @@
@@ -702,10 +749,10 @@
}
if (pid == 0)
{

View File

@ -1,6 +1,6 @@
--- src/pgcluster/pgrp/replicate.c 16 Apr 2004 10:17:45 -0000 1.1.1.9
+++ src/pgcluster/pgrp/replicate.c 16 Apr 2004 10:21:06 -0000 1.5
@@ -141,7 +141,7 @@
--- 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)
{
@ -9,7 +9,7 @@
if ((ptr->useFlag == DB_TBL_USE) &&
(ptr->hostIP == host) &&
(ptr->port == host_ptr->port) &&
@@ -393,6 +393,7 @@
@@ -380,6 +380,7 @@
show_error("insertTransactionTbl failed");
return (TransactionTbl *)NULL;
}
@ -17,7 +17,7 @@
return ptr;
}
@@ -581,8 +582,10 @@
@@ -568,8 +569,10 @@
set_function("PGRadd_HostTbl");
ptr = PGRget_HostTbl(conf_data->hostName, conf_data->port);
@ -28,7 +28,7 @@
PGRset_host_status(ptr,useFlag);
return ptr;
}
@@ -606,6 +609,7 @@
@@ -593,6 +596,7 @@
{
(ptr + 1) -> useFlag = DB_TBL_END;
}
@ -36,7 +36,7 @@
ptr->hostNum = cnt;
memcpy(ptr->hostName,conf_data->hostName,sizeof(ptr->hostName));
ptr->port = conf_data->port;
@@ -624,19 +628,22 @@
@@ -611,19 +615,22 @@
set_function("PGRget_master");
host_tbl = Host_Tbl_Begin;
@ -61,7 +61,7 @@
return (HostTbl *)NULL;
}
@@ -651,6 +658,9 @@
@@ -638,6 +645,9 @@
PGRsem_lock(SemID,SEM_NUM_OF_RECOVERY);
if (Recovery_Status_Inf != (RecoveryStatusInf *)NULL)
{
@ -71,7 +71,7 @@
Recovery_Status_Inf->recovery_status = status;
}
PGRsem_unlock(SemID,SEM_NUM_OF_RECOVERY);
@@ -799,7 +809,7 @@
@@ -786,7 +796,7 @@
{
if (Recovery_Status_Inf->useFlag != DB_TBL_FREE)
{
@ -80,7 +80,7 @@
ptr = PGRadd_HostTbl((HostTbl *)&(Recovery_Status_Inf->target_host),Recovery_Status_Inf->useFlag);
if (ptr == (HostTbl *) NULL)
{
@@ -830,6 +840,8 @@
@@ -817,6 +827,8 @@
if (target != (HostTbl*)NULL)
{
memcpy((HostTbl *)&(Recovery_Status_Inf->target_host),target,sizeof(HostTbl));
@ -89,7 +89,7 @@
PGRset_host_status(target,useFlag);
}
@@ -1027,6 +1039,7 @@
@@ -1032,6 +1044,7 @@
{
return STATUS_ERROR;
}
@ -97,7 +97,7 @@
if (host_ptr->useFlag != status)
{
host_ptr->useFlag = status;
@@ -1251,6 +1264,7 @@
@@ -1257,6 +1270,7 @@
show_debug("send_replicate_packet_to_server query=%s",query);
}
@ -105,7 +105,7 @@
if (conn == NULL)
{
show_error("[%d@%s] may be down",host_ptr->port,host_ptr->hostName);
@@ -1311,7 +1325,7 @@
@@ -1332,7 +1346,7 @@
if (res == NULL)
{
@ -114,7 +114,7 @@
if ( header->cmdSts != CMD_STS_NOTICE )
{
PGRset_host_status(host_ptr,DB_TBL_ERROR);
@@ -1501,6 +1515,7 @@
@@ -1532,6 +1546,7 @@
len = strlen(hostName);
ptr = Host_Tbl_Begin;

View File

@ -0,0 +1,12 @@
--- src/pgcluster/pglb/pool_connection_pool.c 9 May 2004 11:21:36 -0000 1.1.1.4
+++ src/pgcluster/pglb/pool_connection_pool.c 13 May 2004 13:57:23 -0000 1.5
@@ -24,6 +24,9 @@
*/
#include "config.h"
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
#include <sys/socket.h>
#include <sys/un.h>
#ifdef HAVE_NETINET_TCP_H