Merge lp:~wgrant/launchpad/upcoming-optimisation-mk2 into lp:launchpad

Proposed by William Grant
Status: Merged
Merged at revision: 18403
Proposed branch: lp:~wgrant/launchpad/upcoming-optimisation-mk2
Merge into: lp:launchpad
Diff against target: 16 lines (+5/-1)
1 file modified
lib/lp/registry/model/person.py (+5/-1)
To merge this branch: bzr merge lp:~wgrant/launchpad/upcoming-optimisation-mk2
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+325298@code.launchpad.net

Commit message

Force +upcomingwork to apply the spec privacy check only to relevant specs.

Description of the change

Force +upcomingwork to apply the spec privacy check only to relevant specs.

The seq scan for the join in the outer query is fine, but we need to
avoid applying the privacy check to everything. It looks like the ACL
array intersection is starting to get untenable for some users over a
hundred thousand specs.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/registry/model/person.py'
--- lib/lp/registry/model/person.py 2017-06-06 11:28:27 +0000
+++ lib/lp/registry/model/person.py 2017-06-08 10:03:51 +0000
@@ -1459,7 +1459,11 @@
1459 origin = [Specification]1459 origin = [Specification]
1460 productjoin, query = get_specification_active_product_filter(self)1460 productjoin, query = get_specification_active_product_filter(self)
1461 origin.extend(productjoin)1461 origin.extend(productjoin)
1462 query.extend(get_specification_privacy_filter(user))1462 query.append(Exists(Select(
1463 1, tables=[Specification],
1464 where=And(
1465 Specification.id == SpecificationWorkItem.specification_id,
1466 *get_specification_privacy_filter(user)))))
1463 origin.extend([1467 origin.extend([
1464 Join(SpecificationWorkItem,1468 Join(SpecificationWorkItem,
1465 SpecificationWorkItem.specification == Specification.id),1469 SpecificationWorkItem.specification == Specification.id),