[Rt-commit] rt branch, 4.0/purge-deferredrecipients, created. rt-4.0.20-41-gd7e6a63

Alex Vandiver alexmv at bestpractical.com
Mon Jun 23 12:51:22 EDT 2014


The branch, 4.0/purge-deferredrecipients has been created
        at  d7e6a63265c622a973751ad23c10ec093ff477eb (commit)

- Log -----------------------------------------------------------------
commit a59a285a7547bd1d582398020b6a1e33d902d265
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jun 23 12:32:12 2014 -0400

    Remove possibly large number of DeferredRecipients attributes
    
    RT 3.8.0 and 3.8.1 contained a bug, fixed in 9076df8b, which caused RT
    to create a NULL DeferredRecipients Attribute for every outgoing email.
    This not only bloats the database, but also causes problems with the RT
    3.8.2 "content" upgrade step:
    
            my $attrs = RT::Attributes->new( RT->SystemUser );
            $attrs->UnLimit;
            my @dashboards = $attrs->Named('Dashboard');
    
    This loads all Attribute records into memory, as Named does not perform
    a Limit, but builds a hash of all results, and iterates over them.
    
    Purge the NULL DeferredRecipients records, reducing database size and
    preventing the difficulties that it causes with the above upgrade step.

diff --git a/etc/upgrade/3.8.2/schema.Oracle b/etc/upgrade/3.8.2/schema.Oracle
new file mode 100644
index 0000000..e140ea2
--- /dev/null
+++ b/etc/upgrade/3.8.2/schema.Oracle
@@ -0,0 +1,3 @@
+DELETE FROM Attributes
+ WHERE Name = 'DeferredRecipients'
+   AND Content IS NULL;
diff --git a/etc/upgrade/3.8.2/schema.Pg b/etc/upgrade/3.8.2/schema.Pg
new file mode 100644
index 0000000..e140ea2
--- /dev/null
+++ b/etc/upgrade/3.8.2/schema.Pg
@@ -0,0 +1,3 @@
+DELETE FROM Attributes
+ WHERE Name = 'DeferredRecipients'
+   AND Content IS NULL;
diff --git a/etc/upgrade/3.8.2/schema.SQLite b/etc/upgrade/3.8.2/schema.SQLite
new file mode 100644
index 0000000..e140ea2
--- /dev/null
+++ b/etc/upgrade/3.8.2/schema.SQLite
@@ -0,0 +1,3 @@
+DELETE FROM Attributes
+ WHERE Name = 'DeferredRecipients'
+   AND Content IS NULL;
diff --git a/etc/upgrade/3.8.2/schema.mysql b/etc/upgrade/3.8.2/schema.mysql
new file mode 100644
index 0000000..e140ea2
--- /dev/null
+++ b/etc/upgrade/3.8.2/schema.mysql
@@ -0,0 +1,3 @@
+DELETE FROM Attributes
+ WHERE Name = 'DeferredRecipients'
+   AND Content IS NULL;

commit d7e6a63265c622a973751ad23c10ec093ff477eb
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jun 23 12:48:12 2014 -0400

    Limit the collection to attributes with the correct Name
    
    There is no reason to not perform this restriction with a Limit; this
    query is even indexed, which may be a sizable performance benefit to
    sites with legitimately large Attributes tables.

diff --git a/etc/upgrade/3.8.2/content b/etc/upgrade/3.8.2/content
index 0eef401..f041abb 100644
--- a/etc/upgrade/3.8.2/content
+++ b/etc/upgrade/3.8.2/content
@@ -112,7 +112,7 @@ The ticket has been approved, you may now start to act on it.
         my $sys = RT::System->new(RT->SystemUser);
 
         my $attrs = RT::Attributes->new( RT->SystemUser );
-        $attrs->UnLimit;
+        $attrs->Limit( FIELD => "Name", VALUE => "Dashboard");
         my @dashboards = $attrs->Named('Dashboard');
 
         if (@dashboards == 0) {

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


More information about the rt-commit mailing list