Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 145dbaa)
- Loading branch information