Open Bug 1952550 Opened 19 days ago Updated 16 days ago

To reduce cleanup overhead at origin init, consider restricting use of marker file to when there mutations have been made, possibly tracking in-flight mutations with an RAII that can remove the marker when all mutations are completed

Categories

(Core :: Storage: Cache API, enhancement)

enhancement

Tracking

()

People

(Reporter: asuth, Unassigned)

Details

It came up in discussion of https://phabricator.services.mozilla.com/D240734 about how often we call BodyDeleteOrphanedFiles that while we only perform cleanup if the marker file exists at origin init, the marker file exists for the entire time the Context exists, and this covers read-only access patterns as well as mutations. While we could delay the creation of the marker file until the first mutation occurs (and this could be a good first step), this wouldn't help for patterns with occasional mutations, such as for a ServiceWorker that caches previously unseen URL requests and periodically evicts old data. And a time-based heuristic isn't sufficient since situations like an orphaned cache or a referenced-but-deleted Response can persist for a very long time and we need to deterministically know whether there is currently some pending action that would need to be cleaned up on next start.

I wonder if we could use our mechanism of directory locks to flag when a directory may be considered to be potentially dirty.

You need to log in before you can comment on or make changes to this bug.