diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2019-04-05 13:56:14 -0400 |
---|---|---|
committer | Henrik Edin <henrik.edin@mongodb.com> | 2019-04-05 16:57:16 -0400 |
commit | a05ef93e5a6c691f4b25800a2f3d94e273ab5b9f (patch) | |
tree | 4d61db51dd0b11184678e39ef20a3b5c52d62d67 /src/mongo | |
parent | b5883226855662d54f990ebb7dcfd952c037a11c (diff) | |
download | mongo-a05ef93e5a6c691f4b25800a2f3d94e273ab5b9f.tar.gz |
SERVER-32709 Correctly pass cache_size to SQLite.
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/storage/mobile/mobile_util.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mongo/db/storage/mobile/mobile_util.cpp b/src/mongo/db/storage/mobile/mobile_util.cpp index 79111401972..8e01f04d111 100644 --- a/src/mongo/db/storage/mobile/mobile_util.cpp +++ b/src/mongo/db/storage/mobile/mobile_util.cpp @@ -187,6 +187,10 @@ void configureSession(sqlite3* session) { SqliteStatement::execQuery(session, "PRAGMA ", pragma, " = ", value, ";"); LOG(MOBILE_LOG_LEVEL_LOW) << "MobileSE session configuration: " << pragma << " = " << value; }; + // We don't manually use VACUUM so set incremental(2) mode to reclaim space + // This need to be set the first thing we do, before any internal tables are created. + executePragma("auto_vacuum"_sd, "incremental"_sd); + // Set SQLite in Write-Ahead Logging mode. https://sqlite.org/wal.html executePragma("journal_mode"_sd, "WAL"_sd); @@ -196,14 +200,14 @@ void configureSession(sqlite3* session) { // Set full fsync on OSX (only supported there) to ensure durability executePragma("fullfsync"_sd, "1"_sd); - // We don't manually use VACUUM so set incremental mode to reclaim space - executePragma("auto_vacuum"_sd, "incremental"_sd); - // We just use SQLite as key-value store, so disable foreign keys executePragma("foreign_keys"_sd, "0"_sd); // Set some additional internal sizes for this session - executePragma("cache_size"_sd, std::to_string(mobileGlobalOptions.mobileCacheSizeKB)); + // Cache size described as KB should be set as negative number + // https://sqlite.org/pragma.html#pragma_cache_size + executePragma("cache_size"_sd, + std::to_string(-static_cast<int32_t>(mobileGlobalOptions.mobileCacheSizeKB))); executePragma("mmap_size"_sd, std::to_string(mobileGlobalOptions.mobileMmapSizeKB * 1024)); executePragma("journal_size_limit"_sd, std::to_string(mobileGlobalOptions.mobileJournalSizeLimitKB * 1024)); |