[RKV] get_or_create caches value for corrupted dbs
Categories
(Toolkit :: Storage, defect, P2)
Tracking
()
People
(Reporter: agi, Unassigned)
References
Details
Attachments
(1 obsolete file)
While writing tests for Bug 1645907 I noticed that rkv retains state from a corrupted tabase. This is problematic because the usual way to recover from a corrupted db is to delete (or move) the corrupted files and re-create the database. This is not possible currently because even after moving the files get_or_create
will fail with the cached error.
This is the test I'm using:
+ async recreateCorruptDatabase(path) {
+ try {
+ let uuid = gUUIDGenerator.generateUUID().toString().slice(1, -1);
+ const backupFolder = FileUtils.getDir("ProfD", ["extension-store.corrupt"], true);
+ backupFolder.append(uuid);
+ await OS.File.move(path, backupFolder.path, { noCopy: true });
+ await OS.File.removeDir(path);
+ } catch (ex) {
+ // At this point there's not a lot we can do
+ Cu.reportError(ex);
+ }
+
+ await OS.File.makeDir(path);
+ // Create new database file
+ this._store = await KeyValueService.getOrCreate(path, "permissions");
+ }
+
The last call to getOrCreate
will fail even though the directory is empty.
Reporter | ||
Comment 1•4 years ago
|
||
Updated•4 years ago
|
Updated•4 years ago
|
Pushed by asferro@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e43c0a04679a Clear rkv::get_or_create cache when an error occurs. r=vporof
Comment 3•4 years ago
|
||
Backed out along with https://bugzilla.mozilla.org/show_bug.cgi?id=1645907#c3
Backout by ncsoregi@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/613e8419e9b5 Backed out 2 changesets (bug 1646451, bug 1645907) for failures on test_extension_permissions_corrupt.js . CLOSED TREE
Comment 5•4 years ago
|
||
There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:agi, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•4 years ago
|
Updated•2 years ago
|
Comment 6•1 year ago
|
||
It seems that this may have been already covered on the rkv side in https://github.com/mozilla/rkv/pull/207 (which I just linked as a seealso).
I think that it would be still better to confirm with Lina if that is actually the case as it seems and and if there is anything else that may still be needed to be done on the mozilla-central side in Bug 1645907 comment 9, and so I'm leaving the issue status unchanged.
Updated•5 months ago
|
Description
•