Bug.initial_message fetches all of the bug's messages
Bug #606914 reported by
Jeroen T. Vermeulen
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
High
|
Graham Binns |
Bug Description
Bug.initial_message sorts Bug.messages using Python's sorted() builtin and then extracts the first message.
That's a bad idea because it forces the ORM to fetch and deserialize all of a bug's messages just in order to get the first one. There could be hundreds of messages.
This problem could conceivably be a factor behind bug 497386, in which case the easy fix for both is to sort and slice Bug.messages directly without listifying it python-side first.
Related branches
lp://qastaging/~gmb/launchpad/bug-606914
- Robert Collins (community): Approve
- Launchpad code reviewers: Pending (code) requested
-
Diff: 18 lines (+6/-2)1 file modifiedlib/lp/bugs/model/bug.py (+6/-2)
Changed in malone: | |
status: | New → Triaged |
importance: | Undecided → High |
tags: | added: timeout |
Changed in malone: | |
status: | Triaged → In Progress |
assignee: | nobody → Graham Binns (gmb) |
Changed in malone: | |
status: | In Progress → Triaged |
assignee: | Graham Binns (gmb) → nobody |
tags: |
added: qa-ok removed: qa-needstesting |
Changed in malone: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Hi, this is implicated in a very frequent oops we had over the weekend - one particular bug API call in particular caused 4000 timeouts :(.
4098 SELECT Message. datecreated, Message.id, Message.owner, Message.parent, Message.raw, Message.rfc82 ... = %s AND Message.id = BugMessage.message AND ($INT=$INT) ORDER BY Message. datecreated, Message.id: /api.launchpad. net/1.0/ bugs/88746/ attachments (ScopedCollecti on:CollectionRe source)
GET: 4098 Robots: 0 Local: 0
4098 https:/
OOPS-1659B1002, OOPS-1659B1007, OOPS-1659B1008, OOPS-1659B1009, OOPS-1659B1010
If this issue is the root cause (it may not be) then this bug will block further improvements in the timeout window for production until fixed;