This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
Use SQLite in-memory temporary table store #6319
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #6193 — a crash on Android with
terminating with uncaught exception of type mapbox::sqlite::Exception: unable to open database file
. That crash was caused by Android’s SQLite trying to write to./someTempFile
, which it did not have permission to do. This was brought about by the change to WAL journaling in #5796.This pull request sets
PRAGMA temp_store = MEMORY
, where previously it was the default (FILE
). Using an in-memory temporary table store avoids the permission issue and fixes the crash. This should not affect the two WAL cache files.Some background:
Why not change where temporary files are written?
Simply changing
PRAGMA temp_store_directory
isn’t a good option: it’s deprecated and there are no guarantees we could set it to a good temp directory. We would also have to limit this to Android, because other platforms do not have this problem (and use different temp dirs).Benefits of
temp_store = MEMORY
Risks
SQLITE_OMIT_INMEMORYDB
, which means SQLite could still try to write temporary files and subsequently crash.To-do
SQLITE_OMIT_INMEMORYDB
is on different plaforms./cc @mapbox/gl