Mon Jan 24 18:44:44 PST 2005
- Previous message: [Slony1-commit] By cbbrowne: Added in stored function for generating SYNC events
- Next message: [Slony1-commit] By cbbrowne: slon_watchdog.pl.diff - Added --config and --help options,
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Log Message:
-----------
Shell script that uses the new function for generating SYNC events.
This script might be added to the crontab to ensure that SYNCs get
generated even if there is no slon running
Tags:
----
REL_1_0_STABLE
Added Files:
-----------
slony1-engine/tools:
generate_syncs.sh (r1.1.2.1)
-------------- next part --------------
--- /dev/null
+++ tools/generate_syncs.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+# $Id: generate_syncs.sh,v 1.1.2.1 2005/01/24 18:44:40 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
- Previous message: [Slony1-commit] By cbbrowne: Added in stored function for generating SYNC events
- Next message: [Slony1-commit] By cbbrowne: slon_watchdog.pl.diff - Added --config and --help options,
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list