diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2019-06-13 19:20:45 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2019-06-13 19:20:45 +0300 |
commit | 533e83c004a22b82ce74f254b0906223c47c64ea (patch) | |
tree | d788c5e35a8305bba2c9ede4fc318f72b55b0a98 | |
parent | b1b1eb9836bb6ae5a8156c1aea29d57eb9dafad7 (diff) | |
download | qtlocation-mapboxgl-upstream/tmpsantos-clear_cache.tar.gz |
Revert "[core] Fix bug of auto_vacuum not working"upstream/tmpsantos-clear_cache
This reverts commit d6c3febee43aba928b0bc7d9681132c30ce2e744.
-rw-r--r-- | platform/default/src/mbgl/storage/offline_database.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/platform/default/src/mbgl/storage/offline_database.cpp b/platform/default/src/mbgl/storage/offline_database.cpp index 8c16ebf078..b60828d3a7 100644 --- a/platform/default/src/mbgl/storage/offline_database.cpp +++ b/platform/default/src/mbgl/storage/offline_database.cpp @@ -129,6 +129,7 @@ void OfflineDatabase::removeOldCacheTable() { void OfflineDatabase::createSchema() { assert(db); + db->exec("PRAGMA auto_vacuum = INCREMENTAL"); db->exec("PRAGMA journal_mode = DELETE"); db->exec("PRAGMA synchronous = FULL"); mapbox::sqlite::Transaction transaction(*db); @@ -139,6 +140,7 @@ void OfflineDatabase::createSchema() { void OfflineDatabase::migrateToVersion3() { assert(db); + db->exec("PRAGMA auto_vacuum = INCREMENTAL"); db->exec("VACUUM"); db->exec("PRAGMA user_version = 3"); } @@ -634,7 +636,7 @@ std::exception_ptr OfflineDatabase::clearTileCache() try { query.run(); - db->exec("VACUUM"); + db->exec("PRAGMA incremental_vacuum"); return nullptr; } catch (const mapbox::sqlite::Exception& ex) { @@ -809,7 +811,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 = {}; @@ -1068,11 +1070,11 @@ T OfflineDatabase::getPragma(const char* sql) { // less than the maximum cache size. Returns false if this condition cannot be // satisfied. // -// SQLite database never shrinks in size unless we call VACUUM. We here +// SQLite database never shrinks in size unless we call VACCUM. We here // are monitoring the soft limit (i.e. number of free pages in the file) // and as it approaches to the hard limit (i.e. the actual file size) we // delete an arbitrary number of old cache entries. The free pages approach saves -// us from calling VACUUM or keeping a running total, which can be costly. +// us from calling VACCUM or keeping a running total, which can be costly. bool OfflineDatabase::evict(uint64_t neededFreeSize) { uint64_t pageSize = getPragma<int64_t>("PRAGMA page_size"); uint64_t pageCount = getPragma<int64_t>("PRAGMA page_count"); |