New commits:
commit 69a3b0643fbf2e99a7dafb6fd1783c495e9b1b9e
Author: George Sherwood <chat AT sourcemage.org>
Commit: George Sherwood <chat AT sourcemage.org>
postgresql: Updated to version 8.2.0. Updated pgcluster patch. Keep
patch as a tar.gz since it is over 2MEG now.
diff --git a/database/postgresql/DETAILS b/database/postgresql/DETAILS
index 08933cf..9528f91 100755
--- a/database/postgresql/DETAILS
+++ b/database/postgresql/DETAILS
@@ -1,6 +1,6 @@
SPELL=postgresql
- VERSION=8.1.5
-
SOURCE_HASH=sha512:26e9756a46c7d604b6ebfbfdadcc191bfed5028df822a4b0a61d7daba476ea3e49d70542f1c3a6f3a8196ae6888be84fb573bfe20d5ac35189646656393c7721
+ VERSION=8.2.0
+
SOURCE_HASH=sha512:c172bf84996cb6c466ba871c28b6b2e9c4e2f06d56a64b1a4289e3e5456170e9481e12d4626b263623c3654878617c1734bec47c21e788a74c2f8e0187b0b51c
SOURCE=$SPELL-$VERSION.tar.bz2
SOURCE_DIRECTORY=$BUILD_DIRECTORY/$SPELL-$VERSION
SOURCE_URI=v$VERSION/$SOURCE
diff --git a/database/postgresql/HISTORY b/database/postgresql/HISTORY
index 825273b..3c8d474 100644
--- a/database/postgresql/HISTORY
+++ b/database/postgresql/HISTORY
@@ -1,3 +1,9 @@
+2006-12-12 George Sherwood <george AT beernabeer.com>
+ * DETAILS: Updated to version 8.2.0.
+ * PRE_BUILD: Updated pgcluster patch. Keep patch as a tarball.
+ * pgcluster-1.5.0rc7-smgl.patch: Removed
+ * pgcluster-1.7.0rc1-patch.tar.gz: Added
+
2006-11-12 Flavien Bridault <vlaaad AT sourcemage.org>
* TRIGGERS: Restored to get the trigger on linux-pam cast, use of
if_depends_enabled
diff --git a/database/postgresql/PRE_BUILD b/database/postgresql/PRE_BUILD
index 05c5e75..86f2b83 100755
--- a/database/postgresql/PRE_BUILD
+++ b/database/postgresql/PRE_BUILD
@@ -2,5 +2,6 @@ create_account postgres &
default_pre_build &&
cd $SOURCE_DIRECTORY &&
if [ "$PGSQL_CLUSTER" = "y" ]; then
- patch -p1 < $SCRIPT_DIRECTORY/pgcluster-1.5.0rc7-smgl-patch
+ tar zxvf $SCRIPT_DIRECTORY/pgcluster-1.7.0rc1-patch.tar.gz &&
+ patch -p1 < $SOURCE_DIRECTORY/pgcluster-1.7.0rc1-patch
fi
diff --git a/database/postgresql/pgcluster-1.5.0rc7-smgl-patch
b/database/postgresql/pgcluster-1.5.0rc7-smgl-patch
deleted file mode 100644
index 9a8f385..0000000
--- a/database/postgresql/pgcluster-1.5.0rc7-smgl-patch
+++ /dev/null
@@ -1,30328 +0,0 @@
-diff -aruN postgresql-8.1.2/GNUmakefile.in pgcluster-1.5.0rc7/GNUmakefile.in
---- postgresql-8.1.2/GNUmakefile.in 2005-05-01 08:15:51.000000000 +0200
-+++ pgcluster-1.5.0rc7/GNUmakefile.in 2006-01-10 17:39:30.000000000 +0100
-@@ -57,13 +57,13 @@
-
- ##########################################################################
-
--distdir := postgresql-$(VERSION)
-+distdir := pgcluster-$(PGCLUSTER_VERSION)
- dummy := =install=
--garbage := =* "#"* ."#"* *~* *.orig *.rej core postgresql-*
-+garbage := =* "#"* ."#"* *~* *.orig *.rej core pgcluster-*
-
- dist: $(distdir).tar.gz
- ifeq ($(split-dist), yes)
--dist: postgresql-base-$(VERSION).tar.gz postgresql-docs-$(VERSION).tar.gz
postgresql-opt-$(VERSION).tar.gz postgresql-test-$(VERSION).tar.gz
-+dist: pgcluster-base-$(PGCLUSTER_VERSION).tar.gz
pgcluster-docs-$(PGCLUSTER_VERSION).tar.gz
pgcluster-opt-$(PGCLUSTER_VERSION).tar.gz
pgcluster-test-$(PGCLUSTER_VERSION).tar.gz
- endif
- dist:
- -rm -rf $(distdir)
-@@ -75,19 +75,19 @@
- src/tools src/tutorial \
- $(addprefix src/pl/, plperl plpython tcl)
-
--docs_files := doc/postgres.tar.gz doc/src doc/TODO.detail
-+docs_files := doc/pgcluster.tar.gz doc/src doc/TODO.detail
-
--postgresql-base-$(VERSION).tar: distdir
-+pgcluster-base-$(PGCLUSTER_VERSION).tar: distdir
- $(TAR) -c $(addprefix --exclude $(distdir)/, $(docs_files)
$(opt_files) src/test) \
- -f $@ $(distdir)
-
--postgresql-docs-$(VERSION).tar: distdir
-+pgcluster-docs-$(PGCLUSTER_VERSION).tar: distdir
- $(TAR) cf $@ $(addprefix $(distdir)/, $(docs_files))
-
--postgresql-opt-$(VERSION).tar: distdir
-+pgcluster-opt-$(PGCLUSTER_VERSION).tar: distdir
- $(TAR) cf $@ $(addprefix $(distdir)/, $(opt_files))
-
--postgresql-test-$(VERSION).tar: distdir
-+pgcluster-test-$(PGCLUSTER_VERSION).tar: distdir
- $(TAR) cf $@ $(distdir)/src/test
-
- distdir:
-diff -aruN postgresql-8.1.2/INSTALL_PGCLUSTER
pgcluster-1.5.0rc7/INSTALL_PGCLUSTER
---- postgresql-8.1.2/INSTALL_PGCLUSTER 1970-01-01 01:00:00.000000000 +0100
-+++ pgcluster-1.5.0rc7/INSTALL_PGCLUSTER 2006-02-09 17:55:54.000000000
+0100
-@@ -0,0 +1,286 @@
-+PGCluster Installation Instructions
-+
-+=============================================================
-+1. Installation
-+=============================================================
-+
-+1-1. Install Cluster DB Server, Replication Server & Load Balancer
-+----------------------------------------------------------------
-+$ cd $source_dir
-+$ ./configure
-+$ gmake
-+$ su
-+# gmake install
-+# chown -R postgres /usr/local/pgsql
-+----------------------------------------------------------------
-+
-+=============================================================
-+2. Initialize DB
-+=============================================================
-+$ su
-+# adduser postgres
-+# mkdir /usr/local/pgsql/data
-+# chown postgres /usr/local/pgsql/data
-+# su - postgres
-+$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
-+
-+
-+=============================================================
-+3. Configuration
-+=============================================================
-+(EX.System Composition)
-+
-+ |
-+ ((Load Balance Server))
-+ ( hostname: lb.hoo.com)
-+ ( receive port:5432 )
-+ ( recovery port:6001 )
-+ |
-+----------+-------------+------------+----------
-+ | |
-+ (( Cluster DB 1 )) (( Cluster DB 2 ))
-+ ( hostname:c1.hoo.com) ( hostname:c2.hoo.com)
-+ ( receive port: 5432 ) ( receive port:5432 )
-+ ( recovery port:7001 ) ( recovery port 7002 )
-+ | |
-+----------+-------------+------------+----------
-+ |
-+ ((Replication Server))
-+ ( hostname:pgr.hoo.com)
-+ ( receive port:8001 )
-+ ( recovery port:8101 )
-+
-+
-+3-1. Load Balance Server
-+
-+The setup file of load balance server is copied from the sample file and
edited.
-+(the sample file is installed '/usr/local/pgsql/share' in default)
-+----------------------------------------------------------------
-+$cd /usr/local/pgsql/share
-+$cp pglb.conf.sample pglb.conf
-+----------------------------------------------------------------
-+
-+In the case of the above system composition example,
-+the setup example of pglb.conf file is as the following
-+
-+#============================================================
-+# Load Balance Server configuration file
-+#-------------------------------------------------------------
-+# file: pglb.conf
-+#-------------------------------------------------------------
-+# This file controls:
-+# o which hosts are db cluster server
-+# o which port use connect to db cluster server
-+# o how many connections are allowed on each DB server
-+#============================================================
-+#-------------------------------------------------------------
-+# set cluster DB server information
-+# o Host_Name : hostname
-+# o Port : connection for postmaster
-+# o Max_Connection : maximun number of connection to postmaster
-+#-------------------------------------------------------------
-+<Cluster_Server_Info>
-+ <Host_Name> c1.hoo.com </Host_Name>
-+ <Port> 5432 </Port>
-+ <Max_Connect> 32 </Max_Connect>
-+</Cluster_Server_Info>
-+<Cluster_Server_Info>
-+ <Host_Name> c2.hoo.com </Host_Name>
-+ <Port> 5432 </Port>
-+ <Max_Connect> 32 </Max_Connect>
-+</Cluster_Server_Info>
-+#-------------------------------------------------------------
-+# set Load Balance server information
-+# o Receive_Port : connection from client
-+# o Recovery_Port : connection for recovery process
-+# o Max_Cluster_Num : maximun number of cluster DB servers
-+# o Use_Connection_Pooling : use connection pool [yes/no]
-+# o Max_Pool_Each_Server : number of pool connections/DB server
-+#-------------------------------------------------------------
-+<Receive_Port> 5432 </Receive_Port>
-+<Recovery_Port> 6001 </Recovery_Port>
-+<Max_Cluster_Num> 128 </Max_Cluster_Num>
-+<Use_Connection_Pooling> yes </Use_Connection_Pooling>
-+<Max_Pool_Each_Server> 1 </Max_Pool_Each_Server>
-+
-+3-2. Cluster DB Server
-+
-+The Cluster DB server need edit two configuration files
-+('pg_hba.conf' and 'cluster.conf').
-+These files are create under the $PG_DATA directory after 'initdb'.
-+
-+A. pg_hba.conf
-+Permission to connect DB via IP connectoins is need for this system.
-+
-+B. cluster.conf
-+In the case of the above system composition example,
-+the setup example of cluster.conf file is as the following
-+
-+#============================================================
-+# Cluster DB Server configuration file
-+#-------------------------------------------------------------
-+# file: cluster.conf
-+#-------------------------------------------------------------
-+# This file controls:
-+# o which hosts & port are replication server
-+# o which port use for replication request to replication server
-+# o which command use for recovery function
-+#
-+#============================================================
-+#-------------------------------------------------------------
-+# set cluster DB server information
-+# o Host_Name : hostname
-+# o Port : connection for postmaster
-+# o Recovery_Port : connection for recovery process
-+#-------------------------------------------------------------
-+<Replicate_Server_Info>
-+ <Host_Name> pgr.hoo.com </Host_Name>
-+ <Port> 8001 </Port>
-+ <Recovery_Port> 8101 </Recovery_Port>
-+</Replicate_Server_Info>
-+#-------------------------------------------------------------
-+# set Cluster DB Server information
-+# o Recovery_Port : connection for recovery
-+# o Rsync_Path : path of rsync command
-+# o Rsync_Option : file transfer option for rsync
-+# o When_Stand_Alone : When all replication servers fell,
-+# you can set up two kinds of permittion,
-+# "real_only" or "read_write".
-+#-------------------------------------------------------------
-+<Recovery_Port> 7001 </Recovery_Port>
-+<Rsync_Path> /usr/bin/rsync </Rsync_Path>
-+<Rsync_Option> ssh -1 </Rsync_Option>
-+<When_Stand_Alone> read_only </When_Stand_Alone>
-+#-------------------------------------------------------------
-+# set partitional replicate control information
-+# set DB name and Table name to stop reprication
-+# o DB_Name : DB name
-+# o Table_Name : table name
-+#-------------------------------------------------------------
-+#<Not_Replicate_Info>
-+# <DB_Name> test_db </DB_Name>
-+# <Table_Name> log_table </Table_Name>
-+#</Not_Replicate_Info>
-+
-+3-3. Replication Server
-+
-+The setup file of replication server is copied from the sample file and
edited.
-+(the sample file is installed '/usr/local/pgsql/share' in default)
-+----------------------------------------------------------------
-+$cd /usr/local/pgsql/share
-+$cp pgreplicate.conf.sample pgreplicate.conf
-+----------------------------------------------------------------
-+In the case of the above system composition example,
-+the setup example of pgreplicate.conf file is as the following
-+
-+#============================================================
-+# PGReplicate configuration file
-+#-------------------------------------------------------------
-+# file: pgreplicate.conf
-+#-------------------------------------------------------------
-+# This file controls:
-+# o which hosts & port are cluster server
-+# o which port use for replication request from cluster server
-+#============================================================
-+#-------------------------------------------------------------
-+# set cluster DB server information
-+# o Host_Name : hostname
-+# o Port : connection for postmaster
-+# o Recovery_Port : connection for recovery
-+#-------------------------------------------------------------
-+<Cluster_Server_Info>
-+ <Host_Name> c1.hoo.com </Host_Name>
-+ <Port> 5432 </Port>
-+ <Recovery_Port> 7001 </Recovery_Port>
-+</Cluster_Server_Info>
-+<Cluster_Server_Info>
-+ <Host_Name> c2.hoo.com </Host_Name>
-+ <Port> 5432 </Port>
-+ <Recovery_Port> 7001 </Recovery_Port>
-+</Cluster_Server_Info>
-+#-------------------------------------------------------------
-+# set Load Balance server information
-+# o Host_Name : hostname
-+# o Recovery_Port : connection for recovery
-+#-------------------------------------------------------------
-+<LoadBalance_Server_Info>
-+ <Host_Name> lb.hoo.com </Host_Name>
-+ <Recovery_Port> 6001 </Recovery_Port>
-+</LoadBalance_Server_Info>
-+#-------------------------------------------------------------
-+# A setup of a replication server
-+#
-+# o Replicate_Port : connection for replication
-+# o Recovery_Port : connection for recovery
-+# o Response_mode : timing which returns a response
-+# normal -- return result of DB which received the query
-+# reliable -- return result after waiting for response of
-+# all Cluster DBs.
-+# o Use_Replication_Log : use replication log
-+# [yes/no]. default : no
-+# o RLOG_Port : connection for replication log
-+#-------------------------------------------------------------
-+<Replication_Port> 8001 </Replication_Port>
-+<Recovery_Port> 8101 </Recovery_Port>
-+<Response_Mode> normal </Response_Mode>
-+<Use_Replication_Log> no </Use_Replication_Log>
-+<RLOG_Port> 8301 </RLOG_Port>
-+
-+=============================================================
-+4. Start Up / Stop
-+=============================================================
-+
-+4-1. replication server
-+
-+A. Start replication server
-+----------------------------------------------------------------
-+$ /usr/local/pgsql/bin/pgreplicate -D /usr/local/pgsql/etc
-+----------------------------------------------------------------
-+
-+B. Stop replication server
-+----------------------------------------------------------------
-+$ /usr/local/pgsql/bin/pgreplicate -D /usr/local/pgsql/etc stop
-+----------------------------------------------------------------
-+
-+usage: pgreplicate [-D path_of_config_file] [-W path_of_work_files] [-U
login us
-+er][-l][-n][-v][-h][stop]
-+ -l: print error logs in the log file.
-+ -n: don't run in daemon mode.
-+ -v: debug mode. need '-n' flag
-+ -h: print this help
-+ stop: stop pgreplicate
-+(config file default path: ./pgreplicate.conf)
-+
-+4-2. cluster DB server
-+$PG_HOME = /usr/local/pgsql
-+$PG_DATA = /usr/local/pgsql/data
-+
-+A. Start cluster DB server
-+----------------------------------------------------------------
-+$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -o "-i" start
-+----------------------------------------------------------------
-+
-+B. Stop cluster DB server
-+----------------------------------------------------------------
-+$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data stop
-+----------------------------------------------------------------
-+
-+4-3. load balance server
-+
-+A. Start load balance server
-+----------------------------------------------------------------
-+$ /usr/local/pgsql/bin/pglb -D /usr/local/pgsql/share
-+----------------------------------------------------------------
-+
-+B. Stop load balance server
-+----------------------------------------------------------------
-+$ /usr/local/pgsql/bin/pglb -D /usr/local/pgsql/share stop
-+----------------------------------------------------------------
-+
-+usage: pglb [-D path_of_config_file] [-W path_of_work_files]
[-n][-v][-h][stop]
-+ -l: print error logs in the log file.
-+ -n: don't run in daemon mode.
-+ -v: debug mode. need '-n' flag
-+ -h: print this help
-+ stop: stop pglb
-+ (config file default path: ./pglb.conf)
-diff -aruN postgresql-8.1.2/README_PGCLUSTER
pgcluster-1.5.0rc7/README_PGCLUSTER
---- postgresql-8.1.2/README_PGCLUSTER 1970-01-01 01:00:00.000000000 +0100
-+++ pgcluster-1.5.0rc7/README_PGCLUSTER 2006-01-10 17:39:32.000000000
+0100
-@@ -0,0 +1,47 @@
-+PGCluster: Multi-Master Synchronous Replication System for PostgreSQL
-+===========================================================
-+
-+PGCluster is a multi-master and synchronous replication system that
supports load balancing of PostgreSQL.
-+
-+Changed:
-+ src/Makefile.global.in
-+ src/backend/Makefile
-+ src/backend/libpq/Makefile
-+ src/backend/access/transam/clog.c
-+ src/backend/access/transam/xact.c
-+ src/backend/catalog/pg_depend.c
-+ src/backend/commands/analyze.c
-+ src/backend/commands/copy.c
-+ src/backend/commands/sequence.c
-+ src/backend/executor/functions.c
-+ src/backend/postmaster/postmaster.c
-+ src/backend/storage/lmgr/lock.c
-+ src/backend/tcop/postgres.c
-+ src/backend/utils/adt/float.c
-+ src/backend/utils/adt/misc.c
-+ src/backend/utils/adt/nabstime.c
-+ src/backend/utils/error/assert.c
-+ src/backend/utils/error/elog.c
-+ src/backend/utils/fmgr/dfmgr.c
-+ src/backend/utils/mb/mbutils.c
-+ src/bin/initdb/initdb.sh
-+
-+Added:
-+ src/include/replicate.h
-+ src/include/replicate_com.h
-+ src/backend/libpq/recovery.c
-+ src/backend/libpq/relicate.c
-+ src/backend/libpq/relicate_com.c
-+ src/backend/libpq/cluster.conf.sample
-+ src/pgcluster/*
-+
-+The latest version of this software may be obtained at
-+http://hiroshima.sraw.co.jp/people/mitani/jpug/pgcluster/en/current/last_night.html
-+<for Japanese>
-+http://hiroshima.sraw.co.jp/people/mitani/jpug/pgcluster/current/last_night.html
-+
-+For more information look at my web
-+site located at
-+http://hiroshima.sraw.co.jp/people/mitani/jpug/pgcluster/en/
-+<for Japanese>
-+http://hiroshima.sraw.co.jp/people/mitani/jpug/pgcluster/
-diff -aruN postgresql-8.1.2/configure pgcluster-1.5.0rc7/configure
---- postgresql-8.1.2/configure 2006-01-05 05:02:18.000000000 +0100
-+++ pgcluster-1.5.0rc7/configure 2006-02-09 17:47:19.000000000 +0100
-@@ -275,6 +275,8 @@
- PACKAGE_STRING='PostgreSQL 8.1.2'
- PACKAGE_BUGREPORT='pgsql-bugs AT postgresql.org'
-
-+PGCLUSTER_VERSION='1.5.0rc7'
-+
- ac_unique_file="src/backend/access/common/heaptuple.c"
- ac_default_prefix=/usr/local/pgsql
- # Factoring default headers for most tests.
-@@ -314,7 +316,7 @@
- # include <unistd.h>
- #endif"
-
--ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME
PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix
program_transform_name bindir sbindir libexecdir datadir sysconfdir
sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir
build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS
configure_args build build_cpu build_vendor build_os host host_cpu
host_vendor host_os PORTNAME docdir enable_nls WANTED_LANGUAGES default_port
enable_shared enable_rpath enable_debug CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC
EXEEXT OBJEXT CPP GCC TAS autodepend INCLUDES enable_thread_safety with_tcl
with_perl with_python with_krb5 krb_srvtab with_pam with_bonjour with_openssl
with_zlib EGREP ELF_SYS LDFLAGS_SL AWK FLEX FLEXFLAGS LN_S LD with_gnu_ld
ld_R_works RANLIB ac_ct_RANLIB LORDER TAR STRIP ac_ct_STRIP STRIP_STATIC_LIB
STRIP_SHARED_LIB YACC YFLAGS PERL perl_archlibexp perl_privlibexp
perl_useshrplib perl_embed_ldflags PYTHON python_version python_configdir
python_includespec python_libdir python_libspec python_additional_libs
HAVE_IPV6 LIBOBJS acx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS
HAVE_POSIX_SIGNALS MSGFMT MSGMERGE XGETTEXT localedir TCLSH TCL_CONFIG_SH
TCL_INCLUDE_SPEC TCL_LIB_FILE TCL_LIBS TCL_LIB_SPEC TCL_SHARED_BUILD
TCL_SHLIB_LD_LIBS NSGMLS JADE have_docbook DOCBOOKSTYLE COLLATEINDEX SGMLSPL
vpath_build LTLIBOBJS'
-+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME
PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix
program_transform_name bindir sbindir libexecdir datadir sysconfdir
sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir
build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS
configure_args build build_cpu build_vendor build_os host host_cpu
host_vendor host_os PORTNAME docdir enable_nls WANTED_LANGUAGES default_port
enable_shared enable_rpath enable_debug CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC
EXEEXT OBJEXT CPP GCC TAS autodepend INCLUDES enable_thread_safety with_tcl
with_perl with_python with_krb5 krb_srvtab with_pam with_bonjour with_openssl
with_zlib EGREP ELF_SYS LDFLAGS_SL AWK FLEX FLEXFLAGS LN_S LD with_gnu_ld
ld_R_works RANLIB ac_ct_RANLIB LORDER TAR STRIP ac_ct_STRIP STRIP_STATIC_LIB
STRIP_SHARED_LIB YACC YFLAGS PERL perl_archlibexp perl_privlibexp
perl_useshrplib perl_embed_ldflags PYTHON python_version python_configdir
python_includespec python_libdir python_libspec python_additional_libs
HAVE_IPV6 LIBOBJS acx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS
HAVE_POSIX_SIGNALS MSGFMT MSGMERGE XGETTEXT localedir TCLSH TCL_CONFIG_SH
TCL_INCLUDE_SPEC TCL_LIB_FILE TCL_LIBS TCL_LIB_SPEC TCL_SHARED_BUILD
TCL_SHLIB_LD_LIBS NSGMLS JADE have_docbook DOCBOOKSTYLE COLLATEINDEX SGMLSPL
vpath_build LTLIBOBJS PGCLUSTER_VERSION'
- ac_subst_files=''
-
- # Initialize some variables set by options.
-@@ -1238,6 +1240,10 @@
- #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
- _ACEOF
-
-+cat >>confdefs.h <<_ACEOF
-+#define PGCLUSTER_VERSION "$PGCLUSTER_VERSION"
-+_ACEOF
-+
-
- # Let the site file select an alternate cache file if it wants to.
- # Prefer explicitly selected file to automatically selected ones.
-@@ -1361,6 +1367,8 @@
-
-
-
-+
-+
- ac_aux_dir=
- for ac_dir in config $srcdir/config; do
- if test -f $ac_dir/install-sh; then
-@@ -23204,6 +23212,7 @@
- s,@host_os@,$host_os,;t t
- s,@PORTNAME@,$PORTNAME,;t t
- s,@docdir@,$docdir,;t t
-+s,@PGCLUSTER_VERSION@,$PGCLUSTER_VERSION,;t t
- s,@enable_nls@,$enable_nls,;t t
- s,@WANTED_LANGUAGES@,$WANTED_LANGUAGES,;t t
- s,@default_port@,$default_port,;t t
-diff -aruN postgresql-8.1.2/configure.in pgcluster-1.5.0rc7/configure.in
---- postgresql-8.1.2/configure.in 2006-01-05 05:02:23.000000000 +0100
-+++ pgcluster-1.5.0rc7/configure.in 2006-01-10 17:39:30.000000000 +0100
-@@ -27,6 +27,7 @@
- AC_SUBST(configure_args, [$ac_configure_args])
-
- AC_DEFINE_UNQUOTED(PG_VERSION, "$PACKAGE_VERSION", [PostgreSQL version])
-+AC_DEFINE_UNQUOTED(PGCLUSTER_VERSION, "$PGCLUSTER_VERSION", [PGCluster
version])
-
- AC_CANONICAL_HOST
-
-diff -aruN postgresql-8.1.2/pgcluster.sh.tmpl
pgcluster-1.5.0rc7/pgcluster.sh.tmpl
---- postgresql-8.1.2/pgcluster.sh.tmpl 1970-01-01 01:00:00.000000000 +0100
-+++ pgcluster-1.5.0rc7/pgcluster.sh.tmpl 2006-01-10 17:39:30.000000000
+0100
-@@ -0,0 +1,56 @@
-+#!/bin/sh
-+#
-+# $FreeBSD: ports/databases/pgcluster/files/pgcluster.sh.tmpl,v 1.1
2004/01/26 09:02:45 kuriyama Exp $
-+#
-+# PROVIDE: pgcluster
-+# REQUIRE: DAEMON
-+# BEFORE: pgreplicate
-+# KEYWORD: FreeBSD
-+#
-+# Add the following line to /etc/rc.conf to enable pgcluster:
-+#
-+# pgcluster_enable="YES"
-+# # optional
-+# pgcluster_data="/home/pgsql/data"
-+# pgcluster_flags="-w -s"
-+#
-+
-+pgcluster_enable="NO"
-+pgcluster_data="%%PREFIX%%/pgsql/data"
-+pgcluster_flags="-w -s"
-+
-+. %%RC_SUBR%%
-+
-+load_rc_config pgcluster
-+
-+name=pgcluster
-+command=%%PREFIX%%/bin/pg_ctl
-+pgcluster_user=pgsql
-+extra_commands="initdb recover"
-+initdb_cmd="pgcluster_initdb"
-+recover_cmd="pgcluster_recover"
-+start_cmd="pgcluster_start"
-+stop_cmd="pgcluster_stop"
-+
-+pgcluster_flags="${pgcluster_flags} -D ${pgcluster_data}"
-+pidfile="${pgcluster_data}/postmaster.pid"
-+
-+pgcluster_start()
-+{
-+ su -m ${pgcluster_user} -c "exec ${command} start ${pgcluster_flags} -o
'-i'"
-+}
-+pgcluster_stop()
-+{
-+ su -m ${pgcluster_user} -c "exec ${command} stop ${pgcluster_flags} -m
i"
-+}
-+pgcluster_recover()
-+{
-+ su -m ${pgcluster_user} -c "exec ${command} start ${pgcluster_flags} -o
'-i -R'"
-+}
-+pgcluster_initdb()
-+{
-+ su -m ${pgcluster_user} -c "exec %%PREFIX%%/bin/initdb -D
${pgcluster_data}"
-+}
-+
-+load_rc_config $name
-+run_rc_command "$1"
-diff -aruN postgresql-8.1.2/src/Makefile pgcluster-1.5.0rc7/src/Makefile
---- postgresql-8.1.2/src/Makefile 2005-01-13 19:23:21.000000000 +0100
-+++ pgcluster-1.5.0rc7/src/Makefile 2006-01-10 17:39:48.000000000 +0100
-@@ -16,14 +16,15 @@
- all install installdirs uninstall dep depend distprep:
- $(MAKE) -C port $@
- $(MAKE) -C timezone $@
-+ $(MAKE) -C interfaces $@
- $(MAKE) -C backend $@
- $(MAKE) -C backend/utils/mb/conversion_procs $@
- $(MAKE) -C include $@
-- $(MAKE) -C interfaces $@
- $(MAKE) -C bin $@
- $(MAKE) -C pl $@
- $(MAKE) -C makefiles $@
- $(MAKE) -C utils $@
-+ $(MAKE) -C pgcluster $@
-
- install: install-local
-
-@@ -44,6 +45,7 @@
- rm -f $(addprefix $(DESTDIR)$(pgxsdir)/$(subdir), Makefile.global
Makefile.port Makefile.shlib nls-global.mk)
-
- clean:
-+ $(MAKE) -C pgcluster $@
- $(MAKE) -C port $@
- $(MAKE) -C timezone $@
- $(MAKE) -C backend $@
-@@ -58,6 +60,7 @@
- $(MAKE) -C tools/thread $@
-
- distclean maintainer-clean:
-+ -$(MAKE) -C pgcluster $@
- -$(MAKE) -C port $@
- -$(MAKE) -C timezone $@
- -$(MAKE) -C backend $@
-diff -aruN postgresql-8.1.2/src/Makefile.global.in
pgcluster-1.5.0rc7/src/Makefile.global.in
---- postgresql-8.1.2/src/Makefile.global.in 2005-09-27 19:39:32.000000000
+0200
-+++ pgcluster-1.5.0rc7/src/Makefile.global.in 2006-01-10 17:39:48.000000000
+0100
-@@ -31,6 +31,9 @@
- # PostgreSQL version number
- VERSION = @PACKAGE_VERSION@
-
-+# PGCluster version number
-+PGCLUSTER_VERSION = @PGCLUSTER_VERSION@
-+
- # Support for VPATH builds
- vpath_build = @vpath_build@
- abs_top_srcdir = @abs_top_srcdir@
-@@ -204,6 +207,7 @@
- GCC = @GCC@
- CFLAGS = @CFLAGS@
-
-+CFLAGS += -DUSE_REPLICATION -DPRINT_DEBUG
- # Kind-of compilers
-
- YACC = @YACC@
-diff -aruN postgresql-8.1.2/src/backend/Makefile
pgcluster-1.5.0rc7/src/backend/Makefile
---- postgresql-8.1.2/src/backend/Makefile 2005-10-27 22:45:29.000000000
+0200
-+++ pgcluster-1.5.0rc7/src/backend/Makefile 2006-01-10 17:39:39.000000000
+0100
-@@ -40,7 +40,7 @@
- ifneq ($(PORTNAME), win32)
- ifneq ($(PORTNAME), aix)
-
--postgres: $(OBJS)
-+postgres: $(OBJS) $(libpq_srcdir)/libpq.a
- $(CC) $(CFLAGS) $(LDFLAGS) $(export_dynamic) $^ $(LIBS) -o $@
-
- endif
-@@ -169,6 +169,7 @@
- $(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample
$(DESTDIR)$(datadir)/pg_ident.conf.sample
- $(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample
$(DESTDIR)$(datadir)/postgresql.conf.sample
- $(INSTALL_DATA) $(srcdir)/access/transam/recovery.conf.sample
$(DESTDIR)$(datadir)/recovery.conf.sample
-+ $(INSTALL_DATA) $(srcdir)/libpq/cluster.conf.sample
$(DESTDIR)$(datadir)/cluster.conf.sample
-
- install-bin: postgres $(POSTGRES_IMP) installdirs
- $(INSTALL_PROGRAM) postgres$(X) $(DESTDIR)$(bindir)/postgres$(X)
-@@ -222,7 +223,8 @@
- rm -f $(DESTDIR)$(datadir)/pg_hba.conf.sample \
- $(DESTDIR)$(datadir)/pg_service.conf.sample \
- $(DESTDIR)$(datadir)/pg_ident.conf.sample \
-- $(DESTDIR)$(datadir)/postgresql.conf.sample
-+ $(DESTDIR)$(datadir)/postgresql.conf.sample \
-+ $(DESTDIR)$(datadir)/cluster.conf.sample
-
-
- ##########################################################################
-diff -aruN postgresql-8.1.2/src/backend/access/transam/xact.c
pgcluster-1.5.0rc7/src/backend/access/transam/xact.c
---- postgresql-8.1.2/src/backend/access/transam/xact.c 2005-11-22
19:23:05.000000000 +0100
-+++ pgcluster-1.5.0rc7/src/backend/access/transam/xact.c 2006-01-10
17:39:38.000000000 +0100
-@@ -46,6 +46,9 @@
- #include "utils/resowner.h"
- #include "pgstat.h"
-
-+#ifdef USE_REPLICATION
-+#include "replicate.h"
-+#endif /* USE_REPLICATION */
-
- /*
- * User-tweakable parameters
-@@ -4280,3 +4283,11 @@
- else
- strcat(buf, "UNKNOWN");
- }
-+
-+#ifdef USE_REPLICATION
-+void
-+PGR_Reload_Start_Time(void)
-+{
-+ xactStartTimestamp = GetCurrentTimestamp();
-+}
-+#endif /* USE_REPLICATION */
-diff -aruN postgresql-8.1.2/src/backend/catalog/catalog.c
pgcluster-1.5.0rc7/src/backend/catalog/catalog.c
---- postgresql-8.1.2/src/backend/catalog/catalog.c 2005-10-15
04:49:12.000000000 +0200
-+++ pgcluster-1.5.0rc7/src/backend/catalog/catalog.c 2006-01-10
17:39:39.000000000 +0100
-@@ -29,6 +29,9 @@
- #include "utils/fmgroids.h"
- #include "utils/relcache.h"
-
-+#ifdef USE_REPLICATION
-+#include "replicate.h"
-+#endif /* USE_REPLICATION */
-
- #define OIDCHARS 10 /* max chars printed by %u */
-
-@@ -293,7 +296,7 @@
- Oid
- GetNewOidWithIndex(Relation relation, Relation indexrel)
- {
-- Oid newOid;
-+ Oid newOid = 0;
- IndexScanDesc scan;
- ScanKeyData key;
- bool collides;
-@@ -301,8 +304,18 @@
- /* Generate new OIDs until we find one not in the table */
- do
- {
-+#ifdef USE_REPLICATION
-+ if (PGR_Is_Sync_OID == true)
-+ {
-+ newOid = PGRGetNewObjectId(newOid);
-+ }
-+ else
-+ {
-+ newOid = GetNewObjectId();
-+ }
-+#else
- newOid = GetNewObjectId();
--
-+#endif /* USE_REPLICATION */
- ScanKeyInit(&key,
- (AttrNumber) 1,
- BTEqualStrategyNumber, F_OIDEQ,
-@@ -386,3 +399,4 @@
-
- return rnode.relNode;
- }
-+
-diff -aruN postgresql-8.1.2/src/backend/commands/analyze.c
pgcluster-1.5.0rc7/src/backend/commands/analyze.c
---- postgresql-8.1.2/src/backend/commands/analyze.c 2005-11-22
19:23:06.000000000 +0100
-+++ pgcluster-1.5.0rc7/src/backend/commands/analyze.c 2006-01-10
17:39:34.000000000 +0100
-@@ -39,6 +39,9 @@
- #include "utils/syscache.h"
- #include "utils/tuplesort.h"
-
-+#ifdef USE_REPLICATION
-+#include "replicate.h"
-+#endif /* USE_REPLICATION */
-
- /* Data structure for Algorithm S from Knuth 3.4.2 */
- typedef struct
-@@ -936,7 +939,11 @@
- /* random() can produce endpoint values, try again if so */
- do
- {
-+#ifdef USE_REPLICATION
-+ z = (long) PGR_Random();
-+#else
- z = random();
-+#endif /* USE_REPLICATION */
- } while (z <= 0 || z >= MAX_RANDOM_VALUE);
- return (double) z / (double) MAX_RANDOM_VALUE;
- }
-diff -aruN postgresql-8.1.2/src/backend/commands/copy.c
pgcluster-1.5.0rc7/src/backend/commands/copy.c
---- postgresql-8.1.2/src/backend/commands/copy.c 2005-12-28
06:38:26.000000000 +0100
-+++ pgcluster-1.5.0rc7/src/backend/commands/copy.c 2006-01-10
17:39:34.000000000 +0100
-@@ -48,6 +48,9 @@
- #include "utils/relcache.h"
- #include "utils/syscache.h"
-
-+#ifdef USE_REPLICATION
-+#include "replicate.h"
-+#endif /* USE_REPLICATION */
-
- #define ISOCTAL(c) (((c) >= '0') && ((c) <= '7'))
- #define OCTVALUE(c) ((c) - '0')
-@@ -421,6 +424,9 @@
- CopyGetData(CopyState cstate, void *databuf, int minread, int maxread)
- {
- int bytesread = 0;
-+#ifdef USE_REPLICATION
-+ char * ptr = (char *)databuf;
-+#endif
-
- switch (cstate->copy_dest)
- {
-@@ -511,6 +517,9 @@
- }
- break;
- }
-+#ifdef USE_REPLICATION
-+ PGR_Set_Copy_Data(PGRCopyData,ptr,bytesread,0);
-+#endif /* USE_REPLICATION */
-
- return bytesread;
- }
-@@ -1921,6 +1930,13 @@
- }
- }
-
-+#ifdef USE_REPLICATION
-+ if (done)
-+ {
-+ PGR_Set_Copy_Data(PGRCopyData,(char *)NULL,0,1);
-+ }
-+#endif /* USE_REPLICATION */
-+
- /* Done, clean up */
- error_context_stack = errcontext.previous;
-
-@@ -2025,6 +2041,11 @@
- break;
- }
- }
-+#ifdef USE_REPLICATION
-+ /*
-+
PGR_Set_Copy_Data(PGRCopyData,cstate->line_buf.data,cstate->line_buf.len,0);
-+ */
-+#endif
-
- /* Done reading the line. Convert it to server encoding. */
- if (cstate->need_transcoding)
-diff -aruN postgresql-8.1.2/src/backend/commands/sequence.c
pgcluster-1.5.0rc7/src/backend/commands/sequence.c
---- postgresql-8.1.2/src/backend/commands/sequence.c 2005-11-22
19:23:07.000000000 +0100
-+++ pgcluster-1.5.0rc7/src/backend/commands/sequence.c 2006-01-10
17:39:34.000000000 +0100
-@@ -26,6 +26,9 @@
- #include "utils/resowner.h"
- #include "utils/syscache.h"
-
-+#ifdef USE_REPLICATION
-+#include "replicate.h"
-+#endif /* USE_REPLICATION */
-
- /*
- * We don't want to log each fetching of a value from a sequence,
-@@ -385,6 +388,9 @@
- RangeVar *sequence;
- Oid relid;
-
-+#ifdef USE_REPLICATION
-+ Xlog_Check_Replicate(CMD_UTILITY);
-+#endif /* USE_REPLICATION */
- sequence = makeRangeVarFromNameList(textToQualifiedNameList(seqin));
- relid = RangeVarGetRelid(sequence, false);
-
-@@ -610,6 +616,10 @@
- SeqTable elm;
- Relation seqrel;
-
-+#ifdef USE_REPLICATION
-+ Xlog_Check_Replicate(CMD_UTILITY);
-+#endif /* USE_REPLICATION */
-+
- /* open and AccessShareLock sequence */
- init_sequence(relid, &elm, &seqrel);
-
-diff -aruN postgresql-8.1.2/src/backend/executor/functions.c
pgcluster-1.5.0rc7/src/backend/executor/functions.c
---- postgresql-8.1.2/src/backend/executor/functions.c 2005-11-22
19:23:08.000000000 +0100
-+++ pgcluster-1.5.0rc7/src/backend/executor/functions.c 2006-01-10
17:39:38.000000000 +0100
-@@ -32,6 +32,9 @@
- #include "utils/syscache.h"
- #include "utils/typcache.h"
-
-+#ifdef USE_REPLICATION
-+#include "replicate.h"
-+#endif /* USE_REPLICATION */
-
- /*
- * We have an execution_state record for each query in a function. Each
-@@ -462,6 +465,13 @@
- Datum value;
- MemoryContext oldcontext;
-
-+#ifdef USE_REPLICATION
-+ if ((es != NULL) && (es->qd != NULL))
-+ {
-+ Xlog_Check_Replicate(es->qd->operation);
-+ }
-+#endif /* USE_REPLICATION */
-+
- if (es->status == F_EXEC_START)
- postquel_start(es, fcache);
-
-diff -aruN postgresql-8.1.2/src/backend/libpq/Makefile
pgcluster-1.5.0rc7/src/backend/libpq/Makefile
---- postgresql-8.1.2/src/backend/libpq/Makefile 2003-11-29
20:51:49.000000000 +0100
-+++ pgcluster-1.5.0rc7/src/backend/libpq/Makefile 2006-01-10
17:39:39.000000000 +0100
-@@ -15,7 +15,8 @@
- # be-fsstubs is here for historical reasons, probably belongs elsewhere
-
- OBJS = be-fsstubs.o be-secure.o auth.o crypt.o hba.o ip.o md5.o pqcomm.o \
-- pqformat.o pqsignal.o
-+ pqformat.o pqsignal.o \
-+ replicate.o replicate_com.o recovery.o
-
-
- all: SUBSYS.o
-diff -aruN postgresql-8.1.2/src/backend/libpq/be-fsstubs.c
pgcluster-1.5.0rc7/src/backend/libpq/be-fsstubs.c
---- postgresql-8.1.2/src/backend/libpq/be-fsstubs.c 2005-11-22
19:23:09.000000000 +0100
-+++ pgcluster-1.5.0rc7/src/backend/libpq/be-fsstubs.c 2006-01-10
17:39:39.000000000 +0100
-@@ -48,6 +48,9 @@
- #include "storage/large_object.h"
- #include "utils/memutils.h"
-
-+#ifdef USE_REPLICATION
-+#include "replicate.h"
-+#endif /* USE_REPLICATION */
-
- /*#define FSDB 1*/
- #define BUFSIZE 8192
-@@ -93,6 +96,19 @@
- int fd;
- MemoryContext currentContext;
-
-+#ifdef USE_REPLICATION
-+ if ((PGR_Stand_Alone != NULL) &&
-+ (PGR_lo_open(lobjId,mode) != STATUS_OK))
-+ {
-+ if ((mode & INV_WRITE) &&
-+ (PGR_Is_Stand_Alone() == true) &&
-+ (PGR_Stand_Alone->permit == PERMIT_READ_ONLY) )
-+ {
-+ elog(WARNING, "This query is not permitted when all
replication servers fell down ");
-+ PG_RETURN_INT32(-1);
-+ }
-+ }
-+#endif /* USE_REPLICATION */
- #if FSDB
- elog(DEBUG4, "lo_open(%u,%d)", lobjId, mode);
- #endif
-@@ -132,6 +148,9 @@
- errmsg("invalid large-object descriptor:
%d", fd)));
- PG_RETURN_INT32(-1);
- }
-+#ifdef USE_REPLICATION
-+ PGR_lo_close(fd);
-+#endif
- #if FSDB
- elog(DEBUG4, "lo_close(%d)", fd);
- #endif
-@@ -201,6 +220,18 @@
- errmsg("large object descriptor %d was not opened
for writing",
- fd)));
-
-+#ifdef USE_REPLICATION
-+ if ((PGR_Stand_Alone != NULL) &&
-+ (PGR_lo_write(fd, buf, len) != STATUS_OK))
-+ {
-+ if ((PGR_Is_Stand_Alone() == true) &&
-+ (PGR_Stand_Alone->permit == PERMIT_READ_ONLY) )
-+ {
-+ elog(WARNING, "This query is not permitted when all
replication servers fell down ");
-+ return -1;
-+ }
-+ }
-+#endif
- Assert(fscxt != NULL);
- currentContext = MemoryContextSwitchTo(fscxt);
-
-@@ -229,6 +260,10 @@
- PG_RETURN_INT32(-1);
- }
-
-+#ifdef USE_REPLICATION
-+ PGR_lo_lseek(fd, offset, whence);
-+#endif /* USE_REPLICATION */
-+
- Assert(fscxt != NULL);
- currentContext = MemoryContextSwitchTo(fscxt);
-
-@@ -250,6 +285,18 @@
-
- currentContext = MemoryContextSwitchTo(fscxt);
-
-+#ifdef USE_REPLICATION
-+ if ((PGR_Stand_Alone != NULL) &&
-+ (PGR_lo_create(InvalidOid) != STATUS_OK))
-+ {
-+ if ((PGR_Is_Stand_Alone() == true) &&
-+ (PGR_Stand_Alone->permit == PERMIT_READ_ONLY) )
-+ {
-+ elog(WARNING, "This query is not permitted when all
replication servers fell down ");
-+ PG_RETURN_INT32(-1);
-+ }
-+ }
-+#endif /* USE_REPLICATION */
- lobjId = inv_create(InvalidOid);
-
- MemoryContextSwitchTo(currentContext);
-@@ -263,6 +310,18 @@
- Oid lobjId = PG_GETARG_OID(0);
- MemoryContext currentContext;
-
-+#ifdef USE_REPLICATION
-+ if ((PGR_Stand_Alone != NULL) &&
-+ (PGR_lo_create(lobjId) != STATUS_OK))
-+ {
-+ if ((PGR_Is_Stand_Alone() == true) &&
-+ (PGR_Stand_Alone->permit == PERMIT_READ_ONLY) )
-+ {
-+ elog(WARNING, "This query is not permitted when all
replication servers fell down ");
-+ PG_RETURN_INT32(-1);
-+ }
-+ }
-+#endif /* USE_REPLICATION */
- /* do we actually need fscxt for this? */
- CreateFSContext();
-
-@@ -300,6 +359,18 @@
- {
- Oid lobjId = PG_GETARG_OID(0);
-
-+#ifdef USE_REPLICATION
-+ if ((PGR_Stand_Alone != NULL) &&
-+ (PGR_lo_unlink(lobjId) != STATUS_OK))
-+ {
-+ if ((PGR_Is_Stand_Alone() == true) &&
-+ (PGR_Stand_Alone->permit == PERMIT_READ_ONLY) )
-+ {
-+ elog(WARNING, "This query is not permitted when all
replication servers fell down ");
-+ return -1;
-+ }
-+ }
-+#endif /* USE_REPLICATION */
- /*
- * If there are any open LO FDs referencing that ID, close 'em.
- */
-@@ -391,6 +462,7 @@
- errhint("Anyone can use the client-side
lo_import() provided by libpq.")));
- #endif
-
-+
- /*
- * We don't actually need to switch into fscxt, but create it anyway
to
- * ensure that AtEOXact_LargeObject knows there is state to clean up
-@@ -405,6 +477,20 @@
- nbytes = MAXPGPATH - 1;
- memcpy(fnamebuf, VARDATA(filename), nbytes);
- fnamebuf[nbytes] = '\0';
-+
-+#ifdef USE_REPLICATION
-+ if ((PGR_Stand_Alone != NULL) &&
-+ (PGR_lo_import((char*)fnamebuf) != STATUS_OK))
-+ {
-+ if ((PGR_Is_Stand_Alone() == true) &&
-+ (PGR_Stand_Alone->permit == PERMIT_READ_ONLY) )
-+ {
-+ elog(WARNING, "This query is not permitted when all
replication servers fell down ");
-+ return -1;
-+ }
-+ }
-+#endif
-+
- fd = PathNameOpenFile(fnamebuf, O_RDONLY | PG_BINARY, 0666);
- if (fd < 0)
- ereport(ERROR,
-diff -aruN postgresql-8.1.2/src/backend/libpq/cluster.conf.sample
pgcluster-1.5.0rc7/src/backend/libpq/cluster.conf.sample
---- postgresql-8.1.2/src/backend/libpq/cluster.conf.sample 1970-01-01
01:00:00.000000000 +0100
-+++ pgcluster-1.5.0rc7/src/backend/libpq/cluster.conf.sample 2006-01-10
17:39:39.000000000 +0100
-@@ -0,0 +1,57 @@
-+#============================================================
-+# Cluster DB Server configuration file
-+#------------------------------------------------------------
-+# file: cluster.conf
-+#------------------------------------------------------------
-+# This file controls:
-+# o which hosts & port are replication server
-+# o which port use for replication request to replication server
-+# o which command use for recovery function
-+#============================================================
-+#------------------------------------------------------------
-+# set Replication Server information
-+# o Host_Name : hostname
-+# o Port : connection for postmaster
-+# o Recovery_Port : connection for recovery process
-+#------------------------------------------------------------
-+<Replicate_Server_Info>
-+ <Host_Name> replicate1.postgres.jp </Host_Name>
-+ <Port> 8001 </Port>
-+ <Recovery_Port> 8101 </Recovery_Port>
-+</Replicate_Server_Info>
-+#<Replicate_Server_Info>
-+# <Host_Name> replicate2.postgres.jp </Host_Name>
-+# <Port> 8002 </Port>
-+# <Recovery_Port> 8102 </Recovery_Port>
-+#</Replicate_Server_Info>
-+#<Replicate_Server_Info>
-+# <Host_Name> replicate3.postgres.jp </Host_Name>
-+# <Port> 8003 </Port>
-+# <Recovery_Port> 8103 </Recovery_Port>
-+#</Replicate_Server_Info>
-+#-------------------------------------------------------------
-+# set Cluster DB Server information
-+# o Recovery_Port : connection for recovery
-+# o Rsync_Path : path of rsync command
-+# o Rsync_Option : file transfer option for rsync
-+# o Rsync_Compress : use compression option for rsync
-+# [yes/no]. default : yes
-+# o When_Stand_Alone : When all replication servers fell,
-+# you can set up two kinds of permittion,
-+# "real_only" or "read_write".
-+#-------------------------------------------------------------
-+<Recovery_Port> 7001 </Recovery_Port>
-+<Rsync_Path> /usr/bin/rsync </Rsync_Path>
-+<Rsync_Option> ssh -1 </Rsync_Option>
-+<Rsync_Compress> yes </Rsync_Compress>
-+<When_Stand_Alone> read_only </When_Stand_Alone>
-+#-------------------------------------------------------------
-+# set partitional replicate control information
-+# set DB name and Table name to stop reprication
-+# o DB_Name : DB name
-+# o Table_Name : table name
-+#-------------------------------------------------------------
-+#<Not_Replicate_Info>
-+# <DB_Name> test_db </DB_Name>
-+# <Table_Name> log_table </Table_Name>
-+#</Not_Replicate_Info>
-diff -aruN postgresql-8.1.2/src/backend/libpq/recovery.c
pgcluster-1.5.0rc7/src/backend/libpq/recovery.c
---- postgresql-8.1.2/src/backend/libpq/recovery.c 1970-01-01
01:00:00.000000000 +0100
-+++ pgcluster-1.5.0rc7/src/backend/libpq/recovery.c 2006-02-08
22:17:50.000000000 +0100
-@@ -0,0 +1,1196 @@
-+/*--------------------------------------------------------------------
-+ * FILE:
-+ * recovery.c
-+ *
-+ * NOTE:
-+ * This file is composed of the functions to call with the source
-+ * at backend for the recovery.
-+ * Low level I/O functions that called by in these functions are
-+ * contained in 'replicate_com.c'.
-+ *
-+ *--------------------------------------------------------------------
-+ */
-+
-+/*--------------------------------------
-+ * INTERFACE ROUTINES
-+ *
-+ * I/O call:
-+ * PGR_recovery_finish_send
-+ * master module:
-+ * PGR_Master_Main(void);
-+ * recovery module:
-+ * PGR_Recovery_Main
-+ *-------------------------------------
-+ */
-+#ifdef USE_REPLICATION
-+
-+#include "postgres.h"
-+
-+#include <stdio.h>
-+#include <unistd.h>
-+#include <signal.h>
-+#include <sys/wait.h>
-+#include <ctype.h>
-+#include <time.h>
-+#include <pwd.h>
-+#include <sys/time.h>
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <sys/socket.h>
-+#include <sys/ipc.h>
-+#include <sys/shm.h>
-+#include <netdb.h>
-+#include <netinet/in.h>
-+#include <errno.h>
-+#include <fcntl.h>
-+#include <time.h>
-+#include <sys/param.h>
-+#include <sys/select.h>
-+#include <netinet/tcp.h>
-+#include <arpa/inet.h>
-+#include <sys/file.h>
-+#include <dirent.h>
-+
-+#include "libpq/pqsignal.h"
-+#include "utils/guc.h"
-+#include "miscadmin.h"
-+#include "nodes/nodes.h"
-+#include "nodes/parsenodes.h"
-+#include "access/xact.h"
-+#include "access/xlog.h"
-+#include "tcop/tcopprot.h"
-+#include "postmaster/postmaster.h"
-+
-+#include "../interfaces/libpq/libpq-fe.h"
-+#include "../interfaces/libpq/libpq-int.h"
-+#include "../interfaces/libpq/fe-auth.h"
-+
-+#include "replicate.h"
-+
-+#ifdef WIN32
-+#include "win32.h"
-+#else
-+#ifdef HAVE_NETINET_TCP_H
-+#include <netinet/tcp.h>
-+#endif
-+#include <arpa/inet.h>
-+#endif
-+
-+#ifndef HAVE_STRDUP
-+#include "strdup.h"
-+#endif
-+#ifdef HAVE_CRYPT_H
-+#include <crypt.h>
-+#endif
-+
-+#ifdef MULTIBYTE
-+#include "mb/pg_wchar.h"
-+#endif
-+
-+#define RECOVERY_LOOP_END (0)
-+#define RECOVERY_LOOP_CONTINUE (1)
-+#define RECOVERY_LOOP_FAIL (2)
-+char Local_Host_Name[HOSTNAME_MAX_LENGTH];
-+
-+static int read_packet(int sock,RecoveryPacket * packet);
-+static int send_recovery_packet(int sock, RecoveryPacket * packet);
-+static int send_packet(int * sock, RecoveryPacket * packet );
-+static void master_loop(int fd);
-+static int start_recovery_send(int * sock, ReplicateServerInfo * host);
-+static int stop_recovery_send(int * sock, ReplicateServerInfo * host);
-+static int rsync_pg_data(char * src , char * dest);
-+static int remove_dir(char * dir_name);
-+static int clear_bkup_dir(char * dir_name);
-+static int bkup_dir(char * dir_name);
-+static int restore_dir(char * dir_name);
-+static int rsync_global_dir(char * src, char * dest, int stage);
-+static int first_recovery(char * src, char * dest, char * dir);
-+static int second_recovery(char * src, char * dest, char * dir);
-+static int recovery_rsync(char * src , char * dest, int stage);
-+static int recovery_loop(int fd);
-+static void show_recovery_packet(RecoveryPacket * packet);
-+static int direct_send_packet(int packet_no);
-+static void set_recovery_packet(RecoveryPacket * packet, int packet_no);
-+static int sync_table_space(char * hostName, uint16_t portNum, char *
userName, int stage);
-+static PGresult * get_table_space_location(char * hostName, uint16_t
portNum, char * userName);
-+static int rsync_table_space(char * hostName, char * location, int stage);
-+
-+int PGR_recovery_error_send(void);
-+int PGR_recovery_finish_send(void);
-+int PGR_Master_Main(void);
-+int PGR_Recovery_Main(void);
-+
-+static int
-+read_packet(int sock,RecoveryPacket * packet)
-+{
-+ int r;
-+ char * read_ptr;
-+ int read_size = 0;
-+ int packet_size = 0;
-+
-+ read_ptr = (char*)packet;
-+ packet_size = sizeof(RecoveryPacket);
-+
-+ for (;;){
-+ r = recv(sock,read_ptr + read_size ,packet_size, MSG_WAITALL);
-+ if (r < 0) {
-+ if (errno == EINTR || errno == EAGAIN) {
-+ continue;
-+ } else {
-+ elog(DEBUG1, "read_packet():recv failed");
-+ return -1;
-+ }
-+ } else if (r == 0) {
-+ elog(DEBUG1, "read_packet():unexpected EOF");
-+ return -1;
-+ } else /*if (r > 0)*/ {
-+ read_size += r;
-+ if (read_size == packet_size) {
-+ show_recovery_packet(packet);
-+ return read_size;
-+ }
-+ }
-+ }
-+ return -1;
-+}
-+
-+static int
-+send_recovery_packet(int sock, RecoveryPacket * packet)
-+{
-+ char * send_ptr;
-+ int send_size= 0;
-+ int buf_size = 0;
-+ int s;
-+ int rtn;
-+ fd_set wmask;
-+ struct timeval timeout;
-+
-+ timeout.tv_sec = PGR_SEND_TIMEOUT;
-+ timeout.tv_usec = 0;
-+
-+ /*
-+ * Wait for something to happen.
-+ */
-+ rtn = 1;
-+ while (rtn)
-+ {
-+ for (;;)
-+ {
-+ timeout.tv_sec = PGR_SEND_TIMEOUT;
-+ timeout.tv_usec = 0;
-+
-+ FD_ZERO(&wmask);
-+ FD_SET(sock,&wmask);
-+ rtn = select(sock+1, (fd_set *)NULL, &wmask, (fd_set
*)NULL, &timeout);
-+
-+ if (rtn < 0)
-+ {
-+ if (errno == EINTR || errno == EAGAIN)
-+ {
-+ continue;
-+ }
-+ else
-+ {
-+ rtn = 0;
-+ break;
-+ }
-+ }
-+ else if (rtn && FD_ISSET(sock, &wmask))
-+ {
-+ send_ptr = (char *)packet;
-+ buf_size = sizeof(RecoveryPacket);
-+
-+ s = send(sock,send_ptr + send_size,buf_size -
send_size ,0);
-+ if (s < 0) {
-+ if (errno == EINTR || errno ==
EAGAIN) {
-+ continue;
-+ }
-+ elog(DEBUG1,
"send_recovery_packet():send error");
-+
-+ /* EPIPE || ENCONNREFUSED || ENSOCK
|| EHOSTUNREACH */
-+ return STATUS_ERROR;
-+ } else if (s == 0) {
-+ elog(DEBUG1,
"send_recovery_packet():unexpected EOF");
-+ return STATUS_ERROR;
-+ } else /*if (s > 0)*/ {
-+ send_size += s;
-+ if (send_size == buf_size)
-+ {
-+ return STATUS_OK;
-+ }
-+ }
-+ }
-+ }
-+ }
-+ return STATUS_ERROR;
-+}
-+
-+static int
-+send_packet(int * sock, RecoveryPacket * packet )
-+{
-+ int count = 0;
-+ ReplicateServerInfo * host = NULL;
-+
-+ host = PGR_get_replicate_server_info();
-+ if (host == (ReplicateServerInfo*)NULL)
-+ {
-+ return STATUS_ERROR;
-+ }
-+ count = 0;
-+ while (send_recovery_packet(*sock,packet) != STATUS_OK)
-+ {
-+ if (count < MAX_RETRY_TIMES )
-+ {
-+ count ++;
-+ continue;
-+ }
-+ count = 0;
-+ close(*sock);
-+ PGR_Set_Replication_Server_Status(host,DATA_ERR);
-+ host = PGR_get_replicate_server_info();
-+ if (host == (ReplicateServerInfo*)NULL)
-+ {
-+ return STATUS_ERROR;
-+ }
-+ PGR_Set_Replication_Server_Status(host,DATA_USE);
-+ PGR_Create_Socket_Connect(sock, host->hostName ,
host->recoveryPortNumber);
-+ }
-+ return STATUS_OK;
-+}
-+
-+static void
-+master_loop(int fd)
-+{
-+ int count;
-+ int sock;
-+ int status = STATUS_OK;
-+ RecoveryPacket packet;
-+ int r_size = 0;
-+ bool loop_end = false;
-+
-+ count = 0;
-+ while ((status =
PGR_Create_Acception(fd,&sock,"",RecoveryPortNumber)) != STATUS_OK)
-+ {
-+ PGR_Close_Sock(&sock);
-+ sock = -1;
-+ if ( count > MAX_RETRY_TIMES)
-+ {
-+ return;
-+ }
-+ count ++;
-+ }
-+ for(;;)
-+ {
-+ int rtn;
-+ fd_set rmask;
-+ struct timeval timeout;
-+
-+ timeout.tv_sec = PGR_RECV_TIMEOUT;
-+ timeout.tv_usec = 0;
-+
-+ /*
-+ * Wait for something to happen.
-+ */
-+ FD_ZERO(&rmask);
-+ FD_SET(sock,&rmask);
-+ rtn = select(sock+1, &rmask, (fd_set *)NULL, (fd_set *)NULL,
&timeout);
-+ if (rtn && FD_ISSET(sock, &rmask))
-+ {
-+ r_size = read_packet(sock,&packet);
-+ if (r_size == 0)
-+ {
-+ continue;
-+ }
-+ else if (r_size < 0)
-+ {
-+ loop_end=true;
-+ break;
-+ }
-+ }
-+ else
-+ {
-+ continue;
-+ }
-+ switch (ntohs(packet.packet_no))
-+ {
-+ case RECOVERY_PGDATA_REQ :
-+ /*
-+ * PGDATA information request
-+ */
-+ /*
-+ * get master server information
-+ */
-+ memset(&packet,0,sizeof(packet));
-+ set_recovery_packet(&packet,
RECOVERY_PGDATA_ANS) ;
-+ status = send_packet(&sock,&packet);
-+ PGR_Set_Cluster_Status(STATUS_RECOVERY);
-+ break;
-+ case RECOVERY_FSYNC_REQ :
-+ /*
-+ * get master server information
-+ */
-+ memset(&packet,0,sizeof(packet));
-+ set_recovery_packet(&packet,
RECOVERY_FSYNC_ANS );
-+ status = send_packet(&sock,&packet);
-+ PGR_Set_Cluster_Status(STATUS_RECOVERY);
-+ loop_end = true;
-+ break;
-+ case RECOVERY_ERROR_TARGET_ONLY:
-+ memset(&packet,0,sizeof(packet));
-+ set_recovery_packet(&packet,
RECOVERY_ERROR_ANS );
-+ status = send_packet(&sock,&packet);
-+ PGR_Set_Cluster_Status(STATUS_REPLICATE);
-+ break;
-+ case RECOVERY_ERROR_CONNECTION:
-+ memset(&packet,0,sizeof(packet));
-+ set_recovery_packet(&packet,
RECOVERY_ERROR_ANS );
-+ status = send_packet(&sock,&packet);
-+ PGR_Set_Cluster_Status(STATUS_REPLICATE);
-+ /**
-+ * kill broken cluster db.
-+ * FIXME: missing MyProcPid here. It must be
postmaster's pid.
-+ * but here's a bug MyProcPid doesn't
initialized properly , so MyProcPid = postmaster's pid.