ctdb-scripts: Drop use of ctdb_check_counter from reclock event script
authorMartin Schwenke <martin@meltin.net>
Wed, 6 Jul 2016 04:28:06 +0000 (14:28 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 21 Jul 2016 00:24:25 +0000 (02:24 +0200)
This makes the logic more obvious.

Fix the (probably) accidental fall-through to the regular monitor
failure.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/config/events.d/01.reclock
ctdb/tests/eventscripts/01.reclock.monitor.004.sh
ctdb/tests/eventscripts/01.reclock.monitor.005.sh

index 45b2405ce94c78865f35f4b6bef74651e92b7dbe..cceb672c8e00724d5731fa7341c0b5504f1a90aa 100755 (executable)
@@ -38,14 +38,16 @@ monitor)
        ) >/dev/null 2>&1 &
 
        ctdb_counter_incr
-       if ! ctdb_check_counter "quiet" -ge 200 ; then
+       num_fails=$(ctdb_counter_get)
+       if [ "$num_fails" -ge 200 ] ; then
            echo "Reclock file \"$CTDB_RECOVERY_LOCK\" can not be accessed. Shutting down."
            df
            sleep 1
            $CTDB shutdown
+           exit 1
+       elif [ "$num_fails" -ge 4 ] ; then
+               die "ERROR: ${num_fails} consecutive failures checking reclock"
        fi
-
-       ctdb_check_counter "error" -gt 3
        ;;
 esac
 
index fd185d1aa5252068bf55ebadc33bcb492c896061..8ea0fd026fb6d388fdc597716b86b935f17196ae 100755 (executable)
@@ -13,6 +13,6 @@ simple_test
 simple_test
 
 required_result 1 <<EOF
-ERROR: 4 consecutive failures for 01.reclock, marking node unhealthy
+ERROR: 4 consecutive failures checking reclock
 EOF
 simple_test
index e190e14585ab299494057418ed2b2a615d53dfcf..8572c25ff15a4b3c8ef06c3fee5824dc43c9c0ab 100755 (executable)
@@ -14,7 +14,7 @@ done
 
 for i in $(seq 4 199) ; do
        required_result 1 <<EOF
-ERROR: ${i} consecutive failures for 01.reclock, marking node unhealthy
+ERROR: ${i} consecutive failures checking reclock
 EOF
        simple_test
 done
@@ -24,6 +24,5 @@ Reclock file "${CTDB_RECOVERY_LOCK}" can not be accessed. Shutting down.
 Filesystem             1024-blocks      Used Available Capacity Mounted on
 /dev/sda1                               1000000     100000     900000         10% /
 CTDB says BYE!
-ERROR: 200 consecutive failures for 01.reclock, marking node unhealthy
 EOF
 simple_test