]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Optimize delete_csnat_router_interface_ports db query
authorCedric Brandily <zzelle@gmail.com>
Tue, 3 Nov 2015 21:54:07 +0000 (22:54 +0100)
committerCedric Brandily <zzelle@gmail.com>
Tue, 3 Nov 2015 22:20:57 +0000 (23:20 +0100)
commitd5f3d59daf38035ced725be55931cb89ec1ccbcf
tree8153c3e89fccfffd801c687298dda0ab6fee7cbe
parent7186d7ee771fa65b9054c959bdd0a0848ec2821a
Optimize delete_csnat_router_interface_ports db query

Currently delete_csnat_router_interface_ports provides an iterator as
filter to core_plugin.get_ports which is used in a SQL IN argument.
SQLAlchemy is able to avoid some db queries when the IN argument is
empty BUT not when the argument is an empty iterator and raises the
warning:

 SAWarning: The IN-predicate on "ports.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 change replaces the iterator by a list in order to optimize db
queries when the filter is empty.

Closes-Bug: #1503852
Change-Id: I4f53433d688dfa020927118a18020b1a6aa55517
neutron/db/l3_dvr_db.py