Merge lp:~allenap/launchpad/early-batching-bulk-methods-bug-509223 into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Graham Binns |
Approved revision: | no longer in the source branch. |
Merged at revision: | not available |
Proposed branch: | lp:~allenap/launchpad/early-batching-bulk-methods-bug-509223 |
Merge into: | lp:launchpad |
Diff against target: |
221 lines (+166/-2) 3 files modified
lib/lp/bugs/interfaces/bugwatch.py (+31/-0) lib/lp/bugs/model/bugwatch.py (+29/-1) lib/lp/bugs/tests/test_bugwatch.py (+106/-1) |
To merge this branch: | bzr merge lp:~allenap/launchpad/early-batching-bulk-methods-bug-509223 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Graham Binns (community) | code | Approve | |
Review via email: mp+24134@code.launchpad.net |
Commit message
New methods for IBugWatchSet - bulkSetStatus() and bulkAddActivity() - which will be used to improve performance in checkwatches.
Description of the change
This branch adds two new methods to BugWatchSet: bulkSetStatus() and bulkAddActivity().
In checkwatches it's often necessary to update many 100s (maybe 1000s) of bug watches at a time, especially when the remote bug tracker is down. Currently checkwatches iterates through the materialized bug watch objects (from Storm), updating their attributes and calling addActivity(), before committing. This is horrendously slow because (a) these bug watch objects may need reloading because they were materialized in a separate transaction and reloads are done one at a time, (b) they will be saved one at a time, and (c) the activity is added one row at a time. For even a modest 100 bug watches this will result in 100 SELECT, 100 UPDATE and 100 INSERT statements. This branch reduces this to 1 UPDATE and 1 INSERT statement.
These methods were conceived with checkwatches in mind, but have not been stitched in yet. Graham is doing some major refactoring in the checkwatches packages so I'm deferring that work until later.
<gmb> allenap, I think bulkSetStatus() is a little confusing, because it's called ...SetStatus() but it in fact mutates last_error_type. However, given that we should rename that at some point I'd settle for an XXX to the effect of "yes, this sounds confusing, it isn't"
(and a bug)
<gmb> allenap, Other than that, the branch looks brilliant. r=me.