Inefficient result filtering

Bug #1478102 reported by Steve McLellan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Searchlight
Fix Released
Medium
Steve McLellan

Bug Description

After running the elasticsearch search, we pass the results through filter_results for each plugin in case there are sensitive fields or data transformations need doing in v1/search.py:

            for plugin in self.plugins:
                result = plugin.obj.filter_result(result, req.context)

As the number of plugins (hopefully) grows, this gets less and less efficient, since all but one plugin will be a no-op for any given result but we're looping through the entire (potentially large) result set. Better would be handling the dispatch earlier; build up a dictionary of index-type -> filter_result function and run the results through it.

Steve McLellan (sjmc7)
Changed in searchlight:
importance: Undecided → Medium
Steve McLellan (sjmc7)
Changed in searchlight:
assignee: nobody → Steve McLellan (sjmc7)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to searchlight (master)

Fix proposed to branch: master
Review: https://review.openstack.org/207682

Changed in searchlight:
status: New → In Progress
Changed in searchlight:
milestone: none → liberty-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to searchlight (master)

Reviewed: https://review.openstack.org/207682
Committed: https://git.openstack.org/cgit/openstack/searchlight/commit/?id=8404053e03ad9db723ffe99c0fd197205d6c150f
Submitter: Jenkins
Branch: master

commit 8404053e03ad9db723ffe99c0fd197205d6c150f
Author: Steve McLellan <email address hidden>
Date: Thu Jul 30 20:25:36 2015 -0500

    More efficient result filtering

    Instead of passing each result through each plugin, maintain
    a backwards lookup of (index, type) -> plugin and only filter
    a result through the plugin it belongs to. Changes the signature of
    filter_result which only glance/image is currently using.

    Change-Id: I617dbddc44dd07303bdd6fe9794fa92484a7eb32
    Closes-Bug: #1478102

Changed in searchlight:
status: In Progress → Fix Committed
Changed in searchlight:
status: Fix Committed → Fix Released
Changed in searchlight:
milestone: liberty-rc1 → 0.1.0.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.