-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure to decode a block (fully or partially) will never be corrected #436
Comments
Seems related to #27. |
I think option #1 seems preferable. We don't have to worry about storing versions as per #27 for the MVP, since we will know what versions the MVP ships with, so can add it in the next iteration. It would be good to build some metrics that run on mobile devices so that we can see how long a complete re-index takes. It is the same time that it takes to sync and add a new device to a project. I think it is ok that a user sees an "upgrading your database" message after an app update, but we should check that with the co-design team after we know how long it might take (big difference between 15 seconds and 10 minutes) |
I sketched this out in a branch and want to know whether the following is reasonable: Here's the pseudocode I think we'd like: if (areSqlTablesOutOfDate) {
resetMulticoreIndexer()
deleteRowsFromSqlite()
}
function migrate(db): boolean {
if (isDatabaseNew(db)) return false
const hashBefore = hashMigrationsTable(db)
migrate(db)
const hashAfter = hashMigrationsTable(db)
return hashBefore !== hashAfter
}
// ...
const areSqlTablesOutOfDate = migrate(db)
if (areSqlTablesOutOfDate) {
// ...
}
Does that seem like a reasonable approach? Again, you can check out an incomplete branch that implements a lot of this. |
Thanks. Thoughts:
|
Just saw the branch - sorry, didn't look at it before writing the comment.
|
Re. the |
Passing the `reindex` option in the constructor will re-initialize the index from scratch. This is motivated by [this issue in `@comapeo/core`][0]. [0]: digidem/comapeo-core#436
Passing the `reindex` option in the constructor will re-initialize the index from scratch. This is motivated by [this issue in `@comapeo/core`][0]. [0]: digidem/comapeo-core#436
Passing the `reindex` option in the constructor will re-initialize the index from scratch. This is motivated by [this issue in `@comapeo/core`][0]. [0]: digidem/comapeo-core#436
Passing the `reindex` option in the constructor will re-initialize the index from scratch. This is motivated by [this issue in `@comapeo/core`][0]. [0]: digidem/comapeo-core#436
Description
The problem
If a device fails to fully decode a block, the missing data will be forever missing from the SQLite index, and therefore the app. I think this can happen if there's a total or partial failure to decode a block.
Total failure to decode
The simplest example: when
IndexWriter
fails to decode a block, it discards it:https://github.com/digidem/mapeo-core-next/blob/75a312d01d0d74ce64640816407a2c5d0a371a2f/src/index-writer/index.js#L71-L78
Imagine that my device is on an older version than yours, and that your device has a data type I've never heard of.
decode()
will throw and the block will be "silently ignore"d.We will never return to this block. This block will sync to my Hypercore but will be permanently missing from my SQLite index, even if I update.
Partial failure to decode
I believe a similar issue can happen when a data type gets a new field. A device will only add fields it understands:
If a new field is added, we'll never go back to insert it.
Possible solutions
I can think of a few solutions:
I think this is worth discussing, but I think option 1 is probably best in the short term. It seems fairly easy to implement, and we can always implement option 2 if performance becomes a concern. But I may be wrong!
Tasks
Assuming we take my preferred approach:
The text was updated successfully, but these errors were encountered: