Closed Bug 1283310 Opened 8 years ago Closed 8 years ago

Optimizations for Bugzilla::active_custom_fields()

Categories

(bugzilla.mozilla.org :: General, defect)

Production
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dylan, Assigned: dylan)

Details

Attachments

(1 file)

Bugzilla->active_custom_fields() is very frequently called
and then filtered on FIELD_TYPE_EXTENSION. It is expensive both in terms of items returned from the DB and from building the list (a second time!) in the tracking flags extension. I propose adding a skip_extensions => 1 argument to this method.
Assignee: nobody → dylan
Version: Development/Staging → Production
Attached patch 1283310_1.patchSplinter Review
Attachment #8766611 - Flags: review?(dkl)
Comment on attachment 8766611 [details] [diff] [review]
1283310_1.patch

Review of attachment 8766611 [details] [diff] [review]:
-----------------------------------------------------------------

Software error:

DBD::mysql::db selectrow_hashref failed: Unknown column 'cf_tracking_win' in 'field list' [for Statement "
            SELECT alias,assigned_to,bug_file_loc,bug_id,bug_severity,bug_status,cclist_accessible,component_id,creation_ts,delta_ts,estimated_time,everconfirmed,lastdiffed,op_sys,priority,product_id,qa_contact,remaining_time,rep_platform,reporter_accessible,resolution,short_desc,status_whiteboard,target_milestone,version,reporter    AS reporter_id,DATE_FORMAT(deadline, '%Y-%m-%d') AS deadline,cf_tracking_win,cf_backlog,cf_tracking_p11,cf_tracking_e10s,cf_status_fxios_v1_1,cf_tracking_firefox5,cf_status_firefox5,cf_tracking_firefox6,cf_status_firefox6,cf_tracking_firefox7,cf_status_firefox7,cf_tracking_firefox8,cf_status_firefox8,cf_tracking_firefox9,cf_status_firefox9,cf_tracking_firefox10,cf_status_firefox10,cf_tracking_firefox11,cf_status_firefox11,cf_tracking_firefox12,cf_status_firefox12,cf_tracking_firefox13,cf_status_firefox13,cf_tracking_firefox14,cf_status_firefox14,cf_tracking_firefox15,cf_status_firefox15,cf_tracking_firefox16,cf_status_firefox16,cf_tracking_firefox17,cf_status_firefox17,cf_tracking_firefox18,cf_status_firefox18,cf_tracking_firefox19,cf_status_firefox19,cf_tracking_firefox20,cf_status_firefox20,cf_tracking_firefox21,cf_status_firefox21,cf_tracking_firefox22,cf_status_firefox22,cf_tracking_firefox23,cf_status_firefox23,cf_tracking_firefox24,cf_status_firefox24,cf_tracking_firefox25,cf_status_firefox25,cf_tracking_firefox26,cf_status_firefox26,cf_tracking_firefox27,cf_status_firefox27,cf_tracking_firefox28,cf_status_firefox28,cf_tracking_firefox29,cf_status_firefox29,cf_tracking_firefox30,cf_status_firefox30,cf_tracking_firefox31,cf_status_firefox31,cf_tracking_firefox32,cf_status_firefox32,cf_tracking_firefox33,cf_status_firefox33,cf_tracking_firefox34,cf_status_firefox34,cf_tracking_firefox35,cf_status_firefox35,cf_tracking_firefox36,cf_status_firefox36,cf_tracking_firefox37,cf_status_firefox37,cf_tracking_firefox38,cf_status_firefox ... acking_seamonkey219,cf_status_seamonkey219,cf_tracking_seamonkey220,cf_status_seamonkey220,cf_tracking_seamonkey221,cf_status_seamonkey221,cf_tracking_seamonkey222,cf_status_seamonkey222,cf_tracking_seamonkey223,cf_status_seamonkey223,cf_tracking_seamonkey224,cf_tracking_thunderbird_45,cf_status_thunderbird_45,cf_tracking_thunderbird_46,cf_status_thunderbird_46,cf_status_seamonkey224,cf_tracking_thunderbird_47,cf_status_thunderbird_47,cf_tracking_seamonkey225,cf_status_seamonkey225,cf_status_seamonkey226,cf_tracking_seamonkey226,cf_status_seamonkey227,cf_tracking_seamonkey227,cf_status_seamonkey228,cf_tracking_seamonkey228,cf_status_seamonkey229,cf_tracking_seamonkey229,cf_tracking_thunderbird_esr24,cf_colo_site,cf_status_thunderbird_esr24,cf_tracking_thunderbird_esr31,cf_status_thunderbird_esr31,cf_tracking_thunderbird_esr38,cf_status_seamonkey230,cf_status_thunderbird_esr38,cf_office,cf_tracking_seamonkey230,cf_status_seamonkey231,cf_tracking_seamonkey231,cf_status_seamonkey232,cf_tracking_seamonkey232,cf_tracking_seamonkey233,cf_status_seamonkey233,cf_tracking_seamonkey234,cf_status_seamonkey234,cf_tracking_seamonkey235,cf_status_seamonkey235,cf_tracking_seamonkey236,cf_status_seamonkey236,cf_tracking_seamonkey237,cf_status_seamonkey237,cf_tracking_seamonkey238,cf_status_seamonkey238,cf_tracking_seamonkey239,cf_crash_signature,cf_status_seamonkey239,cf_tracking_seamonkey240,cf_status_seamonkey240,cf_tracking_seamonkey241,cf_status_seamonkey241,cf_tracking_seamonkey242,cf_status_seamonkey242,cf_tracking_seamonkey243,cf_status_seamonkey243,cf_tracking_seamonkey244,cf_status_seamonkey244,cf_blocking_kilimanjaro,cf_blocking_b2g,cf_blocking_basecamp,cf_feature_b2g,cf_tracking_b2g,cf_ux_b2g,cf_b2g_ota_blocker,cf_due_date,cf_last_resolved,cf_user_story,cf_mozilla_project,cf_machine_state,cf_qa_whiteboard,cf_fx_iteration,cf_fx_points,cf_rank,cf_has_regression_range,cf_has_str,cf_cab_review,cf_last_resolved,restrict_comments,votes FROM bugs
             WHERE bug_id = ?"] at Bugzilla/Object.pm line 142.


Per IRC, add the value of skip_extensions to the end of $cache_id:

diff --git a/Bugzilla.pm b/Bugzilla.pm
index 0f513ae..b620e22 100644
--- a/Bugzilla.pm
+++ b/Bugzilla.pm
@@ -709,11 +709,11 @@ sub active_custom_fields {
     my $cache_id = 'active_custom_fields';
     if ($params) {
         $cache_id .= ($params->{product} ? '_p' . $params->{product}->id : '') .
-                     ($params->{component} ? '_c' . $params->{component}->id : '');
+                     ($params->{component} ? '_c' . $params->{component}->id : '') .
+                     ('_noext' ? $params->{skip_extensions} : '');
     }
     if (!exists $class->request_cache->{$cache_id}) {
-        my $fields = Bugzilla::Field->match({ custom => 1, obsolete => 0});
-        @$fields = grep($_->type ne FIELD_TYPE_EXTENSION, @$fields);
+        my $fields = Bugzilla::Field->match({ custom => 1, obsolete => 0, skip_extensions => 1 });
         Bugzilla::Hook::process('active_custom_fields',
                                 { fields => \$fields, params => $params });
         $class->request_cache->{$cache_id} = $fields;
Attachment #8766611 - Flags: review?(dkl) → review+
To git@github.com:mozilla-bteam/bmo.git
   584670c..8920445  master -> master
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: