Closed Bug 1028795 Opened 6 years ago Closed 6 years ago

pre-load all related bugs during show_bug initialisation

Categories

(Bugzilla :: Bugzilla-General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 5.0

People

(Reporter: glob, Assigned: glob)

References

Details

(Keywords: bmo-goal, perf)

Attachments

(1 file)

currently if a bug is referenced in a comment (either by the comment text, or as a duplicate) the rows for each referenced bug is loaded one at a time from the database.

for bugs with a lot of duplicates or comments this can be a costly exercise.

we should extract referenced bugs from comments, load them in a list with a single db query, and populate the object cache with the returned bug objects.
Keywords: bmo-goal
Attached patch 1028795_1.patchSplinter Review
Attachment #8444255 - Flags: review?(sgreen)
as an example, this patch removes 22 database queries when viewing bug #1 on my dev system...


without patch (each cache MISS results in a request to the database for that bug's row):

bug 1 : cache MISS
new_from_list : 696 1785 2292 2366 3038 3750 5452 5607 6803 8969 9753 11072 11436
new_from_list : 4 3533 6714 9576
new_from_list : 2 555 902 6147 6239 6512 6629 6687 7224 8687 10546 10952 11311 11461 12966 13783 14954 17355 3 554 5767 7189 8026 17874
bug 1 : cache HIT
bug 3 : cache MISS
bug 696 : cache MISS
bug 1 : cache HIT
bug 1 : cache HIT
bug 1 : cache HIT
bug 3 : cache HIT
bug 1785 : cache MISS
bug 7 : cache MISS
bug 3 : cache HIT
bug 3 : cache HIT
bug 3 : cache HIT
bug 3 : cache HIT
bug 2292 : cache MISS
bug 2458 : cache MISS
bug 2 : cache MISS
bug 3038 : cache MISS
bug 2 : cache HIT
bug 3412 : cache MISS
bug 3490 : cache MISS
bug 3412 : cache HIT
bug 3750 : cache MISS
bug 5361 : cache MISS
bug 3 : cache HIT
bug 5607 : cache MISS
bug 4 : cache MISS
bug 1 : cache HIT
bug 23 : cache MISS
bug 5452 : cache MISS
bug 6803 : cache MISS
bug 8969 : cache MISS
bug 9753 : cache MISS
bug 11072 : cache MISS
bug 11436 : cache MISS
bug 2366 : cache MISS
bug 16008 : cache MISS
bug 1000000 : cache MISS

with patch:

bug 1 : cache MISS
new_from_list : 696 1785 2292 2366 3038 3750 5452 5607 6803 8969 9753 11072 11436
new_from_list : 3 7 2458 2 9 3412 3490 5361 4 23 16008 1000000
new_from_list : 3533 6714 9576
new_from_list : 555 902 6147 6239 6512 6629 6687 7224 8687 10546 10952 11311 11461 12966 13783 14954 17355 554 5767 7189 8026 17874
bug 1 : cache HIT
bug 3 : cache HIT
bug 696 : cache HIT
bug 1 : cache HIT
bug 1 : cache HIT
bug 1 : cache HIT
bug 3 : cache HIT
bug 1785 : cache HIT
bug 7 : cache HIT
bug 3 : cache HIT
bug 3 : cache HIT
bug 3 : cache HIT
bug 3 : cache HIT
bug 2292 : cache HIT
bug 2458 : cache HIT
bug 2 : cache HIT
bug 3038 : cache HIT
bug 2 : cache HIT
bug 3412 : cache HIT
bug 3490 : cache HIT
bug 3412 : cache HIT
bug 3750 : cache HIT
bug 5361 : cache HIT
bug 3 : cache HIT
bug 5607 : cache HIT
bug 4 : cache HIT
bug 1 : cache HIT
bug 23 : cache HIT
bug 5452 : cache HIT
bug 6803 : cache HIT
bug 8969 : cache HIT
bug 9753 : cache HIT
bug 11072 : cache HIT
bug 11436 : cache HIT
bug 2366 : cache HIT
bug 16008 : cache HIT
bug 1000000 : cache MISS (bug doesn't exist)


the downside of this patch is we run quoteUrls() twice for each comment.
Attachment #8444255 - Flags: review?(sgreen) → review+
Flags: approval+
Target Milestone: --- → Bugzilla 5.0
To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git
   a26d34a..99e02ea  master -> master
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Blocks: 1191937
You need to log in before you can comment on or make changes to this bug.