[Rt-commit] rt branch, 4.2/serializer-leaks, created. rt-4.2.7-13-gcac122f

Alex Vandiver alexmv at bestpractical.com
Mon Sep 29 14:15:56 EDT 2014


The branch, 4.2/serializer-leaks has been created
        at  cac122f7f44776126f227b96089f1d7c45e4b33d (commit)

- Log -----------------------------------------------------------------
commit 3560e9be6610fa2a6d2a9696ec1bb30e478cbdd6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Sep 29 00:56:12 2014 -0400

    Stop caching when serializing and importing
    
    9b26694d and ba372275 rightly realized that using
    DBIx::SearchBuilder::Record::Cachable was large memory and performance
    detriment when serializing and importing.  Unfortunately, their changes
    were unsufficient to prevent it, as RT::Record is loaded (and its "use
    base" is set) during compile-time when
    RT::Migrate::Serializer::IncrementalRecord is loaded.  As such, setting
    RecordBaseClass at run-time is too late.
    
    Instead, explicitly alter the inheritance of RT::Record at run-time, to
    avoid the complexity of ensuring that RT::Record is not loaded until
    "late enough."

diff --git a/sbin/rt-importer.in b/sbin/rt-importer.in
index 798ad36..e8a3942 100644
--- a/sbin/rt-importer.in
+++ b/sbin/rt-importer.in
@@ -76,9 +76,10 @@ BEGIN {
 
 use RT;
 RT::LoadConfig();
-RT->Config->Set(RecordBaseClass => "DBIx::SearchBuilder::Record");
 RT::Init();
 
+ at RT::Record::ISA = qw( DBIx::SearchBuilder::Record RT::Base );
+
 use RT::Migrate;
 use RT::Migrate::Importer::File;
 use Getopt::Long;
diff --git a/sbin/rt-serializer.in b/sbin/rt-serializer.in
index 881a20b..c8161cf 100644
--- a/sbin/rt-serializer.in
+++ b/sbin/rt-serializer.in
@@ -76,9 +76,10 @@ BEGIN {
 
 use RT;
 RT::LoadConfig();
-RT->Config->Set(RecordBaseClass => "DBIx::SearchBuilder::Record");
 RT::Init();
 
+ at RT::Record::ISA = qw( DBIx::SearchBuilder::Record RT::Base );
+
 use RT::Migrate;
 use RT::Migrate::Serializer::File;
 use Getopt::Long;

commit cac122f7f44776126f227b96089f1d7c45e4b33d
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Sep 29 01:04:58 2014 -0400

    Skip building a giant "seen" hash if cloning
    
    There is no reason to build the "seen" hash if we simply ignore it;
    instead, simply skip directly to the Visit code.

diff --git a/lib/RT/Migrate/Serializer.pm b/lib/RT/Migrate/Serializer.pm
index 2c23833..bf77569 100644
--- a/lib/RT/Migrate/Serializer.pm
+++ b/lib/RT/Migrate/Serializer.pm
@@ -362,12 +362,16 @@ sub Process {
         @_
     );
 
-    my $uid = $args{object}->UID;
-
-    # Skip all dependency walking if we're cloning.  Marking UIDs as seen
-    # forces them to be visited immediately.
-    $self->{seen}{$uid}++
-        if $self->{Clone} and $uid;
+    my $obj = $args{object};
+    my $uid = $obj->UID;
+
+    # Skip all dependency walking if we're cloning; go straight to
+    # visiting them.
+    if ($self->{Clone} and $uid) {
+        return if $obj->isa("RT::System");
+        $self->{progress}->($obj) if $self->{progress};
+        return $self->Visit(%args);
+    }
 
     return $self->SUPER::Process( @_ );
 }

-----------------------------------------------------------------------


More information about the rt-commit mailing list