summaryrefslogtreecommitdiff
path: root/platform/default
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2016-09-09 10:40:03 -0400
committerJason Wray <jason@mapbox.com>2016-09-14 15:45:47 -0400
commit4daff7f2f856fa0817a6c316997eb1090290c626 (patch)
tree6ef94d330561246a720005eed271821c163dc464 /platform/default
parentffa8c489260865877fcd4ce6a18b76b810b96327 (diff)
downloadqtlocation-mapboxgl-4daff7f2f856fa0817a6c316997eb1090290c626.tar.gz
[core] Revert SQLite WAL journaling
Diffstat (limited to 'platform/default')
-rw-r--r--platform/default/mbgl/storage/offline_database.cpp17
-rw-r--r--platform/default/mbgl/storage/offline_database.hpp1
2 files changed, 13 insertions, 5 deletions
diff --git a/platform/default/mbgl/storage/offline_database.cpp b/platform/default/mbgl/storage/offline_database.cpp
index d93b1734b4..50e2bdfbc4 100644
--- a/platform/default/mbgl/storage/offline_database.cpp
+++ b/platform/default/mbgl/storage/offline_database.cpp
@@ -49,7 +49,8 @@ void OfflineDatabase::ensureSchema() {
case 1: break; // cache-only database; ok to delete
case 2: migrateToVersion3(); // fall through
case 3: migrateToVersion4(); // fall through
- case 4: return;
+ case 4: migrateToVersion5(); // fall through
+ case 5: return;
default: throw std::runtime_error("unknown schema version");
}
@@ -80,10 +81,10 @@ void OfflineDatabase::ensureSchema() {
// If you change the schema you must write a migration from the previous version.
db->exec("PRAGMA auto_vacuum = INCREMENTAL");
- db->exec("PRAGMA synchronous = NORMAL");
- db->exec("PRAGMA journal_mode = WAL");
+ db->exec("PRAGMA journal_mode = DELETE");
+ db->exec("PRAGMA synchronous = FULL");
db->exec(schema);
- db->exec("PRAGMA user_version = 4");
+ db->exec("PRAGMA user_version = 5");
} catch (...) {
Log::Error(Event::Database, "Unexpected error creating database schema: %s", util::toString(std::current_exception()).c_str());
throw;
@@ -115,11 +116,17 @@ void OfflineDatabase::migrateToVersion3() {
}
void OfflineDatabase::migrateToVersion4() {
- db->exec("PRAGMA synchronous = NORMAL");
db->exec("PRAGMA journal_mode = WAL");
+ db->exec("PRAGMA synchronous = NORMAL");
db->exec("PRAGMA user_version = 4");
}
+void OfflineDatabase::migrateToVersion5() {
+ db->exec("PRAGMA journal_mode = DELETE");
+ db->exec("PRAGMA synchronous = FULL");
+ db->exec("PRAGMA user_version = 5");
+}
+
OfflineDatabase::Statement OfflineDatabase::getStatement(const char * sql) {
auto it = statements.find(sql);
diff --git a/platform/default/mbgl/storage/offline_database.hpp b/platform/default/mbgl/storage/offline_database.hpp
index 00394aa720..5e9a190578 100644
--- a/platform/default/mbgl/storage/offline_database.hpp
+++ b/platform/default/mbgl/storage/offline_database.hpp
@@ -61,6 +61,7 @@ private:
void removeExisting();
void migrateToVersion3();
void migrateToVersion4();
+ void migrateToVersion5();
class Statement {
public: