diff --git a/src/node/caches.cpp b/src/node/caches.cpp index c25b3e9a9a7..6eb2c0a3534 100644 --- a/src/node/caches.cpp +++ b/src/node/caches.cpp @@ -41,7 +41,7 @@ uint64_t GetDefaultDBCache() return HIGH_DEFAULT_DBCACHE; } } - return DEFAULT_DB_CACHE; + return DEFAULT_KERNEL_CACHE; } uint64_t CalculateDbCacheBytes(const ArgsManager& args) diff --git a/src/node/caches.h b/src/node/caches.h index 756dfa37874..14056a2516f 100644 --- a/src/node/caches.h +++ b/src/node/caches.h @@ -14,8 +14,6 @@ class ArgsManager; -//! -dbcache default (bytes) -static constexpr uint64_t DEFAULT_DB_CACHE{DEFAULT_KERNEL_CACHE}; //! Reserved non-dbcache memory usage. static constexpr uint64_t DBCACHE_WARNING_RESERVED_RAM{2_GiB}; @@ -34,7 +32,7 @@ CacheSizes CalculateCacheSizes(const ArgsManager& args, size_t n_indexes = 0); constexpr bool ShouldWarnOversizedDbCache(uint64_t dbcache, uint64_t total_ram) noexcept { const uint64_t available_ram{total_ram > DBCACHE_WARNING_RESERVED_RAM ? total_ram - DBCACHE_WARNING_RESERVED_RAM : 0}; - const uint64_t cap{std::max(DEFAULT_DB_CACHE, (available_ram / 4) * 3)}; + const uint64_t cap{std::max(DEFAULT_KERNEL_CACHE, (available_ram / 4) * 3)}; return dbcache > cap; } diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index 49e3c4b8610..9f540c87e26 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -732,7 +732,7 @@ void OptionsModel::checkAndMigrate() // see https://github.com/bitcoin/bitcoin/pull/8273 // force people to upgrade to the new value if they are using 100MB if (settingsVersion < 130000 && settings.contains("nDatabaseCache") && settings.value("nDatabaseCache").toLongLong() == 100) - settings.setValue("nDatabaseCache", qint64(DEFAULT_DB_CACHE / 1_MiB)); + settings.setValue("nDatabaseCache", qint64(DEFAULT_KERNEL_CACHE / 1_MiB)); settings.setValue(strSettingsVersionKey, CLIENT_VERSION); } diff --git a/src/test/caches_tests.cpp b/src/test/caches_tests.cpp index 15820a79746..1291eb33008 100644 --- a/src/test/caches_tests.cpp +++ b/src/test/caches_tests.cpp @@ -27,8 +27,8 @@ BOOST_AUTO_TEST_CASE(oversized_dbcache_warning) BOOST_CHECK(!ShouldWarnOversizedDbCache(MIN_DBCACHE_BYTES, 1_GiB)); // Below DBCACHE_WARNING_RESERVED_RAM the existing fixed default dominates. - CheckDbCacheWarnThreshold(DEFAULT_DB_CACHE, 1_GiB); - CheckDbCacheWarnThreshold(DEFAULT_DB_CACHE, DBCACHE_WARNING_RESERVED_RAM); + CheckDbCacheWarnThreshold(DEFAULT_KERNEL_CACHE, 1_GiB); + CheckDbCacheWarnThreshold(DEFAULT_KERNEL_CACHE, DBCACHE_WARNING_RESERVED_RAM); // Above DBCACHE_WARNING_RESERVED_RAM the warning fires at 75% of the headroom. CheckDbCacheWarnThreshold(((3_GiB - DBCACHE_WARNING_RESERVED_RAM) / 4) * 3, 3_GiB);