_use_multicolumn_in() must not be called on replicated storage

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

_use_multicolumn_in() must not be called on replicated storage

Bill Moseley
I need some help with this error I'm seeing after upgrading DBIx::Class.

In ReulstSet.pm there's this code that calls $storage->_use_multicolumn_in.

The problem is that method throws and error on replicated storage.


sub _rs_update_delete {
  my ($self, $op, $values) = @_;
  ....

    if (@$idcols == 1) {
      $cond = { $idcols->[0] => { -in => $subrs->as_query } };
    }
    elsif ($storage->_use_multicolumn_in) {
      # no syntax for calling this properly yet
      # !!! EXPERIMENTAL API !!! WILL CHANGE !!!
      $cond = $storage->sql_maker->_where_op_multicolumn_in (
        $idcols, # how do I convey a list of idents...? can binds reside on lhs?
        $subrs->as_query
      ),
    }
    else {

But, in DBIx::Class::Storage::Replicated the _use_multicolumn method is blocked by this code:

for my $method (@{$method_dispatch->{unimplemented}}) {

  __PACKAGE__->meta->add_method($method, sub {
    my $self = shift;
    $self->throw_exception("$method() must not be called on ".(blessed $self).' objects');
  });
}

What I'm not clear on is if this just wasn't tested with Replicated storage, or if there's something odd in my code that is causing ResultSet.pm to call that method (because other deletes are working).

The query that is failing is:

   my $student_class_rs = $account->search_related( 'classes' )->search_related(
        'student_classes',
        {
            student => $student_id,
        }
    );

    $student_class_rs->delete();

$idcols in the code above is a arrayref of two names 'student' and 'class'.

--
Bill Moseley
[hidden email]

_______________________________________________
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@...
Reply | Threaded
Open this post in threaded view
|

Re: _use_multicolumn_in() must not be called on replicated storage

Jose Luis Martinez
>> What I'm not clear on is if this just wasn't tested with Replicated
>> storage
>
> This. The replicated code is not very well exercised in tests, due to
> the complexity of setting up a replicated test setup just right. I am
> looking into expanding my setup this year, but nothing definitive yet.


Hey! Maybe Giusseppe Maxia's MySQL Sandbox can help you create those
replication scenarios quickly!

http://search.cpan.org/~gmax/MySQL-Sandbox-3.0.48/lib/MySQL/Sandbox/Recipes.pm#Creating_a_standard_replication_sandbox

Hope it helps!

Jose Luis Martinez


_______________________________________________
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@...
Reply | Threaded
Open this post in threaded view
|

Re: _use_multicolumn_in() must not be called on replicated storage

Jose Luis Martinez
Hi!

El 19/03/2015 a las 15:34, Peter Rabbitson escribió:

> On 03/19/2015 10:03 AM, Jose Luis Martinez wrote:
>> Hey! Maybe Giusseppe Maxia's MySQL Sandbox can help you create those
>> replication scenarios quickly!
>>
>> http://search.cpan.org/~gmax/MySQL-Sandbox-3.0.48/lib/MySQL/Sandbox/Recipes.pm#Creating_a_standard_replication_sandbox
>>
>
> This is an interesting thought. Even though I already addressed a large
> part of the above via
> https://github.com/dbsrgits/dbix-class/commit/8b60b9211#diff-7187d12eee0941e03bffaa08d3856061,
> it would still be nice to implement, and to enable the extra (currently
> dead) test paths here:
> https://github.com/dbsrgits/dbix-class/blob/8b60b92/t/storage/replicated.t#L635-L640
>
> Do you think you can try to do that yourself on the DBIC TravisCI?
> Everything is already in place setup-wise, you just fork and hack away
> and see what Travis says (you will either need to enable Travis for your
> fork, or you will need to send PRs so DBICs main smoker fires up).

I'll give it a shot when I get some tuits :) I'll at least try to book
some help on Barcelona.pm

Best Regards,

Jose Luis

_______________________________________________
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@...