Closed Bug 1848916 Opened 2 years ago Closed 2 years ago

Handle OPFS entries renamed with database manager version 001

Categories

(Core :: DOM: File, defect, P1)

defect

Tracking

()

VERIFIED FIXED
118 Branch
Tracking Status
firefox116 --- wontfix
firefox117 + verified
firefox118 + verified

People

(Reporter: janv, Assigned: jari)

References

Details

Attachments

(1 file, 1 obsolete file)

Database manager version 001 doesn't rehash files or directories on rename, unique EntryIds are generated instead if there are collisions. Database manager version 002 started doing the rehashing, but the upgrade from version 001 to version 002 doesn't rehash all the files and directories, so if an entry is accessed with database manager version 002 which was previously renamed, the code tries to insert the same EntryId into Entries and Files tables. There are several options how to fix this problem:

  1. Rehash everything during the existing upgrade
  2. Rehash everything during a new upgrade (a new version would be introduced)
  3. Allow generation of unique EntryIds in database manager version 002

Jari and I analyzed the options I described in comment 0 and we concluded that option 3 isn't a good solution, apps which move files could still experience problems. Jari is now working on the "rehashing everything" solution.

Assignee: jvarga → jjalkanen
Attachment #9349204 - Attachment description: WIP: Bug 1848916 - Ensure EntryId corresponds to path for OPFS schema 002. r=#dom-storage → Bug 1848916 - Ensure EntryId corresponds to path for OPFS schema 002. r=#dom-storage
Attachment #9349167 - Attachment is obsolete: true
Pushed by jjalkanen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/12fe4a2e961d Ensure EntryId corresponds to path for OPFS schema 002. r=dom-storage-reviewers,janv

Please nominate this for Beta approval as soon as you're comfortable doing so.

Flags: needinfo?(jjalkanen)
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 118 Branch

Comment on attachment 9349204 [details]
Bug 1848916 - Ensure EntryId corresponds to path for OPFS schema 002. r=#dom-storage

Beta/Release Uplift Approval Request

  • User impact if declined: Web Photoshop users cannot save or edit their preferences. Other applications may be experience data corruption when file handles which have been moved or renamed and saved in serialized form are used after a migration.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce: There has already been manual testing at least four people.
  • In a new profile, Edit a file using 115 (log into PS, select a file to edit).
  • Save.
  • Wait until the cloud icon (center top) goes back to just a cloud.
  • Exit (should be no warnings).
  • Load new build with that profile.
  • Restore previous session (loads the file).
  • Make any edit to it.
  • Save. There should be no errors reported; cloud icon should indicate save completed.
  • Repeat, but inbetween 115 and the new build, try to load the file in 116.0.2. (I.e. create a corrupt profile).
  • The file will fail to finish loading.
  • Repeat, but inbetween 115 and the new build, try to load the file in 116.0.3.
  • The file should load and be editable. However saving will throw two errors.
  • The save appears to complete.
  • And for good measure, in a new profile use the new build to edit and save a file
  • List of other uplifts needed: -
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): The patch restores the integrity of the data or falls back to the previous state. It is composed of previously used programming constructs. The code path has been throroughly tested by the incident team and there is an automated test which will be landed later because it requires certain infrastructure changes.

The alternative considered is to forget the old user data and start from an empty OPFS profile.

  • String changes made/needed: -
  • Is Android affected?: Yes
Flags: needinfo?(jjalkanen)
Attachment #9349204 - Flags: approval-mozilla-beta?

Comment on attachment 9349204 [details]
Bug 1848916 - Ensure EntryId corresponds to path for OPFS schema 002. r=#dom-storage

Approved for 117.0b9.

Attachment #9349204 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [qa-triaged]

I tested the scenarios from comment 7 using both latest Nightly and Firefox 117.0b9 across platforms (Windows 10, macOS 13 and Ubuntu 18.04) and I found no issues/errors on my side as well.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: