[Rt-commit] rt branch, 4.2/do-not-use-in-operator-for-a-large-list-in-report, created. rt-4.2.10-191-g44c092a
? sunnavy
sunnavy at bestpractical.com
Sun Mar 15 04:42:42 EDT 2015
The branch, 4.2/do-not-use-in-operator-for-a-large-list-in-report has been created
at 44c092afde5b5105f02184183e6240b4986e74e4 (commit)
- Log -----------------------------------------------------------------
commit 44c092afde5b5105f02184183e6240b4986e74e4
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Mar 11 02:38:37 2015 +0800
split list size to be less than 1000 in case there is a limit in db
e.g. Oracle's limit is 1000, MySQL's one is limited by max_allowed_packet
@match here could be very large, so we need to take care of this.
diff --git a/lib/RT/Report/Tickets.pm b/lib/RT/Report/Tickets.pm
index f605ee2..19bca18 100644
--- a/lib/RT/Report/Tickets.pm
+++ b/lib/RT/Report/Tickets.pm
@@ -487,6 +487,10 @@ sub SetupGroupings {
# tickets, with no joins. We then mark it as having been ACL'd,
# since it was by dint of being in the search results above
$self->CleanSlate;
+ while ( @match > 1000 ) {
+ my @batch = splice( @match, 0, 1000 );
+ $self->Limit( FIELD => 'Id', OPERATOR => 'IN', VALUE => \@batch );
+ }
$self->Limit( FIELD => 'Id', OPERATOR => 'IN', VALUE => \@match );
$self->{'_sql_current_user_can_see_applied'} = 1
}
-----------------------------------------------------------------------
More information about the rt-commit
mailing list