Bug in Catalyst::Model::DBIC::Schema ?

6 messages Options
Embed this post
Permalink
Oleg Pronin

Bug in Catalyst::Model::DBIC::Schema ?

Reply Threaded More More options
Print post
Permalink
Hello.

I've just upgraded to last cat & dbic & related and i get error with my model.
I use custom DBI class for my DB connection persistence

package Myapp::Model::General;
use parent 'Catalyst::Model::DBIC::Schema';
use strict;
use DBIx::RetryOverDisconnects;

__PACKAGE__->config(
    schema_class => 'Myapp::Schema',
    connect_info => [
        sub {DBIx::RetryOverDisconnects->connect(...)},
        {
            quote_char => q{"},
            name_sep   => q{.},
        },
    ],
);

DBIx::Class::Storage::DBI docs:
A single code reference which returns a connected DBI database handle
optionally followed by extra attributes recognized by DBIx::Class:
  $connect_info_args = [ sub { DBI->connect (...) }, \%extra_attributes? ];


But with newest Catalyst::Model::DBIC::Schema i get error:

Couldn't instantiate component "Myapp::Model::General", "invalid
connect_info at
/usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Model/DBIC/Schema/Types.pm
line 86.

It seems that Catalyst/Model/DBIC/Schema/Types.pm does not support SUB
REF in connect info anymore. Is that a bug or feature ?

Thanks.

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Rafael Kitover

Re: Bug in Catalyst::Model::DBIC::Schema ?

Reply Threaded More More options
Print post
Permalink
Should have that fixed in a week or so.

On Wed, Aug 26, 2009 at 10:43:22PM +0400, Oleg Pronin wrote:

> Hello.
>
> I've just upgraded to last cat & dbic & related and i get error with my model.
> I use custom DBI class for my DB connection persistence
>
> package Myapp::Model::General;
> use parent 'Catalyst::Model::DBIC::Schema';
> use strict;
> use DBIx::RetryOverDisconnects;
>
> __PACKAGE__->config(
>     schema_class => 'Myapp::Schema',
>     connect_info => [
>         sub {DBIx::RetryOverDisconnects->connect(...)},
>         {
>             quote_char => q{"},
>             name_sep   => q{.},
>         },
>     ],
> );
>
> DBIx::Class::Storage::DBI docs:
> A single code reference which returns a connected DBI database handle
> optionally followed by extra attributes recognized by DBIx::Class:
>   $connect_info_args = [ sub { DBI->connect (...) }, \%extra_attributes? ];
>
>
> But with newest Catalyst::Model::DBIC::Schema i get error:
>
> Couldn't instantiate component "Myapp::Model::General", "invalid
> connect_info at
> /usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Model/DBIC/Schema/Types.pm
> line 86.
>
> It seems that Catalyst/Model/DBIC/Schema/Types.pm does not support SUB
> REF in connect info anymore. Is that a bug or feature ?
>
> Thanks.

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Rafael Kitover

Re: Bug in Catalyst::Model::DBIC::Schema ?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Oleg Pronin
By the way, DBIC does its own seemless retry on disconnects.

Does DBIx::RetryOverDisconnect offer anything special aside from this?

On Wed, Aug 26, 2009 at 10:43:22PM +0400, Oleg Pronin wrote:

> Hello.
>
> I've just upgraded to last cat & dbic & related and i get error with my model.
> I use custom DBI class for my DB connection persistence
>
> package Myapp::Model::General;
> use parent 'Catalyst::Model::DBIC::Schema';
> use strict;
> use DBIx::RetryOverDisconnects;
>
> __PACKAGE__->config(
>     schema_class => 'Myapp::Schema',
>     connect_info => [
>         sub {DBIx::RetryOverDisconnects->connect(...)},
>         {
>             quote_char => q{"},
>             name_sep   => q{.},
>         },
>     ],
> );
>
> DBIx::Class::Storage::DBI docs:
> A single code reference which returns a connected DBI database handle
> optionally followed by extra attributes recognized by DBIx::Class:
>   $connect_info_args = [ sub { DBI->connect (...) }, \%extra_attributes? ];
>
>
> But with newest Catalyst::Model::DBIC::Schema i get error:
>
> Couldn't instantiate component "Myapp::Model::General", "invalid
> connect_info at
> /usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Model/DBIC/Schema/Types.pm
> line 86.
>
> It seems that Catalyst/Model/DBIC/Schema/Types.pm does not support SUB
> REF in connect info anymore. Is that a bug or feature ?
>
> Thanks.

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Oleg Pronin

Re: Bug in Catalyst::Model::DBIC::Schema ?

Reply Threaded More More options
Print post
Permalink
ammm... yes. it is needed for daemon servers (in my case - mmo game
servers). Sometimes database goes down for 10-15 secs due to network
failure or gets restarted by admin (30 secs downtime). Game server
should not feel it, it handles thousands of gamers online with huge
amount of game data in memory. It is better for him to get blocked a
while than die. Original DBIC's storage reconnect have only one try
but this is not enough. DBIx::Retry can handle configurable number of
reconnect tries with some interval. It transparent for DBIC and it's
own reconnect mechanism never initiated.

Of course in case of web only site without online servers it is not
needed and original DBIC's mechanism is fully acceptable.

2009/8/29 Rafael Kitover <[hidden email]>:

> By the way, DBIC does its own seemless retry on disconnects.
>
> Does DBIx::RetryOverDisconnect offer anything special aside from this?
>
> On Wed, Aug 26, 2009 at 10:43:22PM +0400, Oleg Pronin wrote:
>> Hello.
>>
>> I've just upgraded to last cat & dbic & related and i get error with my model.
>> I use custom DBI class for my DB connection persistence
>>
>> package Myapp::Model::General;
>> use parent 'Catalyst::Model::DBIC::Schema';
>> use strict;
>> use DBIx::RetryOverDisconnects;
>>
>> __PACKAGE__->config(
>>     schema_class => 'Myapp::Schema',
>>     connect_info => [
>>         sub {DBIx::RetryOverDisconnects->connect(...)},
>>         {
>>             quote_char => q{"},
>>             name_sep   => q{.},
>>         },
>>     ],
>> );
>>
>> DBIx::Class::Storage::DBI docs:
>> A single code reference which returns a connected DBI database handle
>> optionally followed by extra attributes recognized by DBIx::Class:
>>   $connect_info_args = [ sub { DBI->connect (...) }, \%extra_attributes? ];
>>
>>
>> But with newest Catalyst::Model::DBIC::Schema i get error:
>>
>> Couldn't instantiate component "Myapp::Model::General", "invalid
>> connect_info at
>> /usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Model/DBIC/Schema/Types.pm
>> line 86.
>>
>> It seems that Catalyst/Model/DBIC/Schema/Types.pm does not support SUB
>> REF in connect info anymore. Is that a bug or feature ?
>>
>> Thanks.
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@...
>

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Oleg Pronin

Re: Bug in Catalyst::Model::DBIC::Schema ?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Rafael Kitover
P.S.
   Of course this is very rarely needed but the advantage is that it
is protected on low-level and you can even get $sth object and work
with it and still be protected.
   In my own opinion this feature should be in DBI's core in XS

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Rafael Kitover

Re: Bug in Catalyst::Model::DBIC::Schema ?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Oleg Pronin
Fixed in 0.29

On Wed, Aug 26, 2009 at 10:43:22PM +0400, Oleg Pronin wrote:

> Hello.
>
> I've just upgraded to last cat & dbic & related and i get error with my model.
> I use custom DBI class for my DB connection persistence
>
> package Myapp::Model::General;
> use parent 'Catalyst::Model::DBIC::Schema';
> use strict;
> use DBIx::RetryOverDisconnects;
>
> __PACKAGE__->config(
>     schema_class => 'Myapp::Schema',
>     connect_info => [
>         sub {DBIx::RetryOverDisconnects->connect(...)},
>         {
>             quote_char => q{"},
>             name_sep   => q{.},
>         },
>     ],
> );
>
> DBIx::Class::Storage::DBI docs:
> A single code reference which returns a connected DBI database handle
> optionally followed by extra attributes recognized by DBIx::Class:
>   $connect_info_args = [ sub { DBI->connect (...) }, \%extra_attributes? ];
>
>
> But with newest Catalyst::Model::DBIC::Schema i get error:
>
> Couldn't instantiate component "Myapp::Model::General", "invalid
> connect_info at
> /usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Model/DBIC/Schema/Types.pm
> line 86.
>
> It seems that Catalyst/Model/DBIC/Schema/Types.pm does not support SUB
> REF in connect info anymore. Is that a bug or feature ?
>
> Thanks.

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...