Detect and rename corrupt Skv databases
Categories
(Core :: SQLite and Embedded Database Bindings, enhancement, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox132 | --- | fixed |
People
(Reporter: lina, Assigned: lina)
References
(Blocks 2 open bugs)
Details
Attachments
(3 files, 1 obsolete file)
Let's add a periodic background maintenance task to Skv. This task will be responsible for detecting and fixing up database coherence issues, and vacuuming the database. Some examples of things we'll want to run: PRAGMA integrity_check, PRAGMA foreign_key_check, REINDEX, and VACUUM.
For inspiration, Desktop's PlacesDBUtils.sys.mjs does this for Places, Fenix's PlacesHistoryStorageWorker calls into the Rust Places maintenance routine in Application Services, IndexedDB's DatabaseMaintenance class runs PRAGMA integrity_check and VACUUM.
Comment 1•1 year ago
•
|
||
if you set incremental vacuum, you can run that instead of a full vacuum.
You may also want to run pragma optimize before closing the connection.
REINDEX should not be normally necessary, it's only a way to try to fix a database if integrity_check fails due to indexing problems, it may or may not solve the problem, though now there is also a recovery api that we didn't use yet.
Updated•1 year ago
|
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 2•1 year ago
|
||
Depends on D220045
| Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
| Assignee | ||
Comment 3•1 year ago
|
||
Depends on D220760
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
| Assignee | ||
Comment 4•1 year ago
|
||
Depends on D220786
| Assignee | ||
Comment 5•1 year ago
|
||
Previously:
Store::open()returned anOpenStorethat held two
Arc<Connection>s: one writer; one reader.Store::{reader, writer}()returned aConnectionGuardthat
incremented the store's pending operation count in its constructor,
and decremented the count in its destructor.
This design had two issues:
- Forgetting to wrap one of the
Arc<Connection>s in a
ConnectionGuardcould cause the pending operation count to
fall out of sync with the reference counts of both connections. ConnectionGuardcould have decremented the pending operation count
too early. According to Rust's rules [1], this logic would have run
before the guard'sArc<Connection>field was dropped. If this
happened whileStore::close()was waiting on pending operations to
finish,OperationWaiter::wait()could have unblocked the calling
thread, only for theArc::try_unwrap()call to fail.
This commit makes the store's use of guard objects more robust:
ConnectionGuardis now split intoOpenStoreGuardand
OperationGuard. AnOpenStoreGuardholds anArc<OpenStore>
and anOperationGuardin fields that are dropped in order.OpenStoreis now stored in anArc, ensuring that the lifecycles
and reference counts of the reader and writer are the same.
As a consequence, Reader and Writer are the new guard types for the
read-only and read-write connections.
Depends on D220045
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Comment 7•1 year ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/e5c866e72f91
https://hg.mozilla.org/mozilla-central/rev/3b23f0165872
https://hg.mozilla.org/mozilla-central/rev/29c91f045ba8
Description
•