Skip Menu |
 

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

Report information
The Basics
Id: 9039
Status: resolved
Priority: 0/
Queue: DBD-mysql

People
Owner: Nobody in particular
Requestors: steve [...] purkis.ca
Cc:
AdminCc:

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



Subject: [REQ] ability to define reconnect sub used by 'auto_reconnect'
Download (untitled) / with headers
text/plain 773b
Hiya, I'd like to be able to define the subroutine used when an auto reconnect occurs. The reason being for failover and redundancy: Say I have 3 mysql servers that are read only -- if my connection to one of them times out, instead of just reconnecting to it I'd like to be able to decide which one of the three I should reconnect to, taking things like server load, # connections, etc. into account. AFAIKS, this would involve making a small-ish change to: int mysql_db_reconnect(SV* h) { To allow an external perl sub to be called if set, instead of calling _MyLogin( imp_dbh ). This could be implemented by adding the reconnector sub as another 'attribute' of 'imp_dbh', with the default behaviour being to call a perl sub that just calls _MyLogin(). -Steve
Download (untitled) / with headers
text/plain 1.2k
[guest - Mon Dec 20 07:24:47 2004]: Show quoted text
> Hiya, >
Hello. Show quoted text
> I'd like to be able to define the subroutine used when an auto > reconnect occurs. The reason being for failover and redundancy: > Say I have 3 mysql servers that are read only -- if my connection > to one of them times out, instead of just reconnecting to it I'd > like to be able to decide which one of the three I should reconnect > to, taking things like server load, # connections, etc. into > account.
IMO, this would be better handled in an external module and not by the driver itself. As it stands right now auto_reconnect is more of a backwards compat. feature who's behaviour changes depending on context (mod_perl/!mod_perl, flag set/ in_begin? in_tx &c), so it really shouldn't be used. Show quoted text
> > AFAIKS, this would involve making a small-ish change to: > > int mysql_db_reconnect(SV* h) { > > To allow an external perl sub to be called if set, instead of calling > _MyLogin( imp_dbh ). This could be implemented by adding the > reconnector sub as another 'attribute' of 'imp_dbh', with the > default behaviour being to call a perl sub that just calls > _MyLogin().
Why bounce to perl and then back to C as a default when you could: If (imp_dbh->reconnect_callback()) return imp_dbh->reconnect_callback(imp_dbh);


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.