Skip to content

Commit fce9e06

Browse files
committed
Merge bitcoin/bitcoin#28358: Drop -dbcache limit
bb3b980 validation: drop maximum -dbcache (Sjors Provoost) Pull request description: Due to recent UTXO set growth, the current maximum value for `-dbcache` of 16GB is ~just months away from being~ insufficient (for those who wish to complete IBD with the UTXO set held in RAM). This drops the limit. It also adds a warning that it's up to users to check that they have enough RAM. Fixes #28249. --- A previous version of this PR increased the maximum to 64GB. It also made startup abort if the value provided is too high, rather than quietly round it down. But this didn't get much support. ACKs for top commit: achow101: ACK bb3b980 tdb3: ACK bb3b980 BenWestgate: crACK bb3b980. Tree-SHA512: 8515fff468c2387a0b04bd9523ab1df46d6325738588b7550fabddbb8624817a583d95b95ea246407f9f0ff3e43e760cf7334621bec6af79710176328528a3ef
2 parents 8d000b8 + bb3b980 commit fce9e06

File tree

6 files changed

+9
-7
lines changed

6 files changed

+9
-7
lines changed

doc/release-notes-28358.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Updated settings
2+
------
3+
4+
- The maximum allowed value for the `-dbcache` configuration option has been
5+
dropped due to recent UTXO set growth. Note that before this change, large `-dbcache`
6+
values were automatically reduced to 16 GiB (1 GiB on 32 bit systems). (#28358)

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ void SetupServerArgs(ArgsManager& argsman, bool can_listen_ipc)
490490
argsman.AddArg("-conf=<file>", strprintf("Specify path to read-only configuration file. Relative paths will be prefixed by datadir location (only useable from command line, not configuration file) (default: %s)", BITCOIN_CONF_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
491491
argsman.AddArg("-datadir=<dir>", "Specify data directory", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
492492
argsman.AddArg("-dbbatchsize", strprintf("Maximum database write batch size in bytes (default: %u)", nDefaultDbBatchSize), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS);
493-
argsman.AddArg("-dbcache=<n>", strprintf("Maximum database cache size <n> MiB (%d to %d, default: %d). In addition, unused mempool memory is shared for this cache (see -maxmempool).", nMinDbCache, nMaxDbCache, nDefaultDbCache), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
493+
argsman.AddArg("-dbcache=<n>", strprintf("Maximum database cache size <n> MiB (minimum %d, default: %d). Make sure you have enough RAM. In addition, unused memory allocated to the mempool is shared with this cache (see -maxmempool).", nMinDbCache, nDefaultDbCache), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
494494
argsman.AddArg("-includeconf=<file>", "Specify additional configuration file, relative to the -datadir path (only useable from configuration file, not command line)", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
495495
argsman.AddArg("-allowignoredconf", strprintf("For backwards compatibility, treat an unused %s file in the datadir as a warning, not an error.", BITCOIN_CONF_FILENAME), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
496496
argsman.AddArg("-loadblock=<file>", "Imports blocks from external file on startup", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);

src/node/caches.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ CacheSizes CalculateCacheSizes(const ArgsManager& args, size_t n_indexes)
1313
{
1414
int64_t nTotalCache = (args.GetIntArg("-dbcache", nDefaultDbCache) << 20);
1515
nTotalCache = std::max(nTotalCache, nMinDbCache << 20); // total cache cannot be less than nMinDbCache
16-
nTotalCache = std::min(nTotalCache, nMaxDbCache << 20); // total cache cannot be greater than nMaxDbcache
1716
CacheSizes sizes;
1817
sizes.block_tree_db = std::min(nTotalCache / 8, nMaxBlockDBCache << 20);
1918
nTotalCache -= sizes.block_tree_db;

src/qt/forms/optionsdialog.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
<item>
106106
<widget class="QLabel" name="databaseCacheLabel">
107107
<property name="toolTip">
108-
<string extracomment="Tooltip text for Options window setting that sets the size of the database cache. Explains the corresponding effects of increasing/decreasing this value.">Maximum database cache size. A larger cache can contribute to faster sync, after which the benefit is less pronounced for most use cases. Lowering the cache size will reduce memory usage. Unused mempool memory is shared for this cache.</string>
108+
<string extracomment="Tooltip text for Options window setting that sets the size of the database cache. Explains the corresponding effects of increasing/decreasing this value.">Maximum database cache size. Make sure you have enough RAM. A larger cache can contribute to faster sync, after which the benefit is less pronounced for most use cases. Lowering the cache size will reduce memory usage. Unused mempool memory is shared for this cache.</string>
109109
</property>
110110
<property name="text">
111111
<string>Size of &amp;database cache</string>

src/qt/optionsdialog.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ OptionsDialog::OptionsDialog(QWidget* parent, bool enableWallet)
9595
ui->verticalLayout->setStretchFactor(ui->tabWidget, 1);
9696

9797
/* Main elements init */
98-
ui->databaseCache->setMinimum(nMinDbCache);
99-
ui->databaseCache->setMaximum(nMaxDbCache);
98+
ui->databaseCache->setRange(nMinDbCache, std::numeric_limits<int>::max());
10099
ui->threadsScriptVerif->setMinimum(-GetNumCores());
101100
ui->threadsScriptVerif->setMaximum(MAX_SCRIPTCHECK_THREADS);
102101
ui->pruneWarning->setVisible(false);

src/txdb.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ class uint256;
2525
static const int64_t nDefaultDbCache = 450;
2626
//! -dbbatchsize default (bytes)
2727
static const int64_t nDefaultDbBatchSize = 16 << 20;
28-
//! max. -dbcache (MiB)
29-
static const int64_t nMaxDbCache = sizeof(void*) > 4 ? 16384 : 1024;
3028
//! min. -dbcache (MiB)
3129
static const int64_t nMinDbCache = 4;
3230
//! Max memory allocated to block tree DB specific cache, if no -txindex (MiB)

0 commit comments

Comments
 (0)