-
Notifications
You must be signed in to change notification settings - Fork 370
Feature: Allow users to tinker with RocksDB configuration via file; Upgrade RocksDb #1638
Conversation
Splitting up the methods indicated by codacy will in my opinion make it less readable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice,
Just questions and nits
@@ -82,6 +83,7 @@ SpentAddressesProvider provideSpentAddressesProvider() { | |||
PersistenceProvider persistenceProvider = new RocksDBPersistenceProvider( | |||
configuration.getSpentAddressesDbPath(), | |||
configuration.getSpentAddressesDbLogPath(), | |||
configuration.getDbConfigFile(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So mainnet-db and spent-addresses-db uses the same name?
IIUC it is just the name but there are still separate locations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea same config. i dont really think there will be added value of splitting the 2 apart, unless we hire a rocksdb expert who can tinker enough to make a difference. But assuming we will work on a new persistence layer anyways, i doubt it will happen soon :)
|
||
BlockBasedTableConfig blockBasedTableConfig = new BlockBasedTableConfig().setFilter(bloomFilter); | ||
cache = new LRUCache(cacheSize * SizeUnit.KB, 2); | ||
compressedCache = new LRUCache(32 * SizeUnit.KB, 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those changes resulted in performance benefits? Or was it something you had to do due to RocksDb upgrade
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to the update, i did benchmark and unfortunately no notable improvements :(
* | ||
* @param dbPath The location where the database will be stored | ||
* @param logPath The location where the log files will be stored | ||
* @param configFile The location where the RocksDB config is read from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param configFile The location where the RocksDB config is read from | |
* @param configPath The location where the RocksDB config is read from |
InputStream stream = new FileInputStream(config); | ||
try { | ||
configProperties.load(stream); | ||
options = DBOptions.getDBOptionsFromProps(configProperties); | ||
} catch (IllegalArgumentException e) { | ||
log.warn("RocksDB configuration file is empty, falling back to default values"); | ||
} finally { | ||
stream.close(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I always like to use "try with resources" e.g.
try (InputStream stream = new FileInputStream(config))
Just a bit less verbose. What you did works as well, but I'd rather we use the shorter way throughout the project.
Codacy is still complaining but this is due to existing code you copy pasted, so it is fine |
if (!BaseIotaConfig.Defaults.DB_LOG_PATH.equals(logPath) && logPath != null) { | ||
if (!options.dbLogDir().equals("")) { | ||
log.warn("Defined a db log path in config and commandline; Using the command line setting."); | ||
} | ||
|
||
options.setDbLogDir(logPath); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit late, I just noticed this code while merging conflicts...
Why is this here @kwek20 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is here due to the fact we can define the db log on the config file and the logbath on iri.ini/cmdline. In order to warwn the user they defined it twice, we add a log
Description
In order to easily change rocksdb settings, you can now configure it directly though a config file.
Current settings but in a config would look like this:
A full list of options can be found here, but only those inside the DBOptions section will be used: https://github.com/facebook/rocksdb/blob/master/examples/rocksdb_option_file_example.ini
This file CAN be downloaded and used, or one can copy the
OPTIONS-0000XX
file inside the mainnetdb folder, and rename it to the specified configuration file name.Configurable options for enabling this are the following:
DB_CONFIG_FILE
/--db-config-file
: The location of the RocksDB configuration file. By default set torocksdb-config.properties
, which leads to a properties file in the main IRI directory(so not inside mainnet/db folder)Fixes #1630
Fixes #1629
Fixes #1624
Type of change
How Has This Been Tested?
It loads the config
Checklist: