-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it has an inadvertent bump of the platform/ios/vendor/mapbox-events-ios
submodule.
Please also add an iOS changelog entry. 🙇
0fecaed
to
cd3880e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to think about what the behavior should be when an offline download encounters a database error. For instance, if the disk is full, it looks like the current behavior may be indistinguishable from a successful download.
} catch (...) { | ||
if (auto download = getDownload(regionID)) { | ||
callback({}, download->getStatus()); | ||
} else { | ||
callback(std::current_exception(), {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::current_exception()
will always return an empty result here, since it's no longer inside a catch block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still pending; it should synthesize an exception. Also, listRegions
, createRegion
, and updateMetadata
above and deleteRegion
below need a similar change.
@@ -13,7 +13,12 @@ namespace mbgl { | |||
OfflineDatabase::OfflineDatabase(std::string path_, uint64_t maximumCacheSize_) | |||
: path(std::move(path_)), | |||
maximumCacheSize(maximumCacheSize_) { | |||
ensureSchema(); | |||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: whitespace.
void migrateToVersion5(); | ||
void migrateToVersion6(); | ||
void migrateToVersion3(); | ||
void migrateToVersion6(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace.
OfflineRegionDefinition definition { "", LatLngBounds::hull({1, 2}, {3, 4}), 5, 6, 1.0 }; | ||
OfflineRegionMetadata metadata; | ||
return db.createRegion(definition, metadata); | ||
return db.createRegion(definition, metadata); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace.
Fixes #10031 |
528dd63
to
e1b23db
Compare
The current behavior is to crash if the disk is full (or any IO error occurs). When a network error occurs, the offline download never completes. This PR changes the crash when the disk is full to an offline download that never completes, which, while not ideal, is arguably better than the previous behavior. I think erroneous downloads is something worth fixing, but I'd like to do that in a followup PR to avoid delaying the important crash fixes in this PR even longer. Overall, I think we need a concept for what an offline download should do in the error case: Retry a few times? Record failures and add them to the status? How are sparse tilesets handled (they return 404s on purpose, which means such a download will never complete atm)? What happens when you go offline mid-download, or try to do a download over a spotty connection? |
Considering the call sequence If However, there will be at least one resource that does not trigger an increment of
If it's a permanent error, that's true. But transient errors will get retried, since
404s get turned into "no content" non-errors by the file source. We might need to take this into account if we change that behavior though. |
02564b6
to
03a4dc2
Compare
I fixed the test issues when using the VFS by porting the creation/deletion routines for |
@kkaefer took this PR for a testrun and it's looking great! Testrun
I'm seeing is that the |
5fa7f67
to
0c90386
Compare
I think the expected behavior is that a fresh application start isn't required, so this may need more investigation. |
Implemented database recreating when it is deleted in |
0933103
to
e783076
Compare
This is now ready for review 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Having an expected
polyfill will definitely be useful.
This changes
OfflineDatabase
to be more resilient. The design is to catch SQLite exceptions on the body of all public functions, and return with a failure code if the query failed.Also adds tests for corrupt databases, as well as support for operating without read or write access to the file system. Also handles disk full error (in those cases, the database remains readable, but any updates, such as timestamp updates or resource insertions) will fail.