[Rt-commit] rt branch, 4.2/purge-deferredrecipients, created. rt-4.2.9-16-g6fd7155
Alex Vandiver
alexmv at bestpractical.com
Thu Nov 13 20:35:40 EST 2014
The branch, 4.2/purge-deferredrecipients has been created
at 6fd715547ef25482f34687f0de22b0de606ef3bd (commit)
- Log -----------------------------------------------------------------
commit 9c356838f40a6d03edf390f40d512b152b77de1f
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.
This is done in both a 3.8.2 and 4.2.10 step -- the latter to reduce
database bloat for users who have already upgraded past 3.8.2 but ran on
3.8.0 or 3.8.1 for some time.
Fixes I#17357.
diff --git a/etc/upgrade/3.8.2/content b/etc/upgrade/3.8.2/content
index 572e343..0a710df 100644
--- a/etc/upgrade/3.8.2/content
+++ b/etc/upgrade/3.8.2/content
@@ -3,6 +3,16 @@ use warnings;
our @Initial = (
sub {
+ # We do the delete in pure SQL because Attribute collections
+ # otherwise attempt to hash everything in memory. As this may
+ # be a large list, do it directly.
+ RT->DatabaseHandle->dbh->do(<<EOSQL);
+ DELETE FROM Attributes
+ WHERE Name = 'DeferredRecipients'
+ AND Content IS NULL;
+EOSQL
+ },
+ sub {
RT->Logger->warning(
"Going to add [OLD] prefix to all templates in approvals queue."
." If you have never used approvals, you can safely delete all the"
diff --git a/etc/upgrade/4.2.10/content b/etc/upgrade/4.2.10/content
new file mode 100644
index 0000000..2cd1bde
--- /dev/null
+++ b/etc/upgrade/4.2.10/content
@@ -0,0 +1,15 @@
+use strict;
+use warnings;
+
+our @Initial = (
+ sub {
+ # We do the delete in pure SQL because Attribute collections
+ # otherwise attempt to hash everything in memory. As this may
+ # be a large list, do it directly.
+ RT->DatabaseHandle->dbh->do(<<EOSQL);
+ DELETE FROM Attributes
+ WHERE Name = 'DeferredRecipients'
+ AND Content IS NULL;
+EOSQL
+ },
+);
\ No newline at end of file
commit 6fd715547ef25482f34687f0de22b0de606ef3bd
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 0a710df..dc68c92 100644
--- a/etc/upgrade/3.8.2/content
+++ b/etc/upgrade/3.8.2/content
@@ -138,7 +138,7 @@ our @Final = (
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