From: Peter Rabbitson Date: Sun, 19 Jun 2016 11:31:33 +0000 (+0200) Subject: Revert incorrectly backported fix for RT#102166 ( e8f23a77 ) X-Git-Tag: v0.082840~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=commitdiff_plain;h=b58ec618e9efcae245aed37529738180c551db91 Revert incorrectly backported fix for RT#102166 ( e8f23a77 ) I dropped the ball on testing this one change, and of course it came back to bite :/ Onwards to 0.082840 --- diff --git a/Changes b/Changes index ac81b92..4f864fe 100644 --- a/Changes +++ b/Changes @@ -23,7 +23,6 @@ Revision history for DBIx::Class - Fix spurious ROLLBACK statements when a TxnScopeGuard fails a commit of a transaction with deferred FK checks: a guard is now inactivated immediately before the commit is attempted (RT#107159) - - Fix spurious warning on MSSQL cursor invalidation retries (RT#102166) - Fix the Sybase ASE storage incorrectly attempting to retrieve an autoinc value when inserting rows containing blobs (GH#82) - Remove spurious exception warping in ::Replicated::execute_reliably diff --git a/lib/DBIx/Class/Storage/BlockRunner.pm b/lib/DBIx/Class/Storage/BlockRunner.pm index 2862669..be29701 100644 --- a/lib/DBIx/Class/Storage/BlockRunner.pm +++ b/lib/DBIx/Class/Storage/BlockRunner.pm @@ -188,12 +188,7 @@ sub _run { # FIXME - we assume that $storage->{_dbh_autocommit} is there if # txn_init_depth is there, but this is a DBI-ism $txn_init_depth > ( $storage->{_dbh_autocommit} ? 0 : 1 ) - ) - or - ! do { - local $self->storage->{_in_do_block_retry_handler} = 1; - $self->retry_handler->($self) - } + ) or ! $self->retry_handler->($self) ); # we got that far - let's retry diff --git a/lib/DBIx/Class/Storage/DBI/MSSQL.pm b/lib/DBIx/Class/Storage/DBI/MSSQL.pm index 90c05f8..5b4c422 100644 --- a/lib/DBIx/Class/Storage/DBI/MSSQL.pm +++ b/lib/DBIx/Class/Storage/DBI/MSSQL.pm @@ -10,7 +10,6 @@ use base qw/ use mro 'c3'; use Try::Tiny; -use DBIx::Class::_Util qw( sigwarn_silencer ); use List::Util 'first'; use namespace::clean; @@ -176,31 +175,13 @@ sub _ping { my $dbh = $self->_dbh or return 0; - try { - local $dbh->{RaiseError} = 1; - local $dbh->{PrintError} = 0; + local $dbh->{RaiseError} = 1; + local $dbh->{PrintError} = 0; + + return try { $dbh->do('select 1'); 1; - } - catch { - # MSSQL is *really* annoying wrt multiple active resultsets, - # and this may very well be the reason why the _ping failed - # - # Proactively disconnect, while hiding annoying warnings if the case - # - # The callchain is: - # < check basic retryability prerequisites (e.g. no txn) > - # ->retry_handler - # ->storage->connected() - # ->ping - # So if we got here with the in_handler bit set - we won't break - # anything by a disconnect - if( $self->{_in_do_block_retry_handler} ) { - local $SIG{__WARN__} = sigwarn_silencer qr/disconnect invalidates .+? active statement/; - $self->disconnect; - } - - # RV of _ping itself + } catch { 0; }; } diff --git a/t/746mssql.t b/t/746mssql.t index e2c3abd..e4a9de0 100644 --- a/t/746mssql.t +++ b/t/746mssql.t @@ -3,7 +3,6 @@ use warnings; use Test::More; use Test::Exception; -use Test::Warn; use Try::Tiny; use DBIx::Class::Optional::Dependencies (); @@ -103,35 +102,11 @@ SQL ok(($new->artistid||0) > 0, "Auto-PK worked for $opts_name"); -# Test graceful error handling if not supporting multiple active statements - if( $opts_name eq 'plain' ) { - - # keep the first cursor alive (as long as $rs is alive) - my $rs = $schema->resultset("Artist"); - - my $a1 = $rs->next; - - my $a2; - - warnings_are { - # second cursor, invalidates $rs, but it doesn't - # matter as long as we do not try to use it - $a2 = $schema->resultset("Artist")->next; - } [], 'No warning on retry due to previous cursor invalidation'; - - is_deeply( - { $a1->get_columns }, - { $a2->get_columns }, - 'Same data', - ); - - dies_ok { - $rs->next; - } 'Invalid cursor did not silently return garbage'; - } - # Test multiple active statements - else { + SKIP: { + skip 'not a multiple active statements configuration', 1 + if $opts_name eq 'plain'; + $schema->storage->ensure_connected; lives_ok {