yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #51673
[Bug 1586816] Re: SAWarning: in_(empty sequence) from get_networks_segments()
Reviewed: https://review.openstack.org/322618
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=1080620e5af6d3aae8034f516ded86dda257282b
Submitter: Jenkins
Branch: master
commit 1080620e5af6d3aae8034f516ded86dda257282b
Author: Hong Hui Xiao <xiaohhui@xxxxxxxxxx>
Date: Mon May 30 03:13:21 2016 +0000
Dont use query if network_ids is empty
A warning could be found in SQLAlchemy, if handling empty WHERE IN
clauses. This is found at neutron.db.segments_db.get_networks_segments
To avoid it, just return empty dict in such case.
Change-Id: I3cf727dede1d5909aeefbf852332818164ad3777
Closes-bug: #1586816
** 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/1586816
Title:
SAWarning: in_(empty sequence) from get_networks_segments()
Status in neutron:
Fix Released
Bug description:
neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/sql/default_comparator.py:153:
SAWarning: The IN-predicate on "networksegments.network_id" was
invoked with an empty sequence. This results in a contradiction,
which nonetheless can be expensive to evaluate. Consider
alternative strategies for improved performance.
This is coming from neutron.db.segments_db.get_networks_segments:
def get_networks_segments(session, network_ids, filter_dynamic=False):
with session.begin(subtransactions=True):
query = (session.query(NetworkSegment).
filter(NetworkSegment.network_id.in_(network_ids)).
order_by(NetworkSegment.segment_index))
if filter_dynamic is not None:
query = query.filter_by(is_dynamic=filter_dynamic)
records = query.all()
result = {net_id: [] for net_id in network_ids}
for record in records:
result[record.network_id].append(_make_segment_dict(record))
return result
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1586816/+subscriptions
References