← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1160333] Re: N+1 DB queries executed when extra_route extension is enabled

 

** Changed in: quantum
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to quantum.
https://bugs.launchpad.net/bugs/1160333

Title:
  N+1 DB queries executed when extra_route extension is enabled

Status in OpenStack Quantum (virtual network service):
  Fix Released

Bug description:
  The following code snippet, from extraroute_db
  https://github.com/openstack/quantum/blob/master/quantum/db/extraroute_db.py#L145)
  , ends up executing N+1 queries on the database where N is the number
  of routers. This is not really scale-friendly.

          with context.session.begin(subtransactions=True):
              routers = super(ExtraRoute_db_mixin, self).get_routers(
                  context, filters, fields, sorts=sorts, limit=limit,
                  marker=marker, page_reverse=page_reverse)
              for router in routers:
                  router['routes'] = self._get_extra_routes_by_router_id(
                      context, router['id'])

  If possible, one should consider either:

  - leveraging network_filter_hooks as we did for External networks
  - leveraging sqlalchemy joined table inheritance and polymorphism

  Marking it as undecided in the meanwhile as the code it's not really
  broken - and probably this kind of fix will fall in the scope of some
  major db code review during the havana timeframe.

To manage notifications about this bug go to:
https://bugs.launchpad.net/quantum/+bug/1160333/+subscriptions