diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-10-21 18:15:50 +0300 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-10-21 18:15:50 +0300 |
commit | 4b76925f3c033c9ea17b7cca55976be51f0a53df (patch) | |
tree | ac046329598319956a9b71d8134b0170808b78c8 | |
parent | bb0e5ffb2ceea28d386a9ac317ab9e1e81d83b07 (diff) | |
download | qtlocation-mapboxgl-4b76925f3c033c9ea17b7cca55976be51f0a53df.tar.gz |
[core] Enable incremental vacuum for Offline DB
Thus we avoid re-creating the whole database and keeping the backup file as it happens on calling VACUUM.
-rw-r--r-- | platform/default/src/mbgl/storage/offline_database.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/platform/default/src/mbgl/storage/offline_database.cpp b/platform/default/src/mbgl/storage/offline_database.cpp index 133e1f7992..e27ccbf313 100644 --- a/platform/default/src/mbgl/storage/offline_database.cpp +++ b/platform/default/src/mbgl/storage/offline_database.cpp @@ -145,6 +145,8 @@ void OfflineDatabase::removeOldCacheTable() { void OfflineDatabase::createSchema() { assert(db); + db->exec("PRAGMA auto_vacuum = INCREMENTAL"); + db->exec("VACUUM"); db->exec("PRAGMA journal_mode = DELETE"); db->exec("PRAGMA synchronous = FULL"); mapbox::sqlite::Transaction transaction(*db); @@ -155,6 +157,7 @@ void OfflineDatabase::createSchema() { void OfflineDatabase::migrateToVersion3() { assert(db); + db->exec("PRAGMA auto_vacuum = INCREMENTAL"); db->exec("VACUUM"); db->exec("PRAGMA user_version = 3"); } @@ -683,7 +686,7 @@ std::exception_ptr OfflineDatabase::clearAmbientCache() try { resourceQuery.run(); - db->exec("VACUUM"); + db->exec("PRAGMA incremental_vacuum"); return nullptr; } catch (const mapbox::sqlite::Exception& ex) { @@ -871,7 +874,7 @@ std::exception_ptr OfflineDatabase::deleteRegion(OfflineRegion&& region) try { evict(0); assert(db); - db->exec("VACUUM"); + db->exec("PRAGMA incremental_vacuum"); // Ensure that the cached offlineTileCount value is recalculated. offlineMapboxTileCount = {}; |