Comment 13 for bug 1630939

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

Reviewed: https://review.openstack.org/421982
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=4f985fa5e62038f698b7cdd3c432cc7a53d5a32f
Submitter: Jenkins
Branch: stable/newton

commit 4f985fa5e62038f698b7cdd3c432cc7a53d5a32f
Author: Kevin Benton <email address hidden>
Date: Thu Oct 6 21:25:58 2016 -0700

    Get rid of double-join to rbac_entries without filter

    apply_filters_to_query was performing an outerjoin to rbac_entries
    unconditionally when model_query could have already performed an
    outerjoin (if the request was from an unprivileged user) and/or when
    the join wasn't even necessary (the '?shared=False' query that uses
    a subquery and not a join). This resulted in terrible performance
    because of cartesian products of rbac entries with themselves.

    This fixes the issue by ensuring there is only an outerjoin to the
    rbac table if it's going to be used for a filter condition and it's
    not already joined because of a query scope imposed due to the user
    not being privileged.

    Unfortunately this doesn't include tests to prevent regressions because
    we don't have any methods for testing the performance of individual
    queries.

    Closes-Bug: #1630939
    Change-Id: I4364f4a97a29041e86b2fbd8aa895578153f4cf9
    (cherry picked from commit 145dbaab21c7b541294869eec547731a9694cbad)