Closed Bug 686706 Opened 13 years ago Closed 11 years ago

Don't fsync when initializing nsDownloadManager

Categories

(Toolkit :: Downloads API, defect)

6 Branch
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: Yoric, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: perf)

Attachments

(1 file, 2 obsolete files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:6.0.2) Gecko/20100101 Firefox/6.0.2
Build ID: 20110902133214



Actual results:

At startup, nsDownloadManager uses sqlite in synchronous mode, which causes useless fsync when creating an empty database.


Expected results:

Remove the fsync.
Blocks: 611837
OS: Mac OS X → All
Hardware: x86 → All
Component: General → Download Manager
Product: Firefox → Toolkit
QA Contact: general → download.manager
What happens if you crash then?
Good point. I am just starting my review on startup I/O but currently, I have the impression that all sorts of things can go wrong if we crash at startup and that transacting nsDownloadManager init will not help.
The right fix here is to make all the download manager APIs async.  That's a lot of work, though.

If that is undertaken, it may be worthwhile to look into implementing the download manager on top of Places (since almost all the data we care about is already stored there) instead of having its own database.
Taking a look at sqlite async I/O (http://www.sqlite.org/asyncvfs.html).

At first glance, it seems to take the simple way towards async I/O: put all the I/O in a distinct thread. We could certainly use this, or, better, have a startup thread for all such startup I/O. I'll try working on the second option.
No, we don't want to use SQLite's async I/O.  It throws away durability in ACID.  We have written our own async I/O for SQLite (see `executeAsync` on `mozIStorageStatement` and `mozIStorageConnection`).
First (well, second) draft of a mechanism that could possibly help with async initialization: https://wiki.mozilla.org/User:Yoric/RunLevelQueue .
Attachment #561692 - Attachment is patch: true
Does the patch need a review or it's still a work in progress?
Status: UNCONFIRMED → NEW
Ever confirmed: true
It is a work in progress.
Paolo, will bug 825588 et al. help here?
Flags: needinfo?(paolo.mozmail)
(In reply to David Rajchenbach Teller [:Yoric] from comment #12)
> Paolo, will bug 825588 et al. help here?

Definitely, that's more or less the "lot of work" mentioned in comment 5 :-)
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: needinfo?(paolo.mozmail)
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: