Merge lp:~lifeless/launchpad/milestones into lp:launchpad
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Curtis Hovey on 2010-08-22 | ||||
| Approved revision: | no longer in the source branch. | ||||
| Merged at revision: | 11409 | ||||
| Proposed branch: | lp:~lifeless/launchpad/milestones | ||||
| Merge into: | lp:launchpad | ||||
| Diff against target: |
1014 lines (+349/-154) 20 files modified
lib/canonical/launchpad/interfaces/validation.py (+1/-1) lib/canonical/launchpad/security.py (+5/-32) lib/canonical/launchpad/utilities/personroles.py (+4/-0) lib/lp/bugs/browser/bugtarget.py (+0/-5) lib/lp/bugs/browser/bugtask.py (+2/-19) lib/lp/bugs/browser/tests/bugtask-target-link-titles.txt (+1/-1) lib/lp/bugs/browser/tests/test_bugtarget_filebug.py (+1/-1) lib/lp/bugs/interfaces/bugtask.py (+8/-0) lib/lp/bugs/model/bug.py (+28/-5) lib/lp/bugs/model/bugtarget.py (+1/-7) lib/lp/bugs/model/bugtask.py (+191/-72) lib/lp/bugs/stories/bug-privacy/40-unsubscribe-from-private-bug.txt (+2/-2) lib/lp/bugs/tests/test_bugtask.py (+24/-1) lib/lp/registry/browser/tests/test_milestone.py (+72/-4) lib/lp/registry/browser/tests/test_views.py (+1/-0) lib/lp/registry/doc/distribution.txt (+1/-1) lib/lp/registry/doc/sourcepackage.txt (+1/-1) lib/lp/registry/model/distroseries.py (+3/-0) lib/lp/registry/model/sourcepackage.py (+2/-1) lib/lp/testing/factory.py (+1/-1) |
||||
| To merge this branch: | bzr merge lp:~lifeless/launchpad/milestones | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Curtis Hovey (community) | code | 2010-08-17 | Approve on 2010-08-22 |
| Deryck Hodge (community) | code | 2010-08-17 | Approve on 2010-08-19 |
| Graham Binns (community) | code | 2010-08-17 | Approve on 2010-08-17 |
|
Review via email:
|
|||
Commit Message
Convert BugTaskSet.search to return a storm resultset and cache the user queried with as a viewer on returned Bug objects.
Description of the Change
Hopefully fix the current instantiation of https:/
Private bug access checking is rather slow: https:/
Solution - a cached attribute recording people that we've calculated should have view access, prepopulated by BugTaskSet.
Added tests for the low level behaviour and that it fixes the observed scaling problem in a simple milestone view.
\o/
| Robert Collins (lifeless) wrote : | # |
| Graham Binns (gmb) wrote : | # |
Hi Rob,
Couple of nitpicks, but otherwise okay. Marking it needs fixing because
of the over-long test (see below) but if we can't split that up I'm
happy for it to land as-is.
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -792,6 +796,28 @@
> result = target.
> self.assertEqua
>
> + def test_private_
> + """private bugs from a search know the user can see the bugs."""
Captialise at the start of the sentence ;).
> + target = self.makeBugTar
> + person = self.login()
> + self.factory.
> + self.factory.
> + # Search style and parameters taken from the milestone index view where
> + # the issue was discovered.
> + login_person(
> + tasks =target.
Needs a space after the =.
> + orderby=['status', '-importance', 'id']))
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -105,5 +116,61 @@
> self.assertEqual(0, product.
>
>
> -def test_suite():
> - return unittest.
> +class TestMilestoneIn
> +
> + layer = DatabaseFunctio
> +
> + def test_more_
The test should have a comment at the start of it to save me having to
parse the method name.
> + product = self.factory.
> + login_person(
> + milestone = self.factory.
> + productseries=
> + bug1 = self.factory.
> + owner=product.
> + bug1.bugtasks[
> + # We look at the page as someone who is a member of a team and the team
> + # is subscribed to the bugs, so that we don't get trivial shortcuts
> + # avoiding queries : test the worst case.
> + subscribed_team = self.factory.
> + viewer = self.factory.
> + with person_
> + subscribed_
> + bug1.subscribe(
> + bug1_url = canonical_url(bug1)
> + milestone_url = canonical_
> + browser = self.getUserBro
> + # Seed the cookie cache and any other cross-request state we may gain
> + # in future. See canonical.
> + browser.
> + collector = QueryC...
| Robert Collins (lifeless) wrote : | # |
I'll do the tweaks; I don't see a good way (for now) of shrinking the
test; two separate tests would require a magic constant to be shared
between them rather than being derived on the fly; that would be more
fragile.
-Rob
| Graham Binns (gmb) wrote : | # |
On 17 August 2010 11:48, Robert Collins <email address hidden> wrote:
> I'll do the tweaks; I don't see a good way (for now) of shrinking the
> test; two separate tests would require a magic constant to be shared
> between them rather than being derived on the fly; that would be more
> fragile.
>
Right, that's pretty much what I figured.
| Curtis Hovey (sinzui) wrote : | # |
MilestoneView.
MilestoneView.
| Robert Collins (lifeless) wrote : | # |
On Wed, Aug 18, 2010 at 2:18 AM, Curtis Hovey
<email address hidden> wrote:
> Review: Needs Information
> MilestoneView.
For objects queries via that search path, the precaching be removed. I
do not know if getConjoinedMaster accesses the related objects via
that code path - and I suspect in fact that it does not.
> MilestoneView.
We can refactor the conjoined master stuff too, but its a separate issue IMO.
-Rob
| Curtis Hovey (sinzui) wrote : | # |
I do not understand the first part of your answer. I see this in MilestoneView.
...
for task in tasks:
if task.getConjoin
# Checking bug permissions is expensive. We know from the query that
# the user has at least launchpad.View on the bugtasks and their bugs.
return non_conjoined_
Since you modified the permission rules on bugtask, I wonder if the first precache_
We stopped adding enahncements to the milestone page when the preformance problems started, and we cannot entertain allowing users to edit the bugtasks unless we know the user has launchpad.Edit. I wonder if this permission change allows us to consider enhancements.
| Robert Collins (lifeless) wrote : | # |
I certainly think you can make enchancements, and yes we should be
able to remove the precache permissions for nonconjoinedslaves.
I'd like to do that separately from this branch, as a mitigation : I
know what I've researched works, I'm not sure that there aren't other
gremlins in there.
| Curtis Hovey (sinzui) wrote : | # |
Yes. I agree that the removal of precache_
| Deryck Hodge (deryck) wrote : | # |
Looks good to me, Robert. Thanks for doing this work!
Cheers,
deryck
| Robert Collins (lifeless) wrote : | # |
I hate to ask for a rereview, but I'll ask anyhow. This branch ran into incompatibilities with SQLObjectResultSet so it now converts buildQuery and thing things on it to be less SQLObject and more Storm. This involved finding addressing a bunch of differences; it still has literal SQL and so on, but at least at the surface its now sensible. I'm running it through EC2 test now.
| Curtis Hovey (sinzui) wrote : | # |
Hi Robert.
Thanks for this refactoring.
Can you place a comment before ``if False
I think you can remove the naked taskset in BugTaskSet.
| Robert Collins (lifeless) wrote : | # |
Thank you curtis; I've deleted the naked taskset, and deleted the
print statements I had accidentally left in which had that confusing
if statement.
This is the only failing test ec2 told me about
FAIL: productseries-
-------
Text attachment: traceback
------------
Traceback (most recent call last):
File "/usr/lib/
testMethod()
File "/usr/lib/
raise self.failureExc
AssertionError: Failed doctest test for productseries-
File "lib/lp/
-------
File "lib/lp/
in productseries-
Failed example:
script = find_tag_
Differences (ndiff with -expected +actual):
+ WARNING:
pt:testrunner:
-------
File "lib/lp/
102, in productseries-
Failed example:
content = view.render()
Differences (ndiff with -expected +actual):
+ WARNING:
pt:testrunner:
-------
File "lib/lp/
117, in productseries-
Failed example:
table = find_tag_
Differences (ndiff with -expected +actual):
+ WARNING:
pt:testrunner:
If you have any ideas about it, I'd love to know.
| Curtis Hovey (sinzui) wrote : | # |
productseries-
Add this to special_test_layer in lp/registry/
'productser

Deryck, Curtis, would appreciate sanity checks from you :)