pgpool2.git / summary / log / commit / refs
commit 392ad2df73c8e5a0cfe4cc917770c99eb9280379
Author: Tatsuo Ishii <ishii at sraoss.co.jp>
Date: Sat Oct 03 12:41:10 2009 +0000
Enhance online recovery 2nd stage script to sync sequence value
sample/pgpool_recovery_pitr | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/sample/pgpool_recovery_pitr b/sample/pgpool_recovery_pitr
index 53663cbad..670f491d9 100644
--- a/sample/pgpool_recovery_pitr
+++ b/sample/pgpool_recovery_pitr
@@ -1,3 +1,18 @@
#! /bin/sh
+# Online recovery 2nd stage script
+#
+datadir=$1 # master dabatase cluster
+DEST=$2 # hostname of the DB node to be recovered
+DESTDIR=$3 # database cluster of the DB node to be recovered
+port=5432 # PostgreSQL port number
-psql -c 'select pg_switch_xlog()' postgres
+# Force to flush current value of sequences to xlog
+psql -p $port -t -c 'SELECT datname FROM pg_database WHERE NOT datistemplate AND datallowconn' template1|
+while read i
+do
+ if [ "$i" != "" ];then
+ psql -p $port -c "SELECT setval(oid, nextval(oid)) FROM pg_class WHERE relkind = 'S'" $i
+ fi
+done
+
+psql -p $port -c 'SELECT pg_switch_xlog()' postgres
[parent: 2e25aa4482a9]