Skip Menu |

This queue is for tickets about the DBD-Multi CPAN distribution.

Report information
The Basics
Id: 98352
Status: open
Priority: 0/
Queue: DBD-Multi

People
Owner: Dan [...] DWright.Org
Requestors: chrmet [...] web.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Suggestions DBD-Multi
Date: Wed, 27 Aug 2014 10:46:45 +0200
To: bug-DBD-Multi [...] rt.cpan.org
From: "Christian Metzger" <chrmet [...] web.de>
 
Dear Ladies and Gentleman,
 
we are using DBD-Multi 0.18 with Perl 5.12.3 on Linux (Rhel 5.5).
It fits our requirements very well.
We are able to write to every cluster node with MariaDB-Galera-server-5.5.37-1 for MySQL.
 
I have these suggestions:
 
A) Should behave like other DBD drivers if a connection could not be established
Return "undef" (or a false value)
Set $DBI::err
Set $DBI::errstr
 
B) The module dies if a connction could not be established
I tried to catch this in my application with eval { ->connect() }, but unfortunately
this does not work for me (script gets terminated).
So the module should work like A) and not "die".
 
 
 
 
 
 
Kind regards, Christian Metzger
On Wed Aug 27 04:46:56 2014, chrmet@web.de wrote: Show quoted text
> Dear Ladies and Gentleman, we are using DBD-Multi 0.18 with Perl > 5.12.3 on Linux (Rhel 5.5).It fits our requirements very well.We are > able to write to every cluster node with > MariaDB-Galera-server-5.5.37-1 for MySQL.
Hello! I'm glad to hear it is working well for you. Show quoted text
> A) Should behave like other DBD drivers if a connection could not be > establishedReturn "undef" (or a false value)Set $DBI::errSet > $DBI::errstr
The DBD::Multi object is just a container. Creation of that container never fails. Until that changes, Multi should not return undef. Multi is an object that holds multiple database handles for you. Those database handles may exist when you create the Mutli object, or they might not even be created until they are needed. For example, if I specify a connection like this: DBI->connect( 'dbi:Multi:', undef, undef, { dsns => [ 10 => [ ... ] # first db 20 => [ ... ] # second db ] } ); The Multi object will not attempt to connect to the first DB until it has been sent its first query. Additionally, as long as the first DB continues to work, the Multi object will never connect to second DB. So, it would be impossible to always know at the time the Multi object is constructed if the inner database handle connections will be successful. Show quoted text
> B) The module dies if a connction could not be establishedI tried to > catch this in my application with eval { ->connect() }, but > unfortunatelythis does not work for me (script gets terminated).So the > module should work like A) and not "die". Kind regards, Christian > Metzger
The code does call die(): 367 die("All data sources failed!"); You should be able to trap that with an eval {}. Can you provide sample code that demonstrates the problem? I think a valid argument could be made here that Multi should only call die in the case where RaiseError is turned on. I would be willing to look into making this change, if it would be helpful to you? Regards, -Dan
Subject: Aw: [rt.cpan.org #98352] Suggestions DBD-Multi
Date: Thu, 28 Aug 2014 20:13:55 +0200
To: bug-DBD-Multi [...] rt.cpan.org
From: "Christian Metzger" <chrmet [...] web.de>
 
Hi Dan,
 
I'm very glad to get in contact with you.
I have looked at all other HA modules too, and yours is the best by far.
 
Ad A)
Yes, I see your point (creation of connections is deferred, no connection is created in the connect method).
 
Ad B)
I did change my code slightly and it is working now: It looks like the "eval" is fully working now. But I don't really understand this, because my change was actually insignificant.
Yes, if "die" will be called only in the case where "RaiseError" is turned on, would be absolutely great:
I won't have to be afraid that the "die" might not be catched again.
This is very important for us because the applications must not crash at all.
 
May I ask for something else?
I noticed that if not even one datasource could be connected, that there are many lines with
error messages (which is absolutely ok).
But in one/some of these lines is not only contained the userid but also the password.
This is not very well because we are publishing our logfiles. 
 
 
 
Kind regards, Christian
 
 
Gesendet: Donnerstag, 28. August 2014 um 16:53 Uhr Von: "Daniel J. Wright via RT" <bug-DBD-Multi@rt.cpan.org> An: chrmet@web.de Betreff: [rt.cpan.org #98352] Suggestions DBD-Multi
<URL: https://rt.cpan.org/Ticket/Display.html?id=98352 > On Wed Aug 27 04:46:56 2014, chrmet@web.de wrote: > Dear Ladies and Gentleman, we are using DBD-Multi 0.18 with Perl > 5.12.3 on Linux (Rhel 5.5).It fits our requirements very well.We are > able to write to every cluster node with > MariaDB-Galera-server-5.5.37-1 for MySQL. Hello! I'm glad to hear it is working well for you. > A) Should behave like other DBD drivers if a connection could not be > establishedReturn "undef" (or a false value)Set $DBI::errSet > $DBI::errstr The DBD::Multi object is just a container. Creation of that container never fails. Until that changes, Multi should not return undef. Multi is an object that holds multiple database handles for you. Those database handles may exist when you create the Mutli object, or they might not even be created until they are needed. For example, if I specify a connection like this: DBI->connect( 'dbi:Multi:', undef, undef, { dsns => [ 10 => [ ... ] # first db 20 => [ ... ] # second db ] } ); The Multi object will not attempt to connect to the first DB until it has been sent its first query. Additionally, as long as the first DB continues to work, the Multi object will never connect to second DB. So, it would be impossible to always know at the time the Multi object is constructed if the inner database handle connections will be successful. > B) The module dies if a connction could not be establishedI tried to > catch this in my application with eval { ->connect() }, but > unfortunatelythis does not work for me (script gets terminated).So the > module should work like A) and not "die". Kind regards, Christian > Metzger The code does call die(): 367 die("All data sources failed!"); You should be able to trap that with an eval {}. Can you provide sample code that demonstrates the problem? I think a valid argument could be made here that Multi should only call die in the case where RaiseError is turned on. I would be willing to look into making this change, if it would be helpful to you? Regards, -Dan