[lvs-users] Patch for ldirectord when using mysql service

To: <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: [lvs-users] Patch for ldirectord when using mysql service
From: "Sverre Marvik" <sm@xxxxxxxxxxxxx>
Date: Fri, 26 Oct 2007 21:15:20 +0200
My first go at this mailing list, hope this is the place to post a

We're using a 2-server-cluster LVS and HA setup to have a loadbalanced
high available MySQL database server.
Currently running CentOS 5.0, MySQL 5.0.22 and the heartbeat packages
version 2.1.2.

We've been having some trouble getting ldirectord doing it's work when
it comes to adding real servers to the VIP host. The real-servers failed
due to errors in the ldirectord when checking the database with a
provided SELECT query. To get this working, we had to fix 2 very small
problem in ldirectord, in the check_sql method.

Ldirectord version string is "Linux Director v1.186-ha-2.1.2"

The patch:
--- /usr/sbin/    2007-08-10 13:03:07.000000000 +0200
+++ /usr/sbin/ldirectord        2007-10-25 14:48:20.000000000 +0200
@@ -2672,7 +2672,7 @@
        unless ($dbh) {
                check_sql_log_errstr("Failed to bind to $$r{server}
-                                    $dbh->errstr);
+                                    DBI->errstr);
                goto err_down;
@@ -2728,7 +2728,8 @@
        # at a particular row. But I'm not going to worry about that for
        # now.
        $row = $sth->fetchrow_arrayref;
-       unless ($row && $sth->err) {
+        # We don't want "unless $sth->err", this will only kick in when
error is NOT set
+       unless ($row && !$sth->err) {
                check_sql_log_errstr("Error fetching row:",
                goto err_finish;

Sverre Marvik
Head of System Operations
+47 95284007
Send MT to 2229

This message contains information that may be privileged or confidential
and is the property of "Mobiletech AS". 

It is only intended for the person to whom it is addressed. If you are
not the intended recipient,
you are not authorized to read, print, retain, copy, disseminate,
or use this message or any part thereof. If you receive this message in
error, please
notify the sender immediately and delete all copies of this message.

This email has been scanned for viruses by the anti-virus programs used
by Mobiletech AS

<Prev in Thread] Current Thread [Next in Thread>