On 07/08/12 10:32, Martin J. Evans wrote:
Hi,

I didn't implement TAF support in DBD::Oracle but I want to use it. I've just 
started using it and have had to fix some problems with memory corruption, 
memory leaks and issues with scalars going out of scope but now I've reached a 
point where the functionality I require could change the current interface so 
if you are using TAF (or think you may have an opinion) please read on.

There are 3 taf attributes:

ora_taf - set to 1 to enable and 0 does not enable
BUT 0 does not disable it when previously enabled
It only works when connect (login6 actually) is called

ora_sleep - a time to sleep between retries
The sleep is in DBD::Oracle and not your callback so I believe it is redundant 
- you can just put it in your callback and ora_sleep can be removed from 
DBD::Oracle (I've already documented it will go away in trunk).

ora_taf_function - the Perl sub to call
This is a string which is annoying as it means if your callback is in your 
module XX::YY and called callback you have to pass 'XX::YY::callback'. I'd 
really like to just change this to be a code ref.
Also the callback does not receive the dbh handle which limits its usefulness. 
Obviously I could just add this to the end of the args passed to the callback 
without affecting anyone with existing code.

So, ideally I'd like to:
remove ora_sleep - it is unnecessary
make ora_taf enable and disable TAF whenever it is changed not just in connect
add the dbh arg to the callback (at the end to avoid breaking anyone)
allow ora_taf_function to be a code ref

I might also want to add a user definable scalar to be passed to the callback 
too.

Is this going to affect you? Probably not if I do it as described but I'd like 
to hear from you especially if you are already using TAF.

All feedback welcome.

Martin

I got one private response to this email but nothing else. I've gone ahead and 
made the following (hopefully backwards compatible) changes:

1. the taf_function can now be a code ref or a sub name
2. the dbh is passed to the Perl callback sub you register
   (as the last arg)

In doing this I found a number of other inefficiencies in the handling of 
attributes in the login6/connect method which I've hopefully fixed. FYI these 
were mostly ora_* attributes specifically handled in the connect method but not 
deleted from the attribute hash and hence DBI called STORE for them anyway - so 
quite a bit of code duplication was removed.

I've tested this on a 2 node RAC system and TAF seems to work fine.

This is now checked in to the subversion trunk.

I still plan to allow TAF to be enabled/disabled at any time (not just at 
connect) and ideally I'd like to get rid of ora_taf and ora_taf_sleep as they 
are both redundant so:

If you are already using TAF in DBD::Oracle please shout out now.

Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com

Reply via email to