Fix a usage error of joinedload + filter in l3 scheduler
This commit fixes admin_state_up filtering in
get_l3_agents_hosting_routers. Also, adapt its callers
which rely on the current broken implementation.
Details:
With the current coding, joinedload() produces a JOIN and
the following filter() on the columns from the joined table
would create another JOIN of the same table. (As t1 in the
following example). It doesn't seem to be the intended
behaviour. As a consequence the filter (WHERE clause in
the following examples) doesn't work as expected.
Queries before this fix looked like the following,
where t1 and t2 are Agent and RouterL3AgentBinding respectively:
SELECT t2.aaa, t1_1.bbb, ...
FROM t1, t2 LEFT OUTER JOIN t1 AS t1_1 ON t1_1.ccc = t2.ddd
WHERE t1.eee = ...;
After the fix, it would be:
SELECT t2.aaa, t1.bbb, ...
FROM t2 JOIN t1 ON t1.ccc = t2.ddd
WHERE t1.eee = ...;
Reviewed: https:/ /review. openstack. org/149458 /git.openstack. org/cgit/ openstack/ neutron/ commit/ ?id=5a480be4a80 6e9f9b6e87f217a 43fcc5fd8553dc
Committed: https:/
Submitter: Jenkins
Branch: master
commit 5a480be4a806e9f 9b6e87f217a43fc c5fd8553dc
Author: YAMAMOTO Takashi <email address hidden>
Date: Tue Jan 27 15:32:19 2015 +0900
Fix a usage error of joinedload + filter in l3 scheduler
This commit fixes admin_state_up filtering in l3_agents_ hosting_ routers. Also, adapt its callers
get_
which rely on the current broken implementation.
Details:
With the current coding, joinedload() produces a JOIN and
the following filter() on the columns from the joined table
would create another JOIN of the same table. (As t1 in the
following example). It doesn't seem to be the intended
behaviour. As a consequence the filter (WHERE clause in
the following examples) doesn't work as expected.
Queries before this fix looked like the following, nding respectively:
where t1 and t2 are Agent and RouterL3AgentBi
SELECT t2.aaa, t1_1.bbb, ...
FROM t1, t2 LEFT OUTER JOIN t1 AS t1_1 ON t1_1.ccc = t2.ddd
WHERE t1.eee = ...;
After the fix, it would be:
SELECT t2.aaa, t1.bbb, ...
FROM t2 JOIN t1 ON t1.ccc = t2.ddd
WHERE t1.eee = ...;
Reference: http:// docs.sqlalchemy .org/en/ rel_0_9/ orm/loading_ relationships. html#contains- eager
Partial-Bug: #1414905 5ef67f96e3274d5 381a6e50e62
Closes-Bug: #1410841
Change-Id: I2243cdfda5c6fe