8 years agoFix obscure failure of CDBICompat accessor install on 5.8
Peter Rabbitson [Wed, 20 Apr 2016 10:31:23 +0000]
Fix obscure failure of CDBICompat accessor install on 5.8

CDBICompat has a bizarre override of the CAG logic, in a way that only works
reliably at compiletime due to Class::C3 "cache" slots

A test implicitly starts covering this failcase once Class::Data::Inheritable
is removed sever commits later

8 years agoAugment the infinite loop fix 4f52479b with the infra of ddcc02d1
Peter Rabbitson [Fri, 8 Apr 2016 14:36:22 +0000]
Augment the infinite loop fix 4f52479b with the infra of ddcc02d1

This also fixes a manifestation (but not the cause, this comes later) of a
bug where $result->result_source != $result->result_source_instance.

This commit is made early as it is rather efficient anyway, and it allows me
to test Handel (which was broken by 4f52479b) to validate subsequent rsrc
rewritering

8 years agoReduce duplicate ->result_source calls where sensible
Peter Rabbitson [Tue, 15 Dec 2015 22:22:51 +0000]
Reduce duplicate ->result_source calls where sensible

No functional changes

8 years agoThis was commented out in 2008 (5b0b4df8) and never used
Peter Rabbitson [Tue, 15 Dec 2015 21:30:10 +0000]
This was commented out in 2008 (5b0b4df8) and never used

8 years agoSlightly golf ::ResultSource::DESTROY and several weaken() calls
Peter Rabbitson [Thu, 14 Apr 2016 12:56:00 +0000]
Slightly golf ::ResultSource::DESTROY and several weaken() calls

No functional changes

8 years agoProxy the 'unsafe' attribute to the internal ::Versioned storage
Fabrice Gabolde [Wed, 13 Apr 2016 13:42:38 +0000]
Proxy the 'unsafe' attribute to the internal ::Versioned storage

8 years agoRemove one level of indirection in Versioned on_connect
Peter Rabbitson [Thu, 14 Apr 2016 08:34:30 +0000]
Remove one level of indirection in Versioned on_connect

No functional changes

8 years agoAdd a weaken() cycle forgotten in d63c9e64
Peter Rabbitson [Thu, 14 Apr 2016 07:19:15 +0000]
Add a weaken() cycle forgotten in d63c9e64

The reason this has not been a problem is because thread spawn in DESTROY is
practically unheard of. Nevertheless if one throws the following in, the
problem becomes apparent: ( not committing this test, because... just no. )

--- a/t/storage/txn_scope_guard.t
+++ b/t/storage/txn_scope_guard.t
@@ -247,5 +247,7 @@ require DBICTest::AntiPattern::NullObject;
   my @arg_capture;
   {
+    use threads;
     local $SIG{__WARN__} = sub {
+      threads->new(sub { sleep 1})->join;
       package DB;

8 years agoFix thinko from 10dd5c05 - make sure we actually sleep
Peter Rabbitson [Wed, 13 Apr 2016 17:43:30 +0000]
Fix thinko from 10dd5c05 - make sure we actually sleep

Under very tight concurrency it is possible that the test will not be given
sufficient timeshare before the scheduled 'point in the future', which would
result in us asking Time::HiRes to sleep for a negative amount of time, which
it "helpfully" converts to an obnoxious exception.

8 years agoAdd a proof of concept test for copy() with assymetric IC::DT
Tina Mueller [Fri, 14 Aug 2015 11:51:53 +0000]
Add a proof of concept test for copy() with assymetric IC::DT

What a mess. The core of the problem is that some of our IC::DT in/deflator
pairs are *not* symmetric. That is for things to roundtrip one needs values
to pass through the database, which is configured "just properly wrong" to
perform the second half of this evil dance.

Of course this break copy() and likely other things I do not know about.
Given there is nothing one can do about the core problem (huge install base)
a minimally invasive workaround has been devised and tested here. Refer to
`git show 993fa9b | perl -ne 'print if 110..134'` for the exact snippet you
need to place in your base result class to make everything work again.

This is terrible.
    -- ribasushi

For completeness: here is a full list of individual inflators (as of Apr
2016) and which ones are broken beyond repair:

ACCESS                         2016-04-13 07:42:58         2016-04-13T07:42:58   2016-04-13 07:42:58        (via DateTime::Format::MySQL)
DB2                            2016-04-13-07.42.58         2016-04-13T07:42:58   2016-04-13-07.42.58        (via DateTime::Format::DB2)
MSSQL                          2016-04-13 07:42:58.000     2016-04-13T07:42:58   2016-04-13 07:42:58.000    (via DBIx::Class::Storage::DBI::MSSQL::DateTime::Format)
Pg                             2016-04-13 07:42:58+0000    2016-04-13T07:42:58   2016-04-13 07:42:58+0000   (via DateTime::Format::Pg)
ADO                            2016-04-13 07:42:58         2016-04-13T07:42:58   2016-04-13 07:42:58        (via DateTime::Format::MySQL)
NoBindVars                     2016-04-13 07:42:58         2016-04-13T07:42:58   2016-04-13 07:42:58        (via DateTime::Format::MySQL)
SQLAnywhere                    2016-04-13 07:42:58.000000  2016-04-13T07:42:58   2016-04-13 07:42:58.000000 (via DateTime::Format::Strptime)
AutoCast                       2016-04-13 07:42:58         2016-04-13T07:42:58   2016-04-13 07:42:58        (via DateTime::Format::MySQL)
Firebird                       2016-04-13 07:42:58.0000    2016-04-13T07:42:58   2016-04-13 07:42:58.0000   (via DBIx::Class::Storage::DBI::InterBase::DateTime::Format)
Informix                       2016-04-13 07:42:58.00000   2016-04-13T07:42:58   2016-04-13 07:42:58.00000  (via DBIx::Class::Storage::DBI::Informix::DateTime::Format)
ODBC                           2016-04-13 07:42:58         2016-04-13T07:42:58   2016-04-13 07:42:58        (via DateTime::Format::MySQL)
Sybase                         2016-04-13 07:42:58         2016-04-13T07:42:58   2016-04-13 07:42:58        (via DateTime::Format::MySQL)
mysql                          2016-04-13 07:42:58         2016-04-13T07:42:58   2016-04-13 07:42:58        (via DateTime::Format::MySQL)
InterBase                      2016-04-13 07:42:58.0000    2016-04-13T07:42:58   2016-04-13 07:42:58.0000   (via DBIx::Class::Storage::DBI::InterBase::DateTime::Format)
Oracle                         2016-04-13 07:42:58         2016-04-13T07:42:58   2016-04-13 07:42:58        (via DateTime::Format::MySQL)
SQLite                         2016-04-13 07:42:58         2016-04-13T07:42:58   2016-04-13 07:42:58        (via DateTime::Format::SQLite)
Firebird::Common               2016-04-13 07:42:58.0000    2016-04-13T07:42:58   2016-04-13 07:42:58.0000   (via DBIx::Class::Storage::DBI::InterBase::DateTime::Format)
Sybase::FreeTDS                2016-04-13 07:42:58         2016-04-13T07:42:58   2016-04-13 07:42:58        (via DateTime::Format::MySQL)
Sybase::MSSQL                  2016-04-13 07:42:58.000     Your datetime does not match your pattern. at                             (via DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::DateTime::Format)
Sybase::Microsoft_SQL_Server   2016-04-13 07:42:58.000     Your datetime does not match your pattern. at                             (via DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::DateTime::Format)
Sybase::ASE                    04/13/2016 07:42:58.000     Your datetime does not match your pattern. at                             (via DBIx::Class::Storage::DBI::Sybase::ASE::DateTime::Format)
Sybase::Microsoft_SQL_Server::NoBindVars 2016-04-13 07:42:59.000     Your datetime does not match your pattern. at                             (via DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::DateTime::Format)
Sybase::ASE::NoBindVars        04/13/2016 07:42:59.000     Your datetime does not match your pattern. at                             (via DBIx::Class::Storage::DBI::Sybase::ASE::DateTime::Format)
Oracle::WhereJoins             2016-04-13 07:42:59         2016-04-13T07:42:59   2016-04-13 07:42:59        (via DateTime::Format::Oracle)
Oracle::Generic                2016-04-13 07:42:59         2016-04-13T07:42:59   2016-04-13 07:42:59        (via DateTime::Format::Oracle)
ODBC::ACCESS                   2016-04-13 07:42:59         2016-04-13T07:42:59   2016-04-13 07:42:59        (via DBIx::Class::Storage::DBI::ODBC::ACCESS::DateTime::Format)
ODBC::DB2_400_SQL              2016-04-13-07.42.59         2016-04-13T07:42:59   2016-04-13-07.42.59        (via DateTime::Format::DB2)
ODBC::SQL_Anywhere             2016-04-13 07:42:59.000000  2016-04-13T07:42:59   2016-04-13 07:42:59.000000 (via DateTime::Format::Strptime)
ODBC::Firebird                 2016-04-13 07:42:59.0000    2016-04-13T07:42:59   2016-04-13 07:42:59.0000   (via DBIx::Class::Storage::DBI::InterBase::DateTime::Format)
ODBC::Microsoft_SQL_Server     2016-04-13 07:42:59.000     2016-04-13T07:42:59   2016-04-13 07:42:59.000    (via DBIx::Class::Storage::DBI::MSSQL::DateTime::Format)
ADO::MS_Jet                    04/13/2016 07:42:59 AM      2016-04-13T07:42:59   04/13/2016 07:42:59 AM     (via DBIx::Class::Storage::DBI::ADO::MS_Jet::DateTime::Format)
ADO::Microsoft_SQL_Server      04/13/2016 07:42:59 AM      2016-04-13T07:42:59   04/13/2016 07:42:59 AM     (via DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server::DateTime::Format)

... and the program that produces the above ...

~$ perl -I lib -MDateTime -MFile::Find -e '

  find({ no_chdir => 1, follow_fast => 1, wanted => sub {

    -f _ or next;
    $_ =~ m{DBIx/Class/Storage/DBI/(?!Replicated|IdentityInsert|.*?Cursor|UniqueIdentifier)(.+)\.pm} or next;

    list_dt_state($1);

  }}, "lib" );

  sub list_dt_state {
    ( my $id = shift ) =~ s|/|::|g;

    my $s = "DBIx::Class::Storage::DBI::$id";

    my $p = eval "local \$SIG{__WARN__} = sub {}; require $s; $s->build_datetime_parser"
      or ( printf "%s: %s\n", $id, substr $@, 0, 45 and next );

    my $as_string = $p->format_datetime( DateTime->now );
    my $half_trip = eval { $p->parse_datetime( $as_string ) } || substr $@, 0, 45;
    my $full_trip = $@ ? "" : eval { $p->format_datetime( $half_trip ) } || substr $@, 0, 45;

    printf "%-30s %-26s  %-20s  %-26s (via %s)\n",
      $id,
      $as_string,
      $half_trip,
      $full_trip,
      ( ref $p || $p ),
    ;
  }
'

8 years agoFix t/746sybase.t failing under -T
Peter Rabbitson [Tue, 12 Apr 2016 14:28:25 +0000]
Fix t/746sybase.t failing under -T

8 years agoFix forgotten finally{} in Sybase::ASE (missed in ddcc02d14)
Peter Rabbitson [Tue, 12 Apr 2016 14:25:58 +0000]
Fix forgotten finally{} in Sybase::ASE (missed in ddcc02d14)

I guess my grep-fu failed me, the finally is right there...

As per the comment nothing seems to fail if I just remove this, but ASE is
so fragile that I'll just play it safe...

8 years agoAnd lose yet another dependency: List::Util (yes, I know it's core)
Peter Rabbitson [Mon, 11 Apr 2016 11:31:18 +0000]
And lose yet another dependency: List::Util (yes, I know it's core)

The main motivation for this is that first {} is an expensive subcall,
whereas grep is a native fast opcode. Within the entire codebase there
are pretty much no spots where we have so many elements to check, that
the "check everything" of grep will overwhelm the expense of entersub
(in fact 2 calls - one to first() itself, another to the block)

As a side effect the removal of first(), which was the only thing
we used that has known leaks prior to L::U 1.18, lets us drop the
"5.8.8+ or later" List::Util dep entirely (it doesn't matter much
for users, but it stresses the CI even more, which is a good thing)

This cangeset should introduce 0 functional changes

8 years agoLose another dependency: Class::Inspector
Peter Rabbitson [Mon, 11 Apr 2016 09:49:56 +0000]
Lose another dependency: Class::Inspector

It is either used in tests (where we cargocult a similar function), or in a
spot where Package::Stash will do

8 years agoRemove dead code from DBI::Replicated
Peter Rabbitson [Tue, 12 Apr 2016 11:27:14 +0000]
Remove dead code from DBI::Replicated

This was originally introduced in fecb38cba, without tests nor justification.
Subsequently it got modified a bit in 7da56142c, and then got completely
broken by bbdda2810 which designated _dbh_details() as an off-limits internal
method.

Given nothing has been heard since (6 years), and there is no effective change
of behavior (the snippet below fails identically below and after this change)
go ahead and burninate.

Also adjust the "can't touch this" exception text a bit.

DBICTEST_VIA_REPLICATED=1 perl -Ilib -It/lib -MDBICTest -e '
  eval { DBICTest->init_schema->storage->$_ }, warn $@
    for qw( _dbh_details _server_info _get_server_version _describe_connection )
'

8 years agoHarmonize DBICTEST_VIA_REPLICATED detection in tests
Peter Rabbitson [Tue, 12 Apr 2016 10:09:03 +0000]
Harmonize DBICTEST_VIA_REPLICATED detection in tests

Back in 8b60b9211a I made a number of mistakes implementing the escape
checks: an envvar being set does not mean we are in fact running under
replication (e.g. the user requested explicitly use_file => 0 )

Fix that and also make sure we still run when use_file => 1 (and fix a
forgotten test failing this way)

8 years agoBring back constants excised in 08a8d8f1. FML.
Peter Rabbitson [Tue, 12 Apr 2016 11:52:04 +0000]
Bring back constants excised in 08a8d8f1. FML.

8 years ago(travis) Add a CLEANTEST run of RURBAN's cperl in the spirit of 62f2092b
Peter Rabbitson [Mon, 11 Apr 2016 13:53:04 +0000]
(travis) Add a CLEANTEST run of RURBAN's cperl in the spirit of 62f2092b

Refer to the (*really* small) patchset for info on how to run the same locally
TLDR: you need to activate distroprefs and use CPAN.pm

8 years ago(travis) Add 5.22.1 with quadmath testing
Peter Rabbitson [Mon, 11 Apr 2016 11:10:53 +0000]
(travis) Add 5.22.1 with quadmath testing

8 years ago(travis) Reorganize POISON_ENV mode
Peter Rabbitson [Mon, 11 Apr 2016 18:24:21 +0000]
(travis) Reorganize POISON_ENV mode

Allow MVDT and BREAK_CC to be separate settings, will make sense in further
commits. This adds extra testing of DEVREL_DEPS with no compiler, which
brings another round of exceptions etc... sigh

Read under -w

8 years ago(travis) Enhance the 'broken compiler' test
Peter Rabbitson [Mon, 11 Apr 2016 15:19:34 +0000]
(travis) Enhance the 'broken compiler' test

8 years agoFix another ::FilterColumn bug sigh...
Peter Rabbitson [Sat, 2 Apr 2016 15:41:52 +0000]
Fix another ::FilterColumn bug sigh...

This one is technically a regression introduced by dc6dadae, which aimed to
solve multiple runs on already-dirty columns. Unfortunately this very same
change broke update(). Overload get_dirty_columns to fix that, and add a
bunch of tests validating nothing crazy is going on.

I should have seen all of these problems when FC was initially considered,
but alas I was too damn inexperienced :/

8 years agoTest with explicitly readonly 'replicants' under DBICTEST_VIA_REPLICATED
Peter Rabbitson [Sat, 2 Apr 2016 13:21:37 +0000]
Test with explicitly readonly 'replicants' under DBICTEST_VIA_REPLICATED

8 years agoFix parsing DSN when the driver part includes DBI attributes
Fabrice Gabolde [Fri, 1 Apr 2016 13:05:42 +0000]
Fix parsing DSN when the driver part includes DBI attributes

8 years agoFix annoying warnings on innocent looking MSSQL code
Peter Rabbitson [Fri, 1 Apr 2016 10:19:51 +0000]
Fix annoying warnings on innocent looking MSSQL code

After several rounds of improvements in the retry logic (84efb6d7, 729656c5)
MSSQL code non-fatally aborting due to clashing multiple active resultsets
would emit an annoying warning. Such warnings are especially baffling when
encountered in innocent-looking code like:

   my $first_bar_of_first_foo = $schema->resultset('Foo')
                                        ->search({ foo => 'fa' })
                                         ->next
                                          ->related_resultset("bar")
                                           ->next;

Since no object destruction takes place until the = operator is executed, the
cursor returning "first foo matching fa" is still active when we run a second
search for the "bars". With default MSSQL settings (i.e. without an enabled
MARS[1] implementation) this leads to an exception on the second ->next().
The failed next() is properly retried, since we are not in transaction or some
similar complicating factor, and the entire thing executes correctly, except
the force-disconnect-before-reconnect-after-failed-ping warns about the first
cursor being still alive.

Add extra stack marker for this particular case, and teach the MSSQL driver to
hide the (at this stage spurious) warning

[1] http://p3rl.org/DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server#MULTIPLE-ACTIVE-STATEMENTS

8 years agoSilence spurious warnings from todoified test
Peter Rabbitson [Fri, 1 Apr 2016 10:05:51 +0000]
Silence spurious warnings from todoified test

8 years agoAvoid infinite loop if save point does not exist
Paul Mooney [Thu, 10 Mar 2016 10:50:57 +0000]
Avoid infinite loop if save point does not exist

8 years agoReally fix SQLite savepoints unlike the shortsighted 398215b1
Peter Rabbitson [Wed, 30 Mar 2016 18:24:49 +0000]
Really fix SQLite savepoints unlike the shortsighted 398215b1

8 years agoFix incorrect exception propagation in ::Replicated::execute_reliably
Peter Rabbitson [Wed, 30 Mar 2016 14:06:48 +0000]
Fix incorrect exception propagation in ::Replicated::execute_reliably

The code makes no sense in its current state, lapse left in after 1abccf54

8 years agoFix *stupid* silencing of exceptions introduced in 4e9fc3f3
Peter Rabbitson [Wed, 30 Mar 2016 13:44:15 +0000]
Fix *stupid* silencing of exceptions introduced in 4e9fc3f3

The reason this has not been detected is because it is virtually impossible
for the stock inflate_result() to throw, and pretty rare for custom ones.

ARGH!

Found and individually vetted all remaining eval()s as in:
grep -Pnr -B2 -A7 '^(?!\s*#).*?\beval\b' lib | less

8 years agoStore collapser source in the resultset private metadata as well
Peter Rabbitson [Wed, 23 Mar 2016 13:05:10 +0000]
Store collapser source in the resultset private metadata as well

After 05a5ca4b the deparse of the row-parser coderef is incomprehensible at
best. Add the source to the private cache structure to aid debugging if it
ever becomes necessary (fingercross it won't be). Aside from the explicit
evaluation package name, and the slight change of the return of _mk_row_parser
there are no functional changes

Read under -w

8 years agoStep up the error reporting on unexpected NULLs during collapse
Peter Rabbitson [Fri, 25 Mar 2016 13:28:42 +0000]
Step up the error reporting on unexpected NULLs during collapse

The collapser became so complex that it is practically impossible to debug
when things go sideways. Expand the rudimentary "just check root identifier"
to a comprehensive check of all identifier groups, at the expense of some
performance. This builds on top of the {nullchecks} metadata collected in
5ff6d603, generating maximally unrolled definedness checks which cause an
early return with no results and flagged unexpected-null-positions

The commit itself is relatively straightforward, though the meager changeset
in lib/ is misleading: the damned thing took almost 8 days to fully think
through and implement with several detours for bugfixing :/

8 years agoFirst part of changes for better unexpected NULL reporting
Peter Rabbitson [Thu, 24 Mar 2016 15:22:44 +0000]
First part of changes for better unexpected NULL reporting

Doing things in two parts to make it easier to reason about. This part only
changes the collapse_map visitor to collect more metadata, and uses a bit
of it to elide a couple of // ops.

Additionally we are now feeding the stash-arrayref to the collapser at all
times, it will become clear way in the next commit (where all the real
changes are)

Read under -w

8 years agoSupport one more convoluted case of data-poor collapse
Peter Rabbitson [Fri, 25 Mar 2016 17:15:34 +0000]
Support one more convoluted case of data-poor collapse

Any might_have ( optional, 1:1 ) relation with a fully defined left-side is
identifiable as long as at least one non-nullable (not necessarily unique)
column is fetched

8 years agoRemove confusing code introduced in 8fc4291e
Dagfinn Ilmari Mannsåker [Tue, 29 Mar 2016 12:10:39 +0000]
Remove confusing code introduced in 8fc4291e

<ilmari> but why is $dump_str declared outside dump_value?
<ribasushi> ilmari: silly minimalistic microoptimization (not to reclear the dump every time it's needed)
<ribasushi> ilmari: my $foo { reuse $foo many time in this scope } *minimally faster* than { use my $foo_to_be_cleared_any_time_we_leave_scope }
<ribasushi> less for the scope unwinder to do
<ribasushi> as I said - it's silly, and 100% undetectable
<ilmari> is dump_value that hot?
<ribasushi> it's not hot at all
<ilmari> we've probably wasted more time discussing this now than the total CPU time saved by that micro-optimisation, over the entire future lifetime of DBIC
<ribasushi> ilmari: well, my 1st sentence today was admitting exactly that ;)
<ribasushi> I have been working on the rowparser for 5 days, the mindset is different, and it "bleeds through"

8 years agoMore tests and tighter code with better error reporting in collapser maker
Peter Rabbitson [Mon, 28 Mar 2016 16:56:46 +0000]
More tests and tighter code with better error reporting in collapser maker

Additionally RowParser::Util was scanned with Devel::Core to ensure I don't
have any remaining holes similar to 1fd3505d. The coverage of said file is
not at 100%, due to bugs in Devel::Cover itself, notably handling of
$x = $y || $z ( https://github.com/pjcj/Devel--Cover/issues/154 )

8 years agoFix incorrect data returned in a corner case of partial-select HRI
Peter Rabbitson [Sat, 26 Mar 2016 22:14:09 +0000]
Fix incorrect data returned in a corner case of partial-select HRI

While investigating better reporting on disagreeing metadata and actual
results returned by the data source, I stumbled across an incorrect
optimization applied to the HRI fast-path in aa1d8a87. The reason this has
never been a problem in the wild is that the failure case is very convoluted:

In order for the problem to present itself one needs to have a subchain of
... something-single ... with the "something" not fetching anything
AND the entire chain being hit exactly once (no multiplication of the branch
neither by a result or a parallel 1:M) AND the HRI fast-path code needs to be
in effect. Then and only then everything from "something"onwards will present
as "nonexisting left join" and a sole undef will be returned in place of the
entire substructure.

8 years agoLose yet another dep (Data::Dumper::Concise)
Peter Rabbitson [Mon, 28 Mar 2016 20:50:55 +0000]
Lose yet another dep (Data::Dumper::Concise)

8 years agoRemove some old forgotten pieces of code in collapse resolver
Peter Rabbitson [Thu, 24 Mar 2016 14:35:51 +0000]
Remove some old forgotten pieces of code in collapse resolver

8 years agoMake sure handling of exception_action is recursion-safe
Peter Rabbitson [Fri, 12 Feb 2016 08:27:38 +0000]
Make sure handling of exception_action is recursion-safe

Pointed out by Lukas Mai in the last (fifth) bullet point of
https://github.com/PerlDancer/Dancer2/issues/1125#issuecomment-180326756

In addition add extra testing making sure that we will not inadvertently
silence $SIG{__DIE__} when the error is *not* transient

Hopefully this is the last piece of the "clean transient exceptions" puzzle,
it's already been way too much faffing: 7cb35852, ddcc02d1 and 5c33c8be :(

8 years agoExpand ASSERT_NO_SPURIOUS_EXCEPTION_ACTION to set a rogue $SIG{__DIE__}
Peter Rabbitson [Tue, 22 Mar 2016 22:43:19 +0000]
Expand ASSERT_NO_SPURIOUS_EXCEPTION_ACTION to set a rogue $SIG{__DIE__}

This simple augmentation of ddcc02d1 caught a couple extra spots where a
__DIE__ handler could be incorrectly triggered (one of them ironically
introduced by 86cdddbe which happened *after* the work in ddcc02d1)

See next commit for *YET MORE* of the same...

8 years agoBetter testing that RT#63874 being fully fixed by ddcc02d1
Peter Rabbitson [Fri, 12 Feb 2016 08:27:38 +0000]
Better testing that RT#63874 being fully fixed by ddcc02d1

Also separate some of the basic find() tests to a new testfile

8 years agoFix failing test case missed during da9346a03
Peter Rabbitson [Thu, 10 Mar 2016 20:32:35 +0000]
Fix failing test case missed during da9346a03

Adjust CI to execute one job as a non-poisoning noisy tracer

8 years agoReally work around RT#108390 (630e2ea8a)
Peter Rabbitson [Thu, 10 Mar 2016 18:02:00 +0000]
Really work around RT#108390 (630e2ea8a)

A certain chain of events can still deadlock things without an explicit flush

8 years agoMove expensive test to xt/, add malloc-canary preventing false-negatives
Peter Rabbitson [Thu, 3 Mar 2016 14:27:34 +0000]
Move expensive test to xt/, add malloc-canary preventing false-negatives

This test was originally written to validate both Devel::GlobalDestruction::PP
and the M.A.D. cyclic reference handler (a4367b26). These days it makes little
sense to run on end-user installs, yet this bizarre test still uncovers weird
problems in the underlying Rube Goldberg machine.

So instead of outright deleting it - move it to xt/ and validate its execution
environment with what is essentially a guarded calloc()

Add a tight-memory travis config to make sure that OOM won't kill the wrong
thing

Read diff under -C

8 years ago(travis) Strangely `cpan .` does not work in certain configs
Peter Rabbitson [Wed, 9 Mar 2016 16:48:16 +0000]
(travis) Strangely `cpan .` does not work in certain configs

No intention to investigate further at this time

8 years ago(travis) Make sure DEVREL_DEPS + CLEANTEST-false behaves as intended
Peter Rabbitson [Tue, 8 Mar 2016 17:29:41 +0000]
(travis) Make sure DEVREL_DEPS + CLEANTEST-false behaves as intended

This lapse was the reason https://github.com/Test-More/test-more/issues/637
went undetected for a while (also made me aware of RT#112312, ARGH!)

8 years agoMuch simpler sure-flush on dirty exit ( ribasushi-- # overcomplicating )
Matthew Horsfall [Tue, 8 Mar 2016 14:15:04 +0000]
Much simpler sure-flush on dirty exit ( ribasushi-- # overcomplicating )

8 years agoRestructure thread/fork tests to run with maximum concurrency
Peter Rabbitson [Sat, 5 Mar 2016 14:32:11 +0000]
Restructure thread/fork tests to run with maximum concurrency

Add better exit handling on older perls: the thread-related failures on
global destroy have nothing to do with what we want to test. Activated by
setting $ENV{DBICTEST_DIRTY_EXIT}

Also reduce the default amount of workers - 10 is too many

8 years agoFix erroneous use of multidimensional array emulation in 1fb834df
Dagfinn Ilmari Mannsåker [Mon, 7 Mar 2016 15:25:59 +0000]
Fix erroneous use of multidimensional array emulation in 1fb834df

8 years ago(optdeps) _gen_pod can *very much* fail, not sure what I was thinking
Peter Rabbitson [Sun, 6 Mar 2016 06:08:56 +0000]
(optdeps) _gen_pod can *very much* fail, not sure what I was thinking

8 years agoThese files are not used by anything - remnants from the distant ea2e61bf
Peter Rabbitson [Sat, 5 Mar 2016 13:43:44 +0000]
These files are not used by anything - remnants from the distant ea2e61bf

8 years agoApparently -i and -jN do not work on win32, what the hell
Peter Rabbitson [Fri, 4 Mar 2016 18:55:39 +0000]
Apparently -i and -jN do not work on win32, what the hell

These fixes together with RT#112706 make distbuilding on SighOS possible again

Also adjust a number of whitespace checks to work properly, ensuring the
distdir built on a normal OS and on Win32 match.

Read under diff -w -C

8 years agoMore robust behavior of ANFANG.pm, also guard against sitecustomize.pl
Peter Rabbitson [Fri, 4 Mar 2016 15:24:27 +0000]
More robust behavior of ANFANG.pm, also guard against sitecustomize.pl

8 years agoDo not load DBIC::Optional::Dependencies at runtime unless we need to
Peter Rabbitson [Thu, 3 Mar 2016 11:24:55 +0000]
Do not load DBIC::Optional::Dependencies at runtime unless we need to

8 years ago(optdeps) One last pass through tests, streamline skip messages
Peter Rabbitson [Sun, 10 Jan 2016 14:26:40 +0000]
(optdeps) One last pass through tests, streamline skip messages

8 years agoGet rid of Path::Class ( that *does* feel good )
Peter Rabbitson [Mon, 11 May 2015 10:39:39 +0000]
Get rid of Path::Class ( that *does* feel good )

This was a rather long journey (I've been meaning to do this since ~2013).
As everything else it turned out more complex than I anticipated. Notably
due to having to implement from semi-scratch things that a dev should usually
never worry about >:( Just look at the amount of stuff one can't reasonably
trust these days (pay attention to the comments):

 git show 5d54c117 | perl -ne 'print if 155..304' | less
 git show 358a3aa7 | perl -ne 'print if 407..453' | less

There is a tangible difference in the smoke times due to a leaner set of deps
(though not as big as one would hope... yet). Sample timings as follows:

for n in $(seq 26); do
  dbic_trv_diffable() {
    perl -0777 -n -E '
      print ( map { "$ENV{cur}: $_\n" } map { split /\r?\n/, $_ }
        $_ =~ /(^TRAVIS_PERL_VERSION.+)/m,
        $_ =~ / \QSetting environment variables\E .+? (?:\r?\n)+ (.+?) (?: \r?\n){2} /xms,
        $_ =~ /(^.*Configuration phase seems to have taken.*)/m,
      );
      say (
        $_ =~ /(^[^\n]*?List of loadable modules .+?)^[^\n]*?List of loadable modules/ms
      );
    '
  }
  x=$((112987257 + $n)) &&\
  y=$((113113497 + $n)) &&\
  echo -e "$x => $y\n========\n" &&\
  diff -U0 \
    <( wget -qO- s3.amazonaws.com/archive.travis-ci.org/jobs/$x/log.txt | \
        cur=$x dbic_trv_diffable )\
    <( wget -qO- s3.amazonaws.com/archive.travis-ci.org/jobs/$y/log.txt | \
        cur=$y dbic_trv_diffable )
done | less

P.S. The above is hideous, yes, but you can run it in your terminal *directly*

8 years agoSeveral cosmetic fixups, making next commit easier to read
Peter Rabbitson [Tue, 1 Mar 2016 20:49:56 +0000]
Several cosmetic fixups, making next commit easier to read

No notable functional changes, mostly de-File::Spec-ing spots that do not need
it ( '/' works on Win32 just fine, and VMS is a looooong way off )

8 years agoStop loading Time::HiRes in the base test schema - there is no need
Peter Rabbitson [Mon, 15 Feb 2016 11:40:34 +0000]
Stop loading Time::HiRes in the base test schema - there is no need

Switch all spots to a select()-based sleep instead

8 years agoUntangle strictly-DBICTest constant from the main constant set
Peter Rabbitson [Sun, 14 Feb 2016 10:39:14 +0000]
Untangle strictly-DBICTest constant from the main constant set

Not sure what I was thinking when I wrote this

8 years agoMove tmpdir() to DBICTest::Util where it belongs
Peter Rabbitson [Wed, 17 Feb 2016 10:01:20 +0000]
Move tmpdir() to DBICTest::Util where it belongs

This detangles things even more. Add some extra logic fixes to the hideous
routine while we are at it...

Some notes on the actual test pefrormed: there have been cases on smokers
where a returned directory was not in fact writable [1]. Thus work harder
making sure everything works. The check is expensive but not terribly so:
about 14ms on cold caches ( echo 3 > /proc/sys/vm/drop_caches ) and ~6ms
thereafter. This adds up to 2 seconds over the current 320 tests. Timed via:

~$ perl -It/lib -Ilib -MANFANG -MDBICTest::Util=tmpdir -MTime::HiRes=time -e '
  my $t0 = time;
  sub delta_t { my $t = time; printf "%.06f\n", $t - $t0; $t0 = $t }

  delta_t();
  print tmpdir . "\n";
  delta_t();
  print tmpdir . "\n";
  delta_t();
  print tmpdir . "\n";
  delta_t();
'

[1] http://www.cpantesters.org/cpan/report/36d4436d-7888-1014-a278-e5322b825c07

8 years agoRevert ab340f7f - it no longer makes sense given the excellent CI setup
Peter Rabbitson [Mon, 15 Feb 2016 11:42:13 +0000]
Revert ab340f7f - it no longer makes sense given the excellent CI setup

There should be no functional changes / difference in behavior (the config
option is named differently, and is inverted in meaning)

Verified no change in behavior (at least on CI) via:
( not checking all 20+ jobs as the log-counter jumps towards the end )

for n in $(seq 18) ; do
  x=$((112787688 + $n)) && \
  y=$((112787738 + $n)) && \
  echo "$x => $y" && \
  diff -U0 \
    <(wget -qO- https://s3.amazonaws.com/archive.travis-ci.org/jobs/$x/log.txt | \
      perl -0777 -n -E 'say ( ($_ =~ /List of loadable modules within both the core and(.+?)List of loadable modules within both the core and/s )[0] )') \
    <(wget -qO- https://s3.amazonaws.com/archive.travis-ci.org/jobs/$y/log.txt | \
      perl -0777 -n -E 'say ( ($_ =~ /List of loadable modules within both the core and(.+?)List of loadable modules within both the core and/s )[0] )')
done | less

This also happened to find https://rt.cpan.org/Ticket/Display.html?id=112601

8 years agoInstitute a central "load this first in testing" package
Peter Rabbitson [Mon, 29 Feb 2016 10:35:26 +0000]
Institute a central "load this first in testing" package

Instead of the hodge-podge of "what loads first where" make a verified focal
package and move some of the stuff within DBICTest::RunMode there

There are no other changes aside from the load order

8 years agoMove find_co_root into DBICTest::Util
Peter Rabbitson [Sun, 28 Feb 2016 12:37:46 +0000]
Move find_co_root into DBICTest::Util

This is the first step of rearranging the utility pieces, removing reliance
on Path::Class in general

No visible functional changes, the old sub _find_co_root left as-is for the
time being, with an eval wrapped around it to retain the old "best effort"
behavior. Will be revisited in subsequent commits.

8 years agoRevert part of bbcc1fe8 - the 'queue unstick hack' belongs in DBICTest
Peter Rabbitson [Sun, 28 Feb 2016 13:04:08 +0000]
Revert part of bbcc1fe8 - the 'queue unstick hack' belongs in DBICTest

DBICTest::Util is more likely to be loaded before Test::More, voiding the
check in the BEGIN. DBICTest on the other hand is almost invariably loaded
after T::M.

8 years ago(optdep) last-from-block is a compile-time warning, silence properly
Peter Rabbitson [Mon, 29 Feb 2016 11:50:54 +0000]
(optdep) last-from-block is a compile-time warning, silence properly

Without this we do get warnings under RELEASE_TESTING=1 as warnings are then
enabled file-wide

8 years agoSwitch the main dev branch back to 'master'
Peter Rabbitson [Fri, 26 Feb 2016 08:57:27 +0000]
Switch the main dev branch back to 'master'

Previously the idea was to have two dev branches - one for "the crowd", and
another one for the rel manager to do periodic squashes, merges, cleanups etc.
This worked rather well for about 1.5 years, but with the primary architect
outgoing it can't be sustained, and only serves to confuse everyone.

Thus a fast forward with a mini-merge of master up to the tip of current/blead
and continuing pushes to master alone from there on. Not yet deleting the old
'current/blead' and 'current/for_cpan_index' branches, as it affects PR states
due to useless "smarts" in the github logic.

8 years ago(travis) Display TAP directives on single threaded CI runs current/blead current/for_cpan_index
Peter Rabbitson [Sat, 13 Feb 2016 20:38:31 +0000]
(travis) Display TAP directives on single threaded CI runs

Add a couple extra single-thread runs, shouldn't take *that* much longer

8 years ago(travis) Fix INC-poison thinko from 6d74b82cc
Peter Rabbitson [Thu, 18 Feb 2016 04:46:00 +0000]
(travis) Fix INC-poison thinko from 6d74b82cc

Ensure stable DBIC is in fact in INC by test time ( detected courtesy of the
@INC-state reporter in t/00describe_environment.t \o/ )

8 years ago(travis) Revert version.pm workaround dd94f6ef
Peter Rabbitson [Thu, 18 Feb 2016 04:14:29 +0000]
(travis) Revert version.pm workaround dd94f6ef

8 years agoEeeeep /x doesn't affect the insides of [...]
Peter Rabbitson [Sat, 13 Feb 2016 17:27:11 +0000]
Eeeeep /x doesn't affect the insides of [...]

8 years agoApply debian downstream spelling patch 481e21bf
gregor herrmann [Sat, 13 Feb 2016 18:56:13 +0000]
Apply debian downstream spelling patch 481e21bf

8 years agoAdjust Changes to reflect what was shipped in 0.082821
Peter Rabbitson [Sat, 13 Feb 2016 20:01:48 +0000]
Adjust Changes to reflect what was shipped in 0.082821

8 years agoAdd experimental meta flags signifying the status of parallel testing
Peter Rabbitson [Thu, 11 Feb 2016 17:07:51 +0000]
Add experimental meta flags signifying the status of parallel testing

8 years agoAdd explicit patronage listing (should have done this a while ago)
Peter Rabbitson [Thu, 11 Feb 2016 17:52:40 +0000]
Add explicit patronage listing (should have done this a while ago)

Not generalizing it (yet) as patrons are few and far between

8 years agoProper fix for the lazy workaround in 7e1774f7
Dagfinn Ilmari Mannsåker [Mon, 8 Feb 2016 16:31:22 +0000]
Proper fix for the lazy workaround in 7e1774f7

Pure-perl subs return values as mortal copies on the stack, incrementing
the reference count until the next statement.  In the case of the last
statement in a sub, that is in the caller, after the other lexicals have
been GCed.

  if ( ... ) { ... };

counts as a single statement for this purpose, since it compiles to

  ( ... ) && do { ... };

The reason this doesn't bite when using XS is that Class::XSAcessor
returns the SV directly from the hash, rather than a mortal copy, so the
reference count never gets incremented.

Generalize the fix to a similar problem (8e9b9ce5) and pepper potentially
problematic codepaths with explicit NEXTSTATEs. Many of the changes do not
resolve anything as there is no "statement leakage" in most of this code,
but it is a good idea to have them there nevertheless: This way future
code-flow modifications will not accidentally reintroduce this problem.

8 years agoSilence more spurious warnings (this one is a serious wtf)
Peter Rabbitson [Thu, 4 Feb 2016 09:30:30 +0000]
Silence more spurious warnings (this one is a serious wtf)

Seen in no-XS CI (e.g https://travis-ci.org/dbsrgits/dbix-class/jobs/106811389)
on all perls and too involved to diagnose properly given the tight schedule

Just go for a cop out

8 years agoDo our best to disconnect on request (goes with 45792de6)
Peter Rabbitson [Thu, 4 Feb 2016 09:18:51 +0000]
Do our best to disconnect on request (goes with 45792de6)

This ensures that a failed rollback won't leave is in a weird state

8 years agoRemove statement cache eviction before disconnect
Peter Rabbitson [Thu, 4 Feb 2016 08:54:13 +0000]
Remove statement cache eviction before disconnect

This was added for no apparent reason with a ton of other code in f200d74b.
It is known to have unintended effects on at least ::Pg handles (as detailed
in theory/dbix-connector/issues/39) and generally seems like a gratuitous
action to take.

Given it doesn't seem to add extra noise on any of the test runs - kill it
with fire.

8 years agoStreamline couple code paths/texts, no func changes (goes with 7cb35852)
Peter Rabbitson [Thu, 4 Feb 2016 09:16:40 +0000]
Streamline couple code paths/texts, no func changes (goes with 7cb35852)

8 years agoProtect DBIC as best we can from the failure mode in 7cb35852
Peter Rabbitson [Wed, 3 Feb 2016 00:32:00 +0000]
Protect DBIC as best we can from the failure mode in 7cb35852

The main idea is that while exception_action works just like $SIG{__DIE__},
this is less than ideal as non-sufficiently-careful software can completely
abort a callstack by goto()-ing out of it (not to mention the annoyance of
users when receiving callbacks on exceptions that DBIC later handles).

So this changeset makes exception_action() behave *better* than $SIG{__DIE__}
by meticlously annotating every DBIC-internal recoverable-exception site and
ensuring that exception_action (and any $SIG{__DIE__} callback) is not
invoked in this case ( see the diff of t/61findnot.t specifically )

This is a rather heavy and involved set of changes, but there seems to be no
other way to go around this. There were complaints already due to firing o
handlers on recoverable errors, but this is the first time the integrity of
the actul DBIC code flow was broken. Thus an executive decision was made to
solve this for good (took about 2 full days of work, sigh...)

The main part of this changset is in ::Schema.pm and ::_Util.pm, the rest is
simply switching from try/eval =>  dbic_internal_try. Some codepaths can not
be executed due to lack of RDBMS, but afaict it all works.

The changes were audited by a combination of:

  watch -x grep -rnP --exclude='*.pod' '^(?!\s*\#).*?(\beval\b|\btry\b)' lib

  git diff HEAD^ \
  |  perl -0777 -e 'my $str = <>; while( $str =~ /(?:\A|^index)(.+?)(?:^diff|\z)/gsm) { my $substr = $1; warn $substr if ( $substr =~ /dbic_internal_try/ and $substr !~ /DBIx::Class::_Util/ ) }' 2>&1 \
  | less

And a BaseSchema.pm exception_action hook which registers failures on any
invocation which is not paired with an eval/thows_ok/etc in a t/**.t frame.
In other words we make sure when exception_action is invoked - a test is there
waiting for the resulting exception, assuming any other exception is transient
( needs DBICTEST_ASSERT_NO_SPURIOUS_EXCEPTION_ACTION to be set ).

Additionally there is a global CI-enabled Try::Tiny::try override which fails
on calls from within the DBIx::Class namespace.

8 years agoCleaner assertion envvar handling
Peter Rabbitson [Tue, 15 Dec 2015 22:26:07 +0000]
Cleaner assertion envvar handling

No functional changes, aside from making few envvars always set on CI

8 years agoFix test failure with DBD::mysql < 4.023 introduced in 729656c5
Peter Rabbitson [Wed, 3 Feb 2016 18:39:56 +0000]
Fix test failure with DBD::mysql < 4.023 introduced in 729656c5

8 years agoDetect and very loudly warn about Return::Multilevel in exception_action()
Peter Rabbitson [Tue, 2 Feb 2016 10:23:04 +0000]
Detect and very loudly warn about Return::Multilevel in exception_action()

8 years agoRemove gratuituous use of eval
Peter Rabbitson [Wed, 3 Feb 2016 00:30:36 +0000]
Remove gratuituous use of eval

8 years agoRemove last remaining accesses to ->VERSION in lib
Peter Rabbitson [Sat, 24 Jan 2015 15:16:14 +0000]
Remove last remaining accesses to ->VERSION in lib

Beef up and streamline (with caching) the ::_Util mod version checks

Read under -w

8 years agoStreamline BYTEA (binary) Pg optdeps using the new augmentation system
Peter Rabbitson [Mon, 19 Jan 2015 14:00:42 +0000]
Streamline BYTEA (binary) Pg optdeps using the new augmentation system

Read under -w

8 years agoRemove Config::Any from the core dep set
Peter Rabbitson [Sat, 9 May 2015 12:20:28 +0000]
Remove Config::Any from the core dep set

Originally introduced by b6cd6478, the dep is used *very* rarely. Relegate
it to optdep state instead, thus removing a Module::Pluggable entry from the
depchain (evicted from core in 5.20)

8 years agoRemove dead code commented out since 2006 ( 953a18ef )
Peter Rabbitson [Tue, 2 Feb 2016 18:16:20 +0000]
Remove dead code commented out since 2006 ( 953a18ef )

The todo test it refers to are either the ones deleted in 8452e496 OR the ones
still there in t/relationship/core.t:

 git log -S'relationship checking needs fixing'

8 years agoEnsure the $storage state reflects the current connection state closely
Peter Rabbitson [Wed, 27 Jan 2016 12:35:55 +0000]
Ensure the $storage state reflects the current connection state closely

Add several extra calls to ->disconnect, ensuring that oddball events do not
leave things in an undefined state. Even more rather hideous testcases, looks
like that problem has been nailed now. Several remain, see next commits :(

8 years agoAnother overhaul (hopefully one of the last ones) of the rollback handling
Peter Rabbitson [Wed, 27 Jan 2016 11:27:25 +0000]
Another overhaul (hopefully one of the last ones) of the rollback handling

This subsystem has seen several passes (most notably 90d7422fc), all of them
utterly misguided and of rather terrible quality :( Lay groundwork for a saner
system by consolidating the "rollback after exception, with potential rewrite"
mechanism. There should be no notably changes in behavior (aside from several
transaction texts), for that see next commit.

Contains a rather hideous piece of code propagated over several years. Not
tackling that yet, as too many things are in motion.

Read under -w

8 years agoRemove useless try{} and rename some variables in ::TxnScopeGuard
Peter Rabbitson [Wed, 27 Jan 2016 17:12:00 +0000]
Remove useless try{} and rename some variables in ::TxnScopeGuard

No functional changes, read under --color-words

8 years agoConsolidate various $storage state resets in $storage->disconnect()
Peter Rabbitson [Fri, 22 Jan 2016 12:07:49 +0000]
Consolidate various $storage state resets in $storage->disconnect()

Currently no functional changes, but see next commits

8 years agoMake sure Win32-like DBICTest checks are not tripped by repeated disconnects
Peter Rabbitson [Fri, 22 Jan 2016 13:14:58 +0000]
Make sure Win32-like DBICTest checks are not tripped by repeated disconnects

8 years agoEven more elaborate txnguard testing, augmenting 6e102c8f
Peter Rabbitson [Mon, 14 Dec 2015 11:08:31 +0000]
Even more elaborate txnguard testing, augmenting 6e102c8f

Essentially this ensures the claim in 35cf7d1af (exception codepaths within
DBIC are not affected by a leftover non-cooperative exception object present
in $@) is semi-correct

Read under -w

8 years agoThrow away remnant commented out in 36099e8c
Peter Rabbitson [Mon, 14 Dec 2015 10:40:21 +0000]
Throw away remnant commented out in 36099e8c

The stuff being tested is too touchy already to try adding extra sugar to the
test. If anything further moving away from Test::* might be in order.

8 years agoRelax overly aggressive exception-well-formedness checks from 84e4e006
Peter Rabbitson [Sun, 13 Dec 2015 16:25:38 +0000]
Relax overly aggressive exception-well-formedness checks from 84e4e006

Given that the actual exception codepaths within DBIC are not affected by
a leftover non-cooperative exception object present in $@, it is rather
counterproductive to warn out the PSA in these cases

8 years agoMicrooptimize various "is this string empty" checks
Peter Rabbitson [Mon, 14 Dec 2015 09:18:17 +0000]
Microoptimize various "is this string empty" checks

Checking the truthiness of the separately tracked string length is vastly
faster than doing actual string comparison

Working set identified via: grep -nPr "\b(ne|eq)\b\s*(\"\"|''|q{}|q())" lib

8 years agoRemove all uses of Scope::Guard from the tests, use our own version
Peter Rabbitson [Tue, 14 Feb 2012 22:13:30 +0000]
Remove all uses of Scope::Guard from the tests, use our own version

A deferred constraints rework several commits later will remove all remaining
uses from lib/ and as such we will lose the dep entirely

8 years agoAdd the repository-specific git config include (git >= 1.7.10)
Peter Rabbitson [Tue, 19 Jan 2016 21:08:10 +0000]
Add the repository-specific git config include (git >= 1.7.10)

!!! NOTE - potential security RISK !!!

 You *MUST*
  - check the file is legit:
     git diff 7eb1f0e165a4 maint/git_config_dbic.inc

  - copy the file to your .git directory:
     cp maint/git_config_dbic.inc .git/

  - and include it:
     git config --add include.path git_config_dbic.inc

 **NEVER** include the file directly from the repository itself, e.g.

 [include]
   path = ../maint/git_config_dbic.inc

!!! NOTE - potential security RISK !!!

Adds extra maint-specific repositories, and defines two gitk shortcuts:

 `git vis` - showing all current heads/stashes of interest in progress
 `git prvis` - showing all unattended to github PRs