LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: [lvs-users] ldirectord and oracle

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [lvs-users] ldirectord and oracle
Cc: Geoff Harrison <mandrake@xxxxxxxxxxxx>, Tim Pretlove <T.Pretlove@xxxxxxxxxxxxxxx>
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Mon, 26 Jul 2010 16:38:49 +0900
On Tue, Jul 20, 2010 at 09:37:46PM -0400, mandrake (Geoff Harrison) wrote:
> Sorry this has taken me a little while to respond, I've been under the gun a
> bit at work.
> This should work appropriately, I'm going to apply this patch in my test
> environment tomorrow morning and should have a go at it.

Thanks Geoff, and especially thanks Tim.

I have committed the change.

http://hg.linux-ha.org/agents/rev/22b0e5bf5fd0

# HG changeset patch
# User Tim Pretlove <T.Pretlove@xxxxxxxxxxxxxxx>
# Date 1280129711 -32400
# Node ID 55181357ccc836e01fefc3280085c0cbd8c5c82a
# Parent  81968dcb275d1de8a2f5b290000b94499f232896
Medium: ldirectord: Oracle compatibility

Allow checking of Oracle databases to work correctly.

Tested-by: Geoff Harrison <mandrake@xxxxxxxxxxxx>
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>

diff -r 81968dcb275d -r 55181357ccc8 ldirectord/ldirectord.in
--- a/ldirectord/ldirectord.in  Thu Jul 15 12:16:13 2010 +0900
+++ b/ldirectord/ldirectord.in  Mon Jul 26 16:35:11 2010 +0900
@@ -3049,7 +3049,7 @@
 
 sub check_oracle
 {
-       return check_sql(@_, "Oracle", "");
+       return check_sql(@_, "Oracle", "sid");
 }
 
 sub check_sql
@@ -3073,6 +3073,7 @@
                            "host=$$r{server};port=$port", $$v{login},
                            $$v{passwd});
        unless ($dbh) {
+               &ld_debug(2, "Failed to bind to $$r{server} with 
DBI->errstr\n");
                check_sql_log_errstr("Failed to bind to $$r{server} with",
                                     DBI->errstr);
                goto err_down;
@@ -3080,16 +3081,16 @@
        $result--;
        $sth = $dbh->prepare($query);
        unless ($sth) {
+               &ld_debug(2, "Error preparing statement: $dbh->errstr\n");
                check_sql_log_errstr("Error preparing statement:",
                                     $dbh->errstr);
                goto err_disconect;
        }
 
-       # On error "execute" will return undef.
-       # Otherwise it will return either "0E0"
-       # (Some garbage to make 0 true) or > 1.
+       # Test to see if any errors are returned
        $sth->execute;
-       unless ($sth->rows) {
+       if ($dbh->err) {
+               &ld_debug(2, "Error executing statement: $dbh->errstr : 
$dbh->err\n");
                check_sql_log_errstr("Error executing statement:",
                                     $dbh->errstr, $dbh->err);
                goto err_finish;
@@ -3110,8 +3111,10 @@
        # (enabled) that says whether or not you want to actually use this
        # in the pool from ldirector / ipvs, and disable them without
        # actually turning off your sql server.
-
-       unless ($rows = $sth->execute) {
+       
+       $sth->execute;
+       if ($dbd eq "Oracle") { $sth->fetchrow_hashref() }
+       unless ($rows = $sth->rows) {
                check_sql_log_errstr("Error executing statement:",
                                     $dbh->errstr, $dbh->err);
                goto err_finish;

_______________________________________________
Please read the documentation before posting - it's available at:
http://www.linuxvirtualserver.org/

LinuxVirtualServer.org mailing list - lvs-users@xxxxxxxxxxxxxxxxxxxxxx
Send requests to lvs-users-request@xxxxxxxxxxxxxxxxxxxxxx
or go to http://lists.graemef.net/mailman/listinfo/lvs-users

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