Open Bug 1726660 Opened 3 years ago Updated 6 months ago

Folder cache (folderCache.json) uses absolute path of the db file (.msf) as the per-folder key, which is needlessly tied to profile dir location.

Categories

(MailNews Core :: Database, task)

Tracking

(Not tracked)

People

(Reporter: benc, Unassigned)

References

(Blocks 1 open bug)

Details

Currently, nsMsgFolderCache usage uses the absolute file path of the .msf file to locate folder data in the folder cache, eg:
/home/timmytestuser/stuff/profile-default/ImapMail/imap.localhost/INBOX.msf

This is needlessly specific and means the folderCache data won't found if you move a profile to a new location on disk, or to a machine running a different OS.
I think just using the folder URI as key would sort address this nicely.

The trick is handling the migration. We don't have an up-front list of all the folders in advance, so we need to do it on-the-fly.
There are three places where the key is used (via nsIMsgFolderCache.getCacheElement()):

https://searchfox.org/comm-central/search?q=GetCacheElement&path=&case=true&regexp=false

To migrate, these should:

  1. Look up the cacheElement using the the folder URI as key.
  2. if not found, try looking up the old key (the absolute filesystem path).
  3. if that was found, rename the key to the folder URI.

Actually, probably don't need to do this in all three places - just work out which one is used first (during folder creation) and do the migration there.

See Also: → 1726662
Blocks: 1774953
Summary: Folder cache uses absolute path of the db file (.msf) as the per-folder key, which is needlessly tied to profile dir location. → Folder cache (folderCache.json) uses absolute path of the db file (.msf) as the per-folder key, which is needlessly tied to profile dir location.
See Also: → 1870463
See Also: → 1897313
You need to log in before you can comment on or make changes to this bug.