Skip to content

Commit

Permalink
ctdb-scripts: Drop use of ctdb_check_counter from reclock event script
Browse files Browse the repository at this point in the history
This makes the logic more obvious.

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

Signed-off-by: Martin Schwenke <[email protected]>
Reviewed-by: Amitay Isaacs <[email protected]>
  • Loading branch information
martin-schwenke authored and Amitay Isaacs committed Jul 21, 2016
1 parent 92d0d44 commit 0825eff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
8 changes: 5 additions & 3 deletions ctdb/config/events.d/01.reclock
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion ctdb/tests/eventscripts/01.reclock.monitor.004.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions ctdb/tests/eventscripts/01.reclock.monitor.005.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 0825eff

Please sign in to comment.