[SCM] CTDB repository - branch master updated - ctdb-1.13-289-g25d8860
Amitay Isaacs
amitay at samba.org
Tue Oct 16 22:25:47 MDT 2012
The branch, master has been updated
via 25d886060b138bc5e78fe93d7bebe3990264f29d (commit)
via 36d25e96a2f8ae1461c5a708a2922f0475a39900 (commit)
via 632c1b9c1cc2e242376358ce49fd2022b3f27aa2 (commit)
from 08dbd9c7958f9a0ee3de314d49523d32e4be135c (commit)
http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 25d886060b138bc5e78fe93d7bebe3990264f29d
Author: Amitay Isaacs <amitay at gmail.com>
Date: Wed Oct 17 11:38:37 2012 +1100
doc: Add info about execute permissions on event scripts
Signed-off-by: Amitay Isaacs <amitay at gmail.com>
commit 36d25e96a2f8ae1461c5a708a2922f0475a39900
Author: Amitay Isaacs <amitay at gmail.com>
Date: Wed Oct 17 11:38:59 2012 +1100
doc: Fix documentation for setup event
Signed-off-by: Amitay Isaacs <amitay at gmail.com>
commit 632c1b9c1cc2e242376358ce49fd2022b3f27aa2
Author: Amitay Isaacs <amitay at gmail.com>
Date: Mon Sep 3 12:39:36 2012 +1000
scripts: Remove duplicate code from init script to set tunables
The tunable variables defined in CTDB configuration file are currently
set up from init script as well as part of "setup" event in 00.ctdb
eventscript. Remove the duplication of this code and set tunable
variables only from setup event. During the "setup" event, it's possible
that ctdb tool commands can timeout if CTDB daemon is not ready. To guard
against such eventuality, wait till "ctdb ping" command succeeds before
executing any other ctdb tool commands.
Signed-off-by: Amitay Isaacs <amitay at gmail.com>
-----------------------------------------------------------------------
Summary of changes:
config/ctdb.init | 14 +-------------
config/events.d/00.ctdb | 37 +++++++++++++++++++++++++++++--------
config/events.d/README | 10 +++++-----
3 files changed, 35 insertions(+), 26 deletions(-)
Changeset truncated at 500 lines:
diff --git a/config/ctdb.init b/config/ctdb.init
index 581844d..372affb 100755
--- a/config/ctdb.init
+++ b/config/ctdb.init
@@ -214,16 +214,6 @@ EOF
done
}
-set_ctdb_variables () {
- # set any tunables from the config file
- set | grep ^CTDB_SET_ | cut -d_ -f3- |
- while read v; do
- varname=`echo $v | cut -d= -f1`
- value=`echo $v | cut -d= -f2`
- ctdb setvar $varname $value || RETVAL=1
- done || exit 1
-}
-
set_retval() {
return $1
}
@@ -304,9 +294,7 @@ start() {
esac
if [ $RETVAL -eq 0 ] ; then
- if wait_until_ready ; then
- set_ctdb_variables
- else
+ if ! wait_until_ready ; then
RETVAL=1
pkill -9 -f $ctdbd >/dev/null 2>&1
fi
diff --git a/config/events.d/00.ctdb b/config/events.d/00.ctdb
index 2a48afb..2f2116d 100755
--- a/config/events.d/00.ctdb
+++ b/config/events.d/00.ctdb
@@ -35,6 +35,30 @@ update_config_from_tdb() {
fi
}
+set_ctdb_variables () {
+ # set any tunables from the config file
+ set | grep ^CTDB_SET_ | cut -d_ -f3- |
+ while read v; do
+ varname=`echo $v | cut -d= -f1`
+ value=`echo $v | cut -d= -f2`
+ ctdb setvar $varname $value || return 1
+ echo "Set $varname to $value"
+ done
+}
+
+wait_until_ready () {
+ _timeout="${1:-10}" # default is 10 seconds
+
+ _count=0
+ while ! ctdb ping >/dev/null 2>&1 ; do
+ if [ $_count -ge $_timeout ] ; then
+ return 1
+ fi
+ sleep 1
+ _count=$(($_count + 1))
+ done
+}
+
ctdb_check_args "$@"
case "$1" in
@@ -51,14 +75,11 @@ case "$1" in
;;
setup)
- # set any tunables from the config file
- set | grep ^CTDB_SET_ | cut -d_ -f3- |
- while read v; do
- varname=`echo $v | cut -d= -f1`
- value=`echo $v | cut -d= -f2`
- ctdb setvar $varname $value || exit 1
- echo "Set $varname to $value"
- done || exit 1
+ # Make sure CTDB daemon is ready to process requests
+ if wait_until_ready ; then
+ # set any tunables from the config file
+ set_ctdb_variables
+ fi || exit 1
;;
startup)
diff --git a/config/events.d/README b/config/events.d/README
index 024af24..6075f39 100644
--- a/config/events.d/README
+++ b/config/events.d/README
@@ -13,6 +13,8 @@ As a special case, any eventscript that ends with a '~' character will be
ignored since this is a common postfix that some editors will append to
older versions of a file.
+Only event scripts with executable permissions are run from CTDB. Any event
+script that does not have executable permission is ignored.
The eventscripts are called with varying number of arguments.
The first argument is the "event" and the rest of the arguments depend
@@ -33,11 +35,9 @@ init
setup
This event does not take any additional arguments.
- This event is only invoked once, when ctdb is starting up.
- This event is used to do some cleanup work from earlier runs
- and prepare the basic setup.
-
- Example: 00.ctdb cleans up $CTDB_VARDIR/state
+ This event is only invoked once, after init event is completed.
+ This event is used to do setup any tunables defined in ctdb
+ configuration file.
startup
This event does not take any additional arguments.
--
CTDB repository
More information about the samba-cvs
mailing list