Thu Nov 25 21:57:23 PST 2004
- Previous message: [Slony1-commit] By darcyb: Make cbbrowne's functions work as conceptualy intended
- Next message: [Slony1-commit] By darcyb: Duplicate file, share/slon.conf-sample is the correct home
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Log Message:
-----------
Add in "generate_syncs.sh" script to use the new "generate_sync_event()" procedure that can generate SYNCs even if the origin's slon is down.
Modified Files:
--------------
slony1-engine/tools:
Makefile (r1.1 -> r1.2)
Added Files:
-----------
slony1-engine/tools:
generate_syncs.sh (r1.1)
-------------- next part --------------
--- /dev/null
+++ tools/generate_syncs.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+# $Id: generate_syncs.sh,v 1.1 2004/11/25 21:57:18 cbbrowne Exp $
+
+# Christopher Browne
+# Afilias Canada
+# 2004-11-15
+# For the Slony-I project
+
+# This script may be run every few minutes to force in syncs on a
+# particular node.
+
+# Supposing you have some possibly-flakey slon daemon that might not
+# run all the time, you might return from a weekend away only to
+# discover the following situation...
+
+# On Friday night, something went "bump" and while the database came
+# back up, none of the slon daemons survived. Your online application
+# then saw nearly three days worth of heavy transactions.
+
+# When you restart slon on Monday, it hasn't done a SYNC on the master
+# since Friday, so that the next "SYNC set" comprises all of the
+# updates between Friday and Monday. Yuck.
+
+# If you run generate_syncs.sh as a cron job every 20 minutes, it will
+# force in a periodic SYNC on the "master" server, which means that
+# between Friday and Monday, the numerous updates are split into more
+# than 100 syncs, which can be applied incrementally, making the
+# cleanup a lot less unpleasant.
+
+# Note that if SYNCs _are_ running regularly, this script won't bother
+# doing anything.
+
+export NAMESPACE="_${1}"
+export PGHOST=$2
+export PGPORT=$3
+export DATABASE=$4
+INTERVAL="10 minutes" # Don't bother generating a SYNC if there has been
+ # one in the last $INTERVAL
+PSQL=`which psql` # Replace this with your favorite command to run psql
+
+echo "select \"$NAMESPACE\".generate_sync_event('$INTERVAL');" | \
+ ${PSQL} -h $PGHOST -p $PGPORT -d $DATABASE
Index: Makefile
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -Ltools/Makefile -Ltools/Makefile -u -w -r1.1 -r1.2
--- tools/Makefile
+++ tools/Makefile
@@ -13,7 +13,7 @@
SUBDIRS = altperl
-DISTFILES = Makefile slony_setup.pl
+DISTFILES = Makefile slony_setup.pl generate_syncs.sh
all install installdirs:
- Previous message: [Slony1-commit] By darcyb: Make cbbrowne's functions work as conceptualy intended
- Next message: [Slony1-commit] By darcyb: Duplicate file, share/slon.conf-sample is the correct home
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list