mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-31 00:05:13 +02:00
dbwrapper: make max_file_size a configurable DBParams field
Useful for fuzzing different values.
This commit is contained in:
@@ -149,7 +149,6 @@ static leveldb::Options GetOptions(size_t nCacheSize)
|
||||
// on corruption in later versions.
|
||||
options.paranoid_checks = true;
|
||||
}
|
||||
options.max_file_size = std::max(options.max_file_size, DBWRAPPER_MAX_FILE_SIZE);
|
||||
SetMaxOpenFiles(&options);
|
||||
return options;
|
||||
}
|
||||
@@ -224,6 +223,7 @@ CDBWrapper::CDBWrapper(const DBParams& params)
|
||||
DBContext().syncoptions.sync = true;
|
||||
DBContext().options = GetOptions(params.cache_bytes);
|
||||
DBContext().options.create_if_missing = true;
|
||||
DBContext().options.max_file_size = params.max_file_size;
|
||||
if (params.memory_only) {
|
||||
DBContext().penv = leveldb::NewMemEnv(leveldb::Env::Default());
|
||||
DBContext().options.env = DBContext().penv;
|
||||
|
||||
@@ -44,6 +44,9 @@ struct DBParams {
|
||||
bool obfuscate = false;
|
||||
//! Passed-through options.
|
||||
DBOptions options{};
|
||||
//! Maximum LevelDB SST file size. Larger values reduce the frequency
|
||||
//! of compactions but increase their duration.
|
||||
size_t max_file_size = DBWRAPPER_MAX_FILE_SIZE;
|
||||
};
|
||||
|
||||
class dbwrapper_error : public std::runtime_error
|
||||
|
||||
Reference in New Issue
Block a user