← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1586816] [NEW] SAWarning: in_(empty sequence) from get_networks_segments()

 

Public bug reported:

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

** Affects: neutron
     Importance: Low
         Status: New


** Tags: db low-hanging-fruit

** Changed in: neutron
   Importance: Undecided => Low

** Tags added: db low-hanging-fruit

-- 
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:
  New

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


Follow ups