usage errors in joinedload + filter in agent schedulers

Bug #1414905 reported by YAMAMOTO Takashi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
YAMAMOTO Takashi

Bug Description

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. It doesn't seem
to be the intended behaviour. As a consequence the filter
doesn't work as expected.

see http://docs.sqlalchemy.org/en/rel_0_9/orm/loading_relationships.html#contains-eager

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/150284

Changed in neutron:
assignee: nobody → YAMAMOTO Takashi (yamamoto)
status: New → In Progress
Kyle Mestery (mestery)
Changed in neutron:
milestone: none → kilo-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/150284
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=96aa9f93600d6e97394ad725e095d5539848ca2d
Submitter: Jenkins
Branch: master

commit 96aa9f93600d6e97394ad725e095d5539848ca2d
Author: YAMAMOTO Takashi <email address hidden>
Date: Tue Jan 27 15:33:36 2015 +0900

    Fix a usage error of joinedload + filter in dhcp scheduler

    This commit fixes filtering in get_dhcp_agents_hosting_networks.

    Also, separate the argument "active" into two; active (heartbeat thing)
    and admin_state_up. Because all in-tree callers with active=True seem
    to mean only the former, currently the new admin_state_up argument is not
    used. (Thus this commit doesn't change any behaviour yet. The argument
    might be useful for other changes like [1])

    [1] https://review.openstack.org/#/c/147032/

    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 NetworkDhcpAgentBinding 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 = ...;

    Reference: http://docs.sqlalchemy.org/en/rel_0_9/orm/loading_relationships.html#contains-eager

    Closes-Bug: #1414905
    Change-Id: Idf9ffdb849de58fba8c18c357ffa10cf0f398140

Changed in neutron:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/149458
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=5a480be4a806e9f9b6e87f217a43fcc5fd8553dc
Submitter: Jenkins
Branch: master

commit 5a480be4a806e9f9b6e87f217a43fcc5fd8553dc
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
    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 = ...;

    Reference: http://docs.sqlalchemy.org/en/rel_0_9/orm/loading_relationships.html#contains-eager

    Partial-Bug: #1414905
    Closes-Bug: #1410841
    Change-Id: I2243cdfda5c6fe5ef67f96e3274d5381a6e50e62

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/juno)

Fix proposed to branch: stable/juno
Review: https://review.openstack.org/167919

Kyle Mestery (mestery)
Changed in neutron:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (stable/juno)

Change abandoned by Arnaud Morin (<email address hidden>) on branch: stable/juno
Review: https://review.openstack.org/167919
Reason: need more work to be merge correctly in juno release

Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: kilo-rc1 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.