Flavors list results not limited on database server-side

Bug #1028494 reported by Jay Pipes
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Joshua Hesketh

Bug Description

while investigating the source of bug 1028465, I discovered to my chagrin that Nova's list results are not limited using the database query. Instead, nova.api.openstack.common.limited_by_marker is actually looping over the entire set of non-limited results from the database. This is incredibly inefficient. We should be passing marker and limit to the database query itself, like is done in Glance.

Revision history for this message
Alex Meade (alex-meade) wrote :

This is very true, before this can be done the filtering for results also needs to be done in the db, as to not remove things from limited pages. This MP handles this case: https://review.openstack.org/#/c/10917/

Once this is true it is as simple as paginating and limiting just as Glance does.

Changed in nova:
status: New → Confirmed
Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Wishlist
tags: added: performance
Revision history for this message
Sean Dague (sdague) wrote :

The only place where this is still a problem is the flavor api. This would require adding limit and paging interfaces into it's db api, then exposing them in the interface. Pretty straight forward, and worth doing in H.

summary: - Database results not limited on server-side
+ Flavors list results not limited on database server-side
Changed in nova:
importance: Wishlist → Low
milestone: none → havana-1
status: Confirmed → Won't Fix
status: Won't Fix → Triaged
tags: added: low-hanging-fruit
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
assignee: nobody → Joshua Hesketh (joshua.hesketh)
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
Joshua Hesketh (joshua.hesketh) wrote :

Howdy,

This is my first attempt at a bug fix in nova and I've gotten a little bit stuck. Basically my change seems to pass most of the unit tests but is somehow preventing new instances from launching (clearly a big deal). I'm not really sure how to debug it further due to my unfamiliarity with the system. Any thoughts?

Additionally, and perhaps more a topic for the mailing list, I'm not sure how to write a test for the database methods. It seems like the unit test queries are faked so nova.db.sqlalchemy.api.instance_type_get_all() is never entered into or checked accurately. Should I be writing an additional test to somehow check this function?

Cheers,
Josh

Thierry Carrez (ttx)
Changed in nova:
milestone: havana-1 → havana-2
Changed in nova:
status: In Progress → Confirmed
milestone: havana-2 → none
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/24592
Committed: http://github.com/openstack/nova/commit/08b2433dddc6e38448b3648c47b44acb595b5014
Submitter: Jenkins
Branch: master

commit 08b2433dddc6e38448b3648c47b44acb595b5014
Author: Joshua Hesketh <email address hidden>
Date: Thu Aug 15 09:36:49 2013 +1000

    Offer a paginated version of flavor_get_all

    Implements nova.compute.flavors.get_all_flavors_sorted_list to
    optimise get_all_flavors.

    Fixes: bug #1028494
    Change-Id: Ie0406c1d4b47a51473979910c0908b153497d503

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-3 → 2013.2
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.