LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: [lvs-users] ldirectord and oracle

To: Tim Pretlove <T.Pretlove@xxxxxxxxxxxxxxx>
Subject: Re: [lvs-users] ldirectord and oracle
Cc: lvs-users@xxxxxxxxxxxxxxxxxxxxxx, Geoff Harrison <mandrake@xxxxxxxxxxxx>
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Wed, 23 Jun 2010 16:04:49 +0900
[ Cced lvs-users and Geoff Harrison for comment ]

On Mon, Jun 14, 2010 at 11:40:55AM +0100, Tim Pretlove wrote:
> Hi Simon,
> 
> Here is a patch for Oracle support. I've tried to make it as minor
> as possible to avoid breaking the other database support.
> 
> Regards
> 
> 
> Tim
> 
> 
> On 09/06/10 01:47, Simon Horman wrote:
> >On Tue, Jun 08, 2010 at 09:28:45AM +0100, Tim Pretlove wrote:
> >>Okay, I do currently have a version that works with oracle but I
> >>wouldn't like to release it to the world until I have done some more
> >>testing/tweeking. I have a few other type of database available
> >>(Postgres and Mysql) so I will test it against them and make sure I
> >>haven't broken anything.
> >
> >Thanks, let me know how it goes.
> 
> -- 
>  ____________________________________
> (                                    )
> ( Tim Pretlove                       )
> ( Computing Services                 )
> ( The University of Liverpool        )
> ( Computer Laboratory, Brownlow Hill )
> ( Liverpool, L69 3BX                 )
> ( Email: t.pretlove@xxxxxxxxxxxxxxx  )
> ( Phone: 0151-794-4479               )
> (                                    )
>  ------------------------------------
>        o   ,__,
>         o  (00)____
>            (__)    )\
>               ||--|| *

> diff -r cbd80d4017c8 ldirectord/ldirectord.in
> --- a/ldirectord/ldirectord.in        Tue Jun 08 20:07:16 2010 +0200
> +++ b/ldirectord/ldirectord.in        Mon Jun 14 11:36:32 2010 +0100
> @@ -3043,7 +3043,7 @@
>  
>  sub check_oracle
>  {
> -     return check_sql(@_, "Oracle", "");
> +     return check_sql(@_, "Oracle", "sid");
>  }
>  
>  sub check_sql
> @@ -3067,6 +3067,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;
> @@ -3074,16 +3075,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;
> @@ -3104,8 +3105,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>