mirror of
https://github.com/vacp2p/linea-besu.git
synced 2026-01-08 20:47:59 -05:00
Fix the number of RocksDB log files to the last one week (#5428)
* Fix the number of RocksDB log files to 5 with 100 MB size for each LOG file Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Fix build issue Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * spotless and add a changelog entry Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * keep 1 week log files Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Update change log and fix the number of files Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> --------- Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> Signed-off-by: ahamlat <ameziane.hamlat@consensys.net> Co-authored-by: Fabio Di Fabio <fabio.difabio@consensys.net>
This commit is contained in:
@@ -78,6 +78,10 @@ public abstract class RocksDBColumnarKeyValueStorage
|
||||
protected static final long ROCKSDB_BLOCKCACHE_SIZE_HIGH_SPEC = 1_073_741_824L;
|
||||
/** RocksDb memtable size when using the high spec option */
|
||||
protected static final long ROCKSDB_MEMTABLE_SIZE_HIGH_SPEC = 1_073_741_824L;
|
||||
/** RocksDb number of log files to keep on disk */
|
||||
private static final long NUMBER_OF_LOG_FILES_TO_KEEP = 7;
|
||||
/** RocksDb Time to roll a log file (1 day = 3600 * 24 seconds) */
|
||||
private static final long TIME_TO_ROLL_LOG_FILE = 86_400L;
|
||||
|
||||
static {
|
||||
RocksDbUtil.loadNativeLibrary();
|
||||
@@ -165,28 +169,7 @@ public abstract class RocksDBColumnarKeyValueStorage
|
||||
.setCompressionType(CompressionType.LZ4_COMPRESSION)
|
||||
.setTableFormatConfig(createBlockBasedTableConfig(configuration))));
|
||||
|
||||
if (configuration.isHighSpec()) {
|
||||
options =
|
||||
new DBOptions()
|
||||
.setCreateIfMissing(true)
|
||||
.setMaxOpenFiles(configuration.getMaxOpenFiles())
|
||||
.setDbWriteBufferSize(ROCKSDB_MEMTABLE_SIZE_HIGH_SPEC)
|
||||
.setStatistics(stats)
|
||||
.setCreateMissingColumnFamilies(true)
|
||||
.setEnv(
|
||||
Env.getDefault()
|
||||
.setBackgroundThreads(configuration.getBackgroundThreadCount()));
|
||||
} else {
|
||||
options =
|
||||
new DBOptions()
|
||||
.setCreateIfMissing(true)
|
||||
.setMaxOpenFiles(configuration.getMaxOpenFiles())
|
||||
.setStatistics(stats)
|
||||
.setCreateMissingColumnFamilies(true)
|
||||
.setEnv(
|
||||
Env.getDefault()
|
||||
.setBackgroundThreads(configuration.getBackgroundThreadCount()));
|
||||
}
|
||||
setGlobalOptions(configuration, stats);
|
||||
|
||||
txOptions = new TransactionDBOptions();
|
||||
columnHandles = new ArrayList<>(columnDescriptors.size());
|
||||
@@ -195,6 +178,22 @@ public abstract class RocksDBColumnarKeyValueStorage
|
||||
}
|
||||
}
|
||||
|
||||
private void setGlobalOptions(final RocksDBConfiguration configuration, final Statistics stats) {
|
||||
options = new DBOptions();
|
||||
options
|
||||
.setCreateIfMissing(true)
|
||||
.setMaxOpenFiles(configuration.getMaxOpenFiles())
|
||||
.setStatistics(stats)
|
||||
.setCreateMissingColumnFamilies(true)
|
||||
.setLogFileTimeToRoll(TIME_TO_ROLL_LOG_FILE)
|
||||
.setKeepLogFileNum(NUMBER_OF_LOG_FILES_TO_KEEP)
|
||||
.setEnv(Env.getDefault().setBackgroundThreads(configuration.getBackgroundThreadCount()));
|
||||
|
||||
if (configuration.isHighSpec()) {
|
||||
options.setDbWriteBufferSize(ROCKSDB_MEMTABLE_SIZE_HIGH_SPEC);
|
||||
}
|
||||
}
|
||||
|
||||
void initMetrics() {
|
||||
metrics = rocksDBMetricsFactory.create(metricsSystem, configuration, getDB(), stats);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user