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
Peter Rabbitson
7 years ago
22 | 22 |
- Fix spurious ROLLBACK statements when a TxnScopeGuard fails a commit
|
23 | 23 |
of a transaction with deferred FK checks: a guard is now inactivated
|
24 | 24 |
immediately before the commit is attempted (RT#107159)
|
25 | |
- Fix spurious warning on MSSQL cursor invalidation retries (RT#102166)
|
26 | 25 |
- Fix the Sybase ASE storage incorrectly attempting to retrieve an
|
27 | 26 |
autoinc value when inserting rows containing blobs (GH#82)
|
28 | 27 |
- Remove spurious exception warping in ::Replicated::execute_reliably
|
187 | 187 |
# FIXME - we assume that $storage->{_dbh_autocommit} is there if
|
188 | 188 |
# txn_init_depth is there, but this is a DBI-ism
|
189 | 189 |
$txn_init_depth > ( $storage->{_dbh_autocommit} ? 0 : 1 )
|
190 | |
)
|
191 | |
or
|
192 | |
! do {
|
193 | |
local $self->storage->{_in_do_block_retry_handler} = 1;
|
194 | |
$self->retry_handler->($self)
|
195 | |
}
|
|
190 |
) or ! $self->retry_handler->($self)
|
196 | 191 |
);
|
197 | 192 |
|
198 | 193 |
# we got that far - let's retry
|
9 | 9 |
use mro 'c3';
|
10 | 10 |
|
11 | 11 |
use Try::Tiny;
|
12 | |
use DBIx::Class::_Util qw( sigwarn_silencer );
|
13 | 12 |
use List::Util 'first';
|
14 | 13 |
use namespace::clean;
|
15 | 14 |
|
|
175 | 174 |
|
176 | 175 |
my $dbh = $self->_dbh or return 0;
|
177 | 176 |
|
178 | |
try {
|
179 | |
local $dbh->{RaiseError} = 1;
|
180 | |
local $dbh->{PrintError} = 0;
|
|
177 |
local $dbh->{RaiseError} = 1;
|
|
178 |
local $dbh->{PrintError} = 0;
|
|
179 |
|
|
180 |
return try {
|
181 | 181 |
$dbh->do('select 1');
|
182 | 182 |
1;
|
183 | |
}
|
184 | |
catch {
|
185 | |
# MSSQL is *really* annoying wrt multiple active resultsets,
|
186 | |
# and this may very well be the reason why the _ping failed
|
187 | |
#
|
188 | |
# Proactively disconnect, while hiding annoying warnings if the case
|
189 | |
#
|
190 | |
# The callchain is:
|
191 | |
# < check basic retryability prerequisites (e.g. no txn) >
|
192 | |
# ->retry_handler
|
193 | |
# ->storage->connected()
|
194 | |
# ->ping
|
195 | |
# So if we got here with the in_handler bit set - we won't break
|
196 | |
# anything by a disconnect
|
197 | |
if( $self->{_in_do_block_retry_handler} ) {
|
198 | |
local $SIG{__WARN__} = sigwarn_silencer qr/disconnect invalidates .+? active statement/;
|
199 | |
$self->disconnect;
|
200 | |
}
|
201 | |
|
202 | |
# RV of _ping itself
|
|
183 |
} catch {
|
203 | 184 |
0;
|
204 | 185 |
};
|
205 | 186 |
}
|
2 | 2 |
|
3 | 3 |
use Test::More;
|
4 | 4 |
use Test::Exception;
|
5 | |
use Test::Warn;
|
6 | 5 |
use Try::Tiny;
|
7 | 6 |
|
8 | 7 |
use DBIx::Class::Optional::Dependencies ();
|
|
102 | 101 |
|
103 | 102 |
ok(($new->artistid||0) > 0, "Auto-PK worked for $opts_name");
|
104 | 103 |
|
105 | |
# Test graceful error handling if not supporting multiple active statements
|
106 | |
if( $opts_name eq 'plain' ) {
|
107 | |
|
108 | |
# keep the first cursor alive (as long as $rs is alive)
|
109 | |
my $rs = $schema->resultset("Artist");
|
110 | |
|
111 | |
my $a1 = $rs->next;
|
112 | |
|
113 | |
my $a2;
|
114 | |
|
115 | |
warnings_are {
|
116 | |
# second cursor, invalidates $rs, but it doesn't
|
117 | |
# matter as long as we do not try to use it
|
118 | |
$a2 = $schema->resultset("Artist")->next;
|
119 | |
} [], 'No warning on retry due to previous cursor invalidation';
|
120 | |
|
121 | |
is_deeply(
|
122 | |
{ $a1->get_columns },
|
123 | |
{ $a2->get_columns },
|
124 | |
'Same data',
|
125 | |
);
|
126 | |
|
127 | |
dies_ok {
|
128 | |
$rs->next;
|
129 | |
} 'Invalid cursor did not silently return garbage';
|
130 | |
}
|
131 | |
|
132 | 104 |
# Test multiple active statements
|
133 | |
else {
|
|
105 |
SKIP: {
|
|
106 |
skip 'not a multiple active statements configuration', 1
|
|
107 |
if $opts_name eq 'plain';
|
|
108 |
|
134 | 109 |
$schema->storage->ensure_connected;
|
135 | 110 |
|
136 | 111 |
lives_ok {
|