mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-08-04 05:54:48 +02:00
Merge branch 'dbfilesize_param' into dbfilesize_128
This commit is contained in:
commit
11d641b364
@ -227,6 +227,7 @@ CDBWrapper::CDBWrapper(const DBParams& params)
|
||||
DBContext().iteroptions.fill_cache = false;
|
||||
DBContext().syncoptions.sync = true;
|
||||
DBContext().options = GetOptions(params.cache_bytes);
|
||||
DBContext().options.max_file_size = params.options.max_file_size;
|
||||
DBContext().options.create_if_missing = true;
|
||||
if (params.memory_only) {
|
||||
DBContext().penv = leveldb::NewMemEnv(leveldb::Env::Default());
|
||||
|
@ -23,10 +23,14 @@
|
||||
static const size_t DBWRAPPER_PREALLOC_KEY_SIZE = 64;
|
||||
static const size_t DBWRAPPER_PREALLOC_VALUE_SIZE = 1024;
|
||||
|
||||
static constexpr size_t DEFAULT_DB_FILE_SIZE{2};
|
||||
|
||||
//! User-controlled performance and debug options.
|
||||
struct DBOptions {
|
||||
//! Compact database on startup.
|
||||
bool force_compact = false;
|
||||
//! Target size of files.
|
||||
size_t max_file_size{DEFAULT_DB_FILE_SIZE << 20};
|
||||
};
|
||||
|
||||
//! Application-specific storage settings.
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <common/args.h>
|
||||
#include <common/system.h>
|
||||
#include <consensus/amount.h>
|
||||
#include <dbwrapper.h>
|
||||
#include <deploymentstatus.h>
|
||||
#include <hash.h>
|
||||
#include <httprpc.h>
|
||||
@ -448,6 +449,11 @@ void SetupServerArgs(ArgsManager& argsman)
|
||||
argsman.AddArg("-datadir=<dir>", "Specify data directory", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
||||
argsman.AddArg("-dbbatchsize", strprintf("Maximum database write batch size in bytes (default: %u)", nDefaultDbBatchSize), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS);
|
||||
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);
|
||||
argsman.AddArg("-dbfilesize",
|
||||
strprintf("Target size of files within databases, in MiB (%u to %u, default: %u).",
|
||||
1, 1024,
|
||||
DEFAULT_DB_FILE_SIZE),
|
||||
ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS);
|
||||
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);
|
||||
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);
|
||||
argsman.AddArg("-loadblock=<file>", "Imports blocks from external file on startup", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
|
||||
|
@ -14,5 +14,6 @@ void ReadDatabaseArgs(const ArgsManager& args, DBOptions& options)
|
||||
// databases), but it'd be easy to parse database-specific options by adding
|
||||
// a database_type string or enum parameter to this function.
|
||||
if (auto value = args.GetBoolArg("-forcecompactdb")) options.force_compact = *value;
|
||||
if (auto value = args.GetIntArg("-dbfilesize")) options.max_file_size = (*value) << 20;
|
||||
}
|
||||
} // namespace node
|
||||
|
Loading…
Reference in New Issue
Block a user