Merge lp:~gmb/launchpad/fix-b.l.n-timeouts-bug-517798 into lp:launchpad

Proposed by Graham Binns
Status: Merged
Approved by: Aaron Bentley
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~gmb/launchpad/fix-b.l.n-timeouts-bug-517798
Merge into: lp:launchpad
Diff against target: 47 lines (+14/-14)
2 files modified
lib/canonical/launchpad/systemhomes.py (+1/-1)
lib/lp/bugs/stories/bugs/xx-front-page-bug-lists.txt (+13/-13)
To merge this branch: bzr merge lp:~gmb/launchpad/fix-b.l.n-timeouts-bug-517798
Reviewer Review Type Date Requested Status
Aaron Bentley (community) Approve
Canonical Launchpad Engineering code Pending
Review via email: mp+18866@code.launchpad.net

Commit message

Fix the timeouts caused by inefficient and unnecessary sorting on the Malone frontpage.

To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) wrote :

This branch fixes the timeouts on the Malone front page (see bug 517798). The timeouts were caused because we were (unnecessarily) ordering the results of the latest bugs query by (datecreated, id). Since this combination has no index it took far longer to order the result set than by just using datecreated, even though the results were the same (because datecreated and id advance together; it's very rare that two bugs have the same datecreated and even if they do we don't care all that much for the sake of the list of latest bugs).

The fix for this is to remove 'id' from the orderBy clause of the offending query. I've updated the pagetest for the Malone frontpage, which was the only test affected by this change.

This fix has already been cowboyed to production and edge; it needs to land on devel so that it will be rolled out without edge breaking again.

Revision history for this message
Aaron Bentley (abentley) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/canonical/launchpad/systemhomes.py'
--- lib/canonical/launchpad/systemhomes.py 2010-01-17 21:36:27 +0000
+++ lib/canonical/launchpad/systemhomes.py 2010-02-08 18:54:18 +0000
@@ -159,7 +159,7 @@
159 def latest_bugs(self):159 def latest_bugs(self):
160 user = getUtility(ILaunchBag).user160 user = getUtility(ILaunchBag).user
161 return getUtility(IBugSet).searchAsUser(161 return getUtility(IBugSet).searchAsUser(
162 user=user, orderBy=['-datecreated', '-id'], limit=5)162 user=user, orderBy=['-datecreated'], limit=5)
163163
164 def default_bug_list(self, user=None):164 def default_bug_list(self, user=None):
165 return getUtility(IBugSet).searchAsUser(user)165 return getUtility(IBugSet).searchAsUser(user)
166166
=== modified file 'lib/lp/bugs/stories/bugs/xx-front-page-bug-lists.txt'
--- lib/lp/bugs/stories/bugs/xx-front-page-bug-lists.txt 2010-01-19 15:56:35 +0000
+++ lib/lp/bugs/stories/bugs/xx-front-page-bug-lists.txt 2010-02-08 18:54:18 +0000
@@ -49,19 +49,19 @@
49 ... summary_td.b.renderContents().strip(),49 ... summary_td.b.renderContents().strip(),
50 ... summary_td.a.renderContents())50 ... summary_td.a.renderContents())
51 Bigfixer:51 Bigfixer:
52 Summary for new bug 1052 Summary for new bug 2
53 <BLANKLINE>53 <BLANKLINE>
54 Bigfixer:54 Bigfixer:
55 Summary for new bug 955 Summary for new bug 3
56 <BLANKLINE>56 <BLANKLINE>
57 Bigfixer:57 Bigfixer:
58 Summary for new bug 858 Summary for new bug 1
59 <BLANKLINE>59 <BLANKLINE>
60 Bigfixer:60 Bigfixer:
61 Summary for new bug 761 Summary for new bug 5
62 <BLANKLINE>62 <BLANKLINE>
63 Bigfixer:63 Bigfixer:
64 Summary for new bug 664 Summary for new bug 4
65 <BLANKLINE>65 <BLANKLINE>
6666
6767