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
1=== modified file 'lib/canonical/launchpad/systemhomes.py'
2--- lib/canonical/launchpad/systemhomes.py 2010-01-17 21:36:27 +0000
3+++ lib/canonical/launchpad/systemhomes.py 2010-02-08 18:54:18 +0000
4@@ -159,7 +159,7 @@
5 def latest_bugs(self):
6 user = getUtility(ILaunchBag).user
7 return getUtility(IBugSet).searchAsUser(
8- user=user, orderBy=['-datecreated', '-id'], limit=5)
9+ user=user, orderBy=['-datecreated'], limit=5)
10
11 def default_bug_list(self, user=None):
12 return getUtility(IBugSet).searchAsUser(user)
13
14=== modified file 'lib/lp/bugs/stories/bugs/xx-front-page-bug-lists.txt'
15--- lib/lp/bugs/stories/bugs/xx-front-page-bug-lists.txt 2010-01-19 15:56:35 +0000
16+++ lib/lp/bugs/stories/bugs/xx-front-page-bug-lists.txt 2010-02-08 18:54:18 +0000
17@@ -49,19 +49,19 @@
18 ... summary_td.b.renderContents().strip(),
19 ... summary_td.a.renderContents())
20 Bigfixer:
21- Summary for new bug 10
22- <BLANKLINE>
23- Bigfixer:
24- Summary for new bug 9
25- <BLANKLINE>
26- Bigfixer:
27- Summary for new bug 8
28- <BLANKLINE>
29- Bigfixer:
30- Summary for new bug 7
31- <BLANKLINE>
32- Bigfixer:
33- Summary for new bug 6
34+ Summary for new bug 2
35+ <BLANKLINE>
36+ Bigfixer:
37+ Summary for new bug 3
38+ <BLANKLINE>
39+ Bigfixer:
40+ Summary for new bug 1
41+ <BLANKLINE>
42+ Bigfixer:
43+ Summary for new bug 5
44+ <BLANKLINE>
45+ Bigfixer:
46+ Summary for new bug 4
47 <BLANKLINE>
48
49