Skip Menu |

This queue is for tickets about the DBIx-HA CPAN distribution.

Report information
The Basics
Id: 24955
Status: resolved
Priority: 0/
Queue: DBIx-HA

People
Owner: Nobody in particular
Requestors: MARKSTOS [...] cpan.org
Cc:
AdminCc:

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



Subject: PATCH: numerous documentation improvements
The attached patch adds numerous documentation improvements, including: - internal docs for _execute_with_timeout - documenting how to disable the connect and execute timeouts - documenting a general purpose failover_test function Mark
Subject: dbix-ha-docs.patch
Wed Feb 14 16:11:51 EST 2007 mark@summersault.com * A variety of doc patches diff -rN -u old-DBIx-HA-0.99/Changes new-DBIx-HA-0.99/Changes --- old-DBIx-HA-0.99/Changes 2007-02-14 16:12:42.000000000 -0500 +++ new-DBIx-HA-0.99/Changes 2007-02-14 16:12:42.000000000 -0500 @@ -1,5 +1,7 @@ Revision history for Perl extension DBIx::HA. + - Numerous documentation improvements (Mark Stosberg) + 0.99 Wed Oct 04 18:18:00 2006 - Fix for Apache children always starting at index 0 and overwriting shared file if under app failover. diff -rN -u old-DBIx-HA-0.99/lib/DBIx/HA.pm new-DBIx-HA-0.99/lib/DBIx/HA.pm --- old-DBIx-HA-0.99/lib/DBIx/HA.pm 2007-02-14 16:12:42.000000000 -0500 +++ new-DBIx-HA-0.99/lib/DBIx/HA.pm 2007-02-14 16:12:42.000000000 -0500 @@ -535,6 +535,28 @@ return $res; } +=begin private + +=head2 + + ($execute_result,$timeout_triggered) = _execute_with_timeout($dsn,$sth); + +Calls "execute" on a DBI statement handle, and handles a possible timeout of the query. + +Args: + $dsn: a key in our internal lookup table of connection details + $sth: DBI statement handle + +Returns: + - result of execute() call + - boolean, true if timeout was triggered. + + +=end private + +=cut + + sub _execute_with_timeout { my $dsn = shift; my $sth = shift; @@ -771,14 +793,16 @@ =item connecttimeout ( DEFAULT: 5 ) -timeout for connecting to a datasource, in seconds. +Timeout for connecting to a datasource, in seconds. A value of 0 disables this timeout. =item executetimeout ( DEFAULT: 10 ) -timeout for execution of a statement, in seconds. If the timeout is triggered, +Timeout for execution of a statement, in seconds. If the timeout is triggered, the database handle is deleted and a new connect is tried. If the connect succeeds, we assume that the problem is with a runaway SQL statement or bad -indexing. If the connect fails, then we fail over. +indexing. If the connect fails, then we fail over. A value of 0 disables this timeout. + + =item callback_function ( DEFAULT: I<none> ) @@ -787,22 +811,28 @@ =item failtest_function ( DEFAULT: sub{0} ) -reference to a function to call to test if a DBI error is a candidate for -failover or not. -Input is ($ErrorID, $ErrorString) +Reference to a function to call to test if a DBI error is a candidate for +failover or not. This is only triggered when a call to C<execute()> returns +an undefined value. + +Input is ($DBI::err, $DBI::errstr). These correspond to the native driver error +code and string values. See the docs for your database driver and L<DBI> for +details. + Output is boolean: If true, then we'll consider the error a critical condition, ok to failover. If false, then DBIx::HA will not act on it and pass it straight through to the client. This Fail Test Function (FTF) function is extremely important for the proper functioning of DBIx::HA. You must be careful in defining it -precisely, based on the database engine that you are using. As a -convenience to the user, DBIx::HA defines some sample functions that -you can use. At this time, only the following samples are defined: +precisely, based on the database engine that you are using. A sample +function for Sybase is included: + + failtest_function => \&DBIx::HA::FTF_SybaseASE, - DBIx::HA::FTF_SybaseASE +To consider any error a reason to failover, you could use the following: -Example use is in the synopsis + failtest_function => sub {1}, =back
Subject: PATCH: modperl doc improvements
The attached patch has a number of modperl related documentation improvements. It's important to note that the features for modperl *only have an effect if modperl is loaded*. This is an important detail for people like me who develop in CGI at first, and "turn on" modperl later. DBIx::HA will work fine in such a hybrid environment, but the documentation was clear about that without these patches. Mark
Wed Feb 14 17:27:51 EST 2007 mark@summersault.com * DBIx::HA doc patches related to mod_perl diff -rN -u old-saveapet-2/perllib/DBIx/HA.pm new-saveapet-1/perllib/DBIx/HA.pm --- old-saveapet-2/perllib/DBIx/HA.pm 2007-02-14 17:29:13.000000000 -0500 +++ new-saveapet-1/perllib/DBIx/HA.pm 2007-02-14 17:29:14.000000000 -0500 @@ -757,15 +757,16 @@ =item connectoninit ( DEFAULT: 0 ) -If set to 1, then during the I<initialize()> phase this database connections -will be instantiated with its currently active db_stack entry. -This is very useful under mod_perl and replaces the C<Apache::DBI> -I<connect_on_init()> method. +If set to 1 and L<Apache::DBI> has already been loaded, then during the +I<initialize()> phase database connections will be opened with the +currently active db_stack entry. This is very useful under mod_perl and +replaces the purpose of the C<Apache::DBI> I<connect_on_init()> method. =item pingtimeout ( DEFAULT: -1 ) -this is only useful in conjunction with C<Apache::DBI>. The default of -1 -disables pinging the datasource. It is recommended not to modify it. See +This configures the usage of the ping method, to validate a connection. The +option is only checked if L<Apache::DBI> has already been loaded. The default +of -1 disables pinging the datasource. It is recommended not to modify it. See C<Apache::DBI> for more information on ping timeouts. Timeout is in seconds. =item failoverlevel ( DEFAULT: process ) @@ -783,11 +784,12 @@ =item application -a file-based interprocess communication is used to notify Apache/mod_perl +A file-based interprocess communication is used to notify Apache/mod_perl processes of the currently active datasource. This allows all processes to fail over near-simultaneously. A process in the middle of an I<execute> will do it on the next call to I<prepare> or I<execute>. This is only available under -mod_perl. +mod_perl. It only has an effect if we detect that mod_perl is in effect, by +checking that C<$Apache::VERSION> has a value. =back
Subject: PATCH: numerous documentation improvements (committed)
These doc patches were committed to the Google Code SVN repo today.