Re: Are you using TAF support in DBD::Oracle?

"Martin J. Evans" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Organization Easysoft Limited
Message-ID <[email protected]>
On 10/08/12 09:58, Martin J. Evans wrote:
> 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

Having left this a week and not found a single person using TAF (except me) and now having had plenty of time to play with this I've reworked it all. This is the result:

   [BUG FIXES]
   - fix serious memory corruption in TAF support
   - fix memory leak in TAF handling - the TAF function was leaked
   - fix issue with taf_function being set to a scalar which goes
     out of scope before the callback is made
   [CHANGE IN BEHAVIOUR]
   - ora_taf and ora_taf_sleep were redundant and have been removed.
     To enable/disable TAF simply set ora_taf_function and if you
     want to sleep do it in your callback
   - ora_taf_function can now be a code reference as well as a string
   [ENHANCEMENTS]
   - the ora_can_taf method was virtually useless since you can only
     call it after connecting and to enable TAF you had to do it in the
     connect call. Now you enable and disable TAF at any time by
     simply setting or clearing the ora_taf_function (see RT78811)
   - the ora_taf_function is now passed a third argument of the
     connection handle

This is now in subversion trunk. I've been using it over a week and not found any issues as yet. If you were using TAF this is now not a backwards compatible change. Simply delete all references to ora_taf and ora_taf_sleep and if you were setting ora_taf_sleep, add a sleep to your callback. Sorry if this inconveniences you but I could not live with the TAF support as it was - there were just too many problems.

There are other bug fixes in the subversion trunk.

Yanick will probably do his usual sterling work of merging the changes, cleaning up and a development release sometime soon.

Martin
-- 
Martin J. Evans
Easysoft Limited
http://www.easysoft.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.