Convert nsFolderCache from mork (panacea.dat) to JSON-cpp
Categories
(MailNews Core :: Database, task, P3)
Tracking
(thunderbird_esr91 wontfix)
Tracking | Status | |
---|---|---|
thunderbird_esr91 | --- | wontfix |
People
(Reporter: jcranmer, Assigned: benc)
References
(Blocks 3 open bugs)
Details
User Story
Original summary was: `Convert panacea.dat from mork to another database format such as mozStorage(SQLite DB), IndexedDB(constructed on mozStorage in Mozilla), localStorage(DOMStorage, constructed on mozStorage in Mozilla)`
Attachments
(3 files, 7 obsolete files)
(deleted),
patch
|
jcranmer
:
review+
jcranmer
:
superreview+
|
Details | Diff | Splinter Review |
(deleted),
text/plain
|
Details | |
(deleted),
text/x-phabricator-request
|
Details |
Reporter | ||
Comment 1•17 years ago
|
||
Reporter | ||
Comment 2•17 years ago
|
||
Comment 3•17 years ago
|
||
Reporter | ||
Comment 4•17 years ago
|
||
Comment 5•17 years ago
|
||
Reporter | ||
Updated•17 years ago
|
Reporter | ||
Comment 6•17 years ago
|
||
Comment 7•17 years ago
|
||
Reporter | ||
Comment 8•17 years ago
|
||
Comment 9•17 years ago
|
||
Reporter | ||
Comment 10•17 years ago
|
||
Comment 11•17 years ago
|
||
Reporter | ||
Updated•17 years ago
|
Comment 12•17 years ago
|
||
Reporter | ||
Comment 13•17 years ago
|
||
Comment 14•17 years ago
|
||
Comment 15•17 years ago
|
||
Comment 16•17 years ago
|
||
Reporter | ||
Comment 17•17 years ago
|
||
Reporter | ||
Updated•17 years ago
|
Comment 18•17 years ago
|
||
Comment 19•17 years ago
|
||
Comment 20•17 years ago
|
||
Comment 21•17 years ago
|
||
Comment 22•17 years ago
|
||
Comment 23•17 years ago
|
||
Comment 24•17 years ago
|
||
Reporter | ||
Comment 25•17 years ago
|
||
Comment 26•17 years ago
|
||
Comment 27•17 years ago
|
||
Reporter | ||
Comment 28•17 years ago
|
||
Comment 29•17 years ago
|
||
Reporter | ||
Comment 30•17 years ago
|
||
Comment 31•17 years ago
|
||
Comment 32•17 years ago
|
||
Comment 33•17 years ago
|
||
Comment 34•17 years ago
|
||
Comment 35•17 years ago
|
||
Comment 36•17 years ago
|
||
Reporter | ||
Comment 37•17 years ago
|
||
Comment 38•17 years ago
|
||
Comment 39•17 years ago
|
||
Comment 40•17 years ago
|
||
Comment 41•17 years ago
|
||
Comment 42•17 years ago
|
||
Comment 43•17 years ago
|
||
Comment 44•17 years ago
|
||
Reporter | ||
Comment 45•16 years ago
|
||
Comment 46•16 years ago
|
||
Reporter | ||
Comment 47•16 years ago
|
||
Reporter | ||
Comment 48•16 years ago
|
||
Reporter | ||
Updated•16 years ago
|
Reporter | ||
Comment 49•16 years ago
|
||
Updated•16 years ago
|
Updated•16 years ago
|
Reporter | ||
Comment 50•16 years ago
|
||
Comment 51•16 years ago
|
||
Updated•15 years ago
|
Updated•15 years ago
|
Reporter | ||
Comment 52•13 years ago
|
||
Comment 53•13 years ago
|
||
Reporter | ||
Updated•12 years ago
|
Reporter | ||
Updated•12 years ago
|
Comment 54•12 years ago
|
||
Comment 55•10 years ago
|
||
Reporter | ||
Comment 56•10 years ago
|
||
Comment 57•10 years ago
|
||
Comment 58•10 years ago
|
||
Comment 59•10 years ago
|
||
Reporter | ||
Comment 60•10 years ago
|
||
Comment 61•10 years ago
|
||
Comment 62•10 years ago
|
||
Updated•10 years ago
|
Comment 63•10 years ago
|
||
Comment 64•10 years ago
|
||
Comment 65•8 years ago
|
||
Updated•5 years ago
|
Reporter | ||
Comment 66•5 years ago
|
||
Some comments about how a new version ought to be implemented:
The purpose of panacea.dat is to store some basic folder information (such as unread counts) that do not require opening up the database and reading values--a potentially expensive operation, given the design of Mork. It's effectively a key-key-value store. Furthermore, it's a cache for various database properties. Therefore, the most important property is consistency--we shouldn't be able to read a value that is different from the main database value. Durability is less important--if we can detect that the file is damaged, then throwing it away and recovering from database information is sufficient (if inefficient).
The best implementation is probably a JSON file that is read on startup, and written to atomically in the background (i.e., don't wait for the database to commit before doing stuff). Using a full database solution like SQLite is way overkill (and I'm aware that I tried to do that a decade ago, but I was younger and stupider back then). A full asynchronous API is also likely to be a bad idea--it requires making some basic API calls such as "get the number of unread messages in this folder" asynchronous without really adding any value.
Updated•5 years ago
|
Assignee | ||
Comment 67•3 years ago
|
||
Assignee | ||
Comment 68•3 years ago
|
||
Here's my first-pass attempt at switching from the mork-based folder cache to JSON.
It can migrate old-style panacea.dat files, but the intention would be that this would disappear eventually. The idea is to avoid huge numbers of users experiencing slowdowns on the first run of a new release, as things are recalculated for the foldercache. It seems less bad if the slowdown is limited to users who haven't upgraded for a few releases...
(caveat: I don't have any real idea on what the speed issues involved are. Maybe the folder cache is completely redundant these days and should be removed entirely :- )
Some notes:
- It uses jsoncpp, as found in M-C.
- I ended up just using jsoncpp
Json::Value
as the in-memory storage (It boils down more-or-less to std::map). Since that's what I'm loading to and saving from, it seemed a simple way to go. It's hidden behind-the-scenes anyway, so easy enough to change. - It currently writes waaaay too often - whenever there'd previously be a mork commit. I still need to set up deferred writes on a timer (Like how JSONFile does it). Along with a dirty flag.
- I changed the
nsIMsgFolderCacheElement
property access names (eg getInt32Property() -> getCachedInt32()) to make them more unique and easier to grep for. - As in the old panacea.dat, the elements are still keyed by the full native pathname to the .msf file. This seems wrong - key should just be the folder uri or something. Still pondering this.
- needs more testing (including more unit tests)
Some questions I could do with some feedback on:
- Reasonable approach so far? Or have I missed something really fundamental?
- The new foldercache file is
panacea.json
. Not sure of the historical reasons behind the name, so if you think it should be renamed, now's a good time :-) - The foldercache is all lumped together into a single top-level file. Would it make more sense to place per-folder files alongside the .msf files? (does away with nsIMsgFolderCacheElement keys altogether). I'm inclined to say no right now - there's already too much magic trying to determine the files types of stuff in the folder directories, but if we ever sort out that mess we should revisit the idea.
Updated•3 years ago
|
Comment 69•3 years ago
|
||
There's a lot to comment here, but first and foremost is: why are you using jsoncpp instead of JSONFile? There is already cache architecture and persistent json store for folder properties; either use one or the other for all folder things (Bug 1637668 for example). Without actual perf data, I will nevertheless guess there is almost no benefit to jsoncpp.
Assignee | ||
Comment 70•3 years ago
|
||
(In reply to alta88 from comment #69)
There's a lot to comment here, but first and foremost is: why are you using jsoncpp instead of JSONFile?
I did consider using JSONFile, but I felt I couldn't justify jumping across into javascript for this. Performance wasn't a consideration. It was more to avoid creating an extra C++/JS boundary. Jsoncpp was already being used elsewhere in the codebase, so seemed the obvious choice (There is some C++-accessible JSON code in C-C, but nothing quite so comprehensive).
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
Comment 71•3 years ago
|
||
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/5891b788e8bd
Convert nsFolderCache from mork (panacea.dat) to JSON. r=mkmelin
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Comment 72•3 years ago
|
||
Make the summary reflect what we actually did here, for the avoidance of doubt and confusion.
Comment 73•3 years ago
|
||
Unfortunately this change seems to have caused bug 1726319 ... if @BenC could have a loot at that it would be great! Thanks.
Comment 74•2 years ago
|
||
Query - would appreciate a heads up advice. People using beta do not have panacea.dat.
Various Support Forum fixes may involve deletion of panacea.dat file which gets recreated upon starting Thunderbird. This is still not a problem in 91*
Please advise: What is the new name of 'panacea.dat' file and can it also be deleted to fix errors because it auto gets recreated upon restart ?
Many thanks.
Comment 75•2 years ago
|
||
The new corresponding file is folderCache.json - if deleted it will get recreated on restart.
Comment 76•2 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #75)
The new corresponding file is folderCache.json - if deleted it will get recreated on restart.
Thanks - good to know!
Comment 77•2 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #75)
The new corresponding file is folderCache.json - if deleted it will get recreated on restart.
Much appreciated. Many thanks for info.
Updated•2 years ago
|
Description
•