summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-10-18 07:35:02 +0200
committerByron Jones <bjones@mozilla.com>2013-10-18 07:35:02 +0200
commite8cca83b5284aa00287edfb75868da4f3f47b738 (patch)
tree1bdf6f69d9d3458fd6e247f571d6d120d17ddfc7 /Bugzilla
parent7adce43dc4d364d8ada1819084ed6cdba735d543 (diff)
downloadbugzilla-e8cca83b5284aa00287edfb75868da4f3f47b738.tar.gz
bugzilla-e8cca83b5284aa00287edfb75868da4f3f47b738.tar.xz
Bug 926109: fix 'too many joins' fix
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Search.pm34
1 files changed, 17 insertions, 17 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index 7787104ba..d66a6398f 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -744,6 +744,23 @@ sub data {
last;
}
+ # BMO - to avoid massive amounts of joins, if we're selecting a lot of
+ # tracking flags, replace them with placeholders. the values will be
+ # retrieved later and injected into the result.
+ my %tf_map = map { $_ => 1 } Bugzilla::Extension::TrackingFlags::Flag->get_all_names();
+ my @tf_selected = grep { exists $tf_map{$_} } @orig_fields;
+ # mysql has a limit of 61 joins, and we want to avoid massive amounts of joins
+ # 30 ensures we won't hit the limit, nor generate too many joins
+ if (scalar @tf_selected > 30) {
+ foreach my $column (@tf_selected) {
+ $self->COLUMNS->{$column}->{name} = "'---'";
+ }
+ $self->{tracking_flags} = \@tf_selected;
+ }
+ else {
+ $self->{tracking_flags} = [];
+ }
+
my $start_time = [gettimeofday()];
my $sql = $self->_sql;
# Do we just want bug IDs to pass to the 2nd query or all the data immediately?
@@ -991,23 +1008,6 @@ sub _display_columns {
# expects to get them back in the exact same order.
my @columns = $self->_input_columns;
- # BMO - to avoid massive amounts of joins, if we're selecting a lot of
- # tracking flags, replace them with placeholders. the values will be
- # retrieved later and injected into the result.
- my %tf_map = map { $_ => 1 } Bugzilla::Extension::TrackingFlags::Flag->get_all_names();
- my @tf_selected = grep { exists $tf_map{$_} } @columns;
- # mysql has a limit of 61 joins, and we want to avoid massive amounts of joins
- # 30 ensures we won't hit the limit, nor generate too many joins
- if (scalar @tf_selected > 30) {
- foreach my $column (@tf_selected) {
- $self->COLUMNS->{$column}->{name} = "'---'";
- }
- $self->{tracking_flags} = \@tf_selected;
- }
- else {
- $self->{tracking_flags} = [];
- }
-
# Only add columns which are not already listed.
my %list = map { $_ => 1 } @columns;
foreach my $column ($self->_extra_columns) {