← Back to team overview

launchpad-reviewers team mailing list archive

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

 

William Grant has proposed merging lp:~wgrant/launchpad/upcoming-optimisation-mk2 into lp:launchpad.

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

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1696519 in Launchpad itself: "+upcomingwork for canonical-foundations returns a timeout error"
  https://bugs.launchpad.net/launchpad/+bug/1696519

For more details, see:
https://code.launchpad.net/~wgrant/launchpad/upcoming-optimisation-mk2/+merge/325298

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.

-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/upcoming-optimisation-mk2 into lp:launchpad.
=== 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 @@
         origin = [Specification]
         productjoin, query = get_specification_active_product_filter(self)
         origin.extend(productjoin)
-        query.extend(get_specification_privacy_filter(user))
+        query.append(Exists(Select(
+            1, tables=[Specification],
+            where=And(
+                Specification.id == SpecificationWorkItem.specification_id,
+                *get_specification_privacy_filter(user)))))
         origin.extend([
             Join(SpecificationWorkItem,
                  SpecificationWorkItem.specification == Specification.id),


Follow ups