Skip to content


Subversion checkout URL

You can clone with
Download ZIP


mysql RA improvements #98

wants to merge 5 commits into from

5 participants


This patch

  • fixes an error that comes up when replication is not working: $secs_behind is NULL, which causes an error in numerical comparisons and leads if to choose the wrong branch (thus leaving the reader attribute on)
  • adds a writable attribute for the master
  • fixes a line indent in check_slave (sorry, I just had to do it :-/)

NACK. This part has to go; it was in Yves' original draft and was thrown out. It's pointless; you don't need this attribute. You just tie your colo constraints to the Master role of the M/S set.

all righty... I'll have to find how to do that in the wonderfully clear and concise documentation, I guess :P

colocation c_writer_ip_on_master inf: p_ip ms_mysql:Master

... where p_ip is your "writer VIP" and ms_mysqlis your MySQL master/slave set.


This makes sense to me, I'd just prefer [ "$secs_behind" = "NULL" ] (with quotes). Or just do [ "$secs_behind" = "NULL" ] && secs_behind = 0, and then leave the comparison to $OCF_RESKEY_max_slave_lag as is.

setting it to zero is not a good idea, you want infinity ;)

I'll just quote it (I actually stood on the fence a bit, but then I figured it should have a value at all times...)


Fair enough. :)


I think there's no contest here. For once :) @m0n5t3r, it would be great if you could issue a new pull request, so that we don't have patch, patch back. Thanks!


can be closed as per #387

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 1, 2012
  1. when replication is stopped $secs_behind is NULL, which causes an err…

    Sabin Iacob committed
    …or in numeric comparisons
  2. fix indenting

    Sabin Iacob committed
  3. Revert e18c9ca, as it's been rejected

    Sabin Iacob committed
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 3 deletions.
  1. +3 −3 heartbeat/mysql
6 heartbeat/mysql
@@ -551,7 +551,7 @@ check_slave() {
if ocf_is_true $OCF_RESKEY_evict_outdated_slaves; then
# We're supposed to bail out if we lag too far
# behind. Let's check our lag.
- if [ $secs_behind -gt $OCF_RESKEY_max_slave_lag ]; then
+ if [ "$secs_behind" = "NULL" ] || [ $secs_behind -gt $OCF_RESKEY_max_slave_lag ]; then
ocf_log err "MySQL Slave is $secs_behind seconds behind master (allowed maximum: $OCF_RESKEY_max_slave_lag)."
ocf_log err "See $tmpfile for details"
@@ -560,7 +560,7 @@ check_slave() {
- elif ocf_is_ms; then
+ elif ocf_is_ms; then
# Even if we're not set to evict lagging slaves, we can
# still use the seconds behind master value to set our
# master preference.
@@ -574,7 +574,7 @@ check_slave() {
# is the slave ok to have a VIP on it
- if [ $secs_behind -gt $OCF_RESKEY_max_slave_lag ]; then
+ if [ "$secs_behind" = "NULL" ] || [ $secs_behind -gt $OCF_RESKEY_max_slave_lag ]; then
set_reader_attr 0
set_reader_attr 1
Something went wrong with that request. Please try again.