From: Peter Rabbitson Date: Fri, 13 May 2016 17:15:18 +0000 (+0200) Subject: Fully separate parent and child resultsource metadata X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9e36e3eca459d22d7c768f945c891eacbc4349c0;p=dbsrgits%2FDBIx-Class-Historic.git Fully separate parent and child resultsource metadata Ensure that all attributes are shallow-copied on "clone". Currently this means that the following are *NO LONGER* shared between rsrc clones: _unique_constraints _primaries source_info This seems just as cocky and reckless as the clusterfuck in 4006691d/RT#107462 and it most likely will have the same invisible-yet-dire consequences for various downstreams. However there is a plan in place several commits ahead allowing sidestepping the impossibility to debug a potential fallout. --- diff --git a/Changes b/Changes index c737569..2abdb6e 100644 --- a/Changes +++ b/Changes @@ -10,6 +10,9 @@ Revision history for DBIx::Class the maintainer believe this is safe, but this is a very complex area and reality may turn out to be different. If **ANYHTING** at all seems out of place, please file a report at once + - The unique constraint info (including the primary key columns) is no + longer shared between related (class and schema-level) ResultSource + instances - Neither exception_action() nor $SIG{__DIE__} handlers are invoked on recoverable errors. This ensures that the retry logic is fully insulated from changes in control flow, as the handlers are only diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index 053b398..4ebb4c0 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -16,12 +16,18 @@ use DBIx::Class::ResultSet; use namespace::clean; -__PACKAGE__->mk_group_accessors(simple => qw/ - source_name name source_info - _ordered_columns _columns _primaries _unique_constraints - _relationships resultset_attributes - column_info_from_storage sqlt_deploy_callback -/); +my @hashref_attributes = qw( + source_info resultset_attributes + _columns _unique_constraints _relationships +); +my @arrayref_attributes = qw( + _ordered_columns _primaries +); +__PACKAGE__->mk_group_accessors(simple => + @hashref_attributes, + @arrayref_attributes, + qw( source_name name column_info_from_storage sqlt_deploy_callback ), +); __PACKAGE__->mk_group_accessors(component_class => qw/ resultset_class @@ -149,9 +155,10 @@ Creates a new ResultSource object. Not normally called directly by end users. $self->{sqlt_deploy_callback} ||= 'default_sqlt_deploy_hook'; $self->{$_} = { %{ $self->{$_} || {} } } - for qw( _columns _relationships resultset_attributes ); + for @hashref_attributes; - $self->{_ordered_columns} = [ @{ $self->{_ordered_columns} || [] } ]; + $self->{$_} = [ @{ $self->{$_} || [] } ] + for @arrayref_attributes; $self; }