yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #71165
[Bug 1748888] Re: Incorrect database query when get mtu for network list
Reviewed: https://review.openstack.org/543459
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=d15244ab4f2562b46c5fbdb6ccebe18f66e5a579
Submitter: Zuul
Branch: master
commit d15244ab4f2562b46c5fbdb6ccebe18f66e5a579
Author: Vadim ponomarev <velizarx@xxxxxxxxx>
Date: Mon Feb 12 16:48:29 2018 +0300
Fixing the filter in get MTU by network list query.
Based on the observation that a call to sync_routers can be slow
(10-15 seconds for one virtual router), and that profiling data show
that a significant amount of time is spent in function
_get_mtus_by_network_list, this change fixes incorrect the database
query for getting information about networks.
What changed:
- before: SQL query spent time O(#networks in database)
(select all exists networks from database)
- after : SQL query spent time O(#network_ids passed to the function)
(select only needed networks)
A basic test shows a drastic improvements, from 2 second to around
~0.2 second, in the processing of a _get_mtus_by_network_list call
with 300 networks in database.
Change-Id: Id50d1aaddd0d2a1110502de9c5b974063daa296a
Closes-Bug: #1748888
** Changed in: neutron
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1748888
Title:
Incorrect database query when get mtu for network list
Status in neutron:
Fix Released
Bug description:
When virtual router bind to L3 agent (router migration or create new),
synchronization function sync_routers() try get MTU for all router
interfaces by network IDs. This process run in function
'_get_mtus_by_network_list' in l3_db.py file. But, when is formed
database query, incorrect filters are passed in lines
(https://github.com/openstack/neutron/blob/master/neutron/db/l3_db.py#L1719):
```
filters = {'network_id': network_ids}
fields = ['id', 'mtu']
networks = self._core_plugin.get_networks(context, filters=filters, fields=fields)
```
The mistake is that resource 'network' doesn't have field
'network_id', he have field 'id'. As a result, runs for a few seconds
on the big database. This slows down the router migration operation
for a few seconds.
To fix, you need to pass a filter by 'id' field.
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1748888/+subscriptions
References