commit 369faa28731efd8f79820a0f8aa45dc6d614bec7
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)
Reviewed: https:/ /review. openstack. org/384841 /git.openstack. org/cgit/ openstack/ neutron/ commit/ ?id=369faa28731 efd8f79820a0f8a a45dc6d614bec7
Committed: https:/
Submitter: Jenkins
Branch: stable/mitaka
commit 369faa28731efd8 f79820a0f8aa45d c6d614bec7
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 1e86b2fbd8aa895 578153f4cf9 1294869eec54773 1a9694cbad)
Change-Id: I4364f4a97a2904
(cherry picked from commit 145dbaab21c7b54