eventscripts: Use configured RECLOCK file instead of asking CTDB
authorAmitay Isaacs <amitay@gmail.com>
Fri, 2 Aug 2013 05:49:06 +0000 (15:49 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Fri, 9 Aug 2013 01:04:55 +0000 (11:04 +1000)
On cluster where recovery lock file is not being used, asking CTDB daemon
is unnecessary overhead.  And if CTDB is using recovery file, then changing
configuration without restarting is *stupid*.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Pair-Programmed-With: Martin Schwenke <martin@meltin.net>

config/events.d/01.reclock

index ec50989743f57e41ed4d3c27b18106a7cac282a7..ed7afdd78aa89ca4c67cfc3aaf53f049aeef4f22 100755 (executable)
@@ -7,21 +7,19 @@
 . $CTDB_BASE/functions
 loadconfig
 
-case "$1" in 
+case "$1" in
     init)
        ctdb_counter_init
        ;;
-    
-    monitor)
-       RECLOCKFILE=$(ctdb -Y getreclock)
 
+    monitor)
        # Early exit if not using a reclock file
-       [ -n "$RECLOCKFILE" ] || exit 0
+       [ -n "$CTDB_RECOVERY_LOCK" ] || exit 0
 
        # Try to stat the reclock file as a background process so that
        # we don't block in case the cluster filesystem is unavailable
        (
-           if stat $RECLOCKFILE ; then
+           if stat $CTDB_RECOVERY_LOCK ; then
                # We could stat the file, reset the counter
                ctdb_counter_init
            fi
@@ -29,7 +27,7 @@ case "$1" in
 
        ctdb_counter_incr
        if ! ctdb_check_counter "quiet" -ge 200 ; then
-           echo "Reclock file \"$RECLOCKFILE\" can not be accessed. Shutting down."
+           echo "Reclock file \"$CTDB_RECOVERY_LOCK\" can not be accessed. Shutting down."
            df
            sleep 1
            ctdb shutdown