Permalink
Browse files

Added a sanity test for second_behind

  • Loading branch information...
1 parent 6ff2905 commit 3ffde7b596e2003bfd8d6983fcf6d77bee2349d9 @y-trudeau committed Jun 1, 2012
Showing with 7 additions and 9 deletions.
  1. +7 −9 heartbeat/mysql
View
@@ -39,12 +39,6 @@
# OCF_RESKEY_log
# OCF_RESKEY_pid
# OCF_RESKEY_socket
-# OCF_RESKEY_replication_user
-# OCF_RESKEY_replication_passwd
-# OCF_RESKEY_replication_port
-# OCF_RESKEY_max_slave_lag
-# OCF_RESKEY_evict_outdated_slaves
-# OCF_RESKEY_reader_attribute
#######################################################################
# Initialization:
@@ -574,10 +568,14 @@ check_slave() {
fi
# is the slave ok to have a VIP on it
- if [ $secs_behind -gt $OCF_RESKEY_max_slave_lag ]; then
+ if [ -z $secs_behind ]; then
set_reader_attr 0
else
- set_reader_attr 1
+ if [ $secs_behind -gt $OCF_RESKEY_max_slave_lag ]; then
+ set_reader_attr 0
+ else
+ set_reader_attr 1
+ fi
fi
ocf_log debug "MySQL instance running as a replication slave"
@@ -613,7 +611,7 @@ set_master() {
if [ -n "$master_log_file" -a -n "$master_log_pos" ]; then
master_params=", MASTER_LOG_FILE='$master_log_file', \
MASTER_LOG_POS=$master_log_pos"
- ocf_log info "Restored master pos for $new_master : $master_log_file:$master_log_pos"
+ ocf_log info "Restored master pos for $new_master_host : $master_log_file:$master_log_pos"
fi
fi

0 comments on commit 3ffde7b

Please sign in to comment.