From 7e944b99050a24d6f070ad09ca09336e37ae6851 Mon Sep 17 00:00:00 2001 From: "Ameziane H." Date: Tue, 17 Dec 2024 14:28:02 +0100 Subject: [PATCH] spotless Signed-off-by: Ameziane H. --- .../RocksDBColumnarKeyValueStorage.java | 56 ++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java b/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java index a91342a674e..6142d76716b 100644 --- a/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java +++ b/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java @@ -163,13 +163,14 @@ public RocksDBColumnarKeyValueStorage( .forEach(trimmedSegments::remove); columnDescriptors = trimmedSegments.stream() - .map(segment -> { - try { + .map( + segment -> { + try { return createColumnDescriptor(segment, configuration); - } catch (RocksDBException e) { + } catch (RocksDBException e) { throw new RuntimeException(e); - } - }) + } + }) .collect(Collectors.toList()); setGlobalOptions(configuration, stats); @@ -190,41 +191,46 @@ public RocksDBColumnarKeyValueStorage( * @return a column family descriptor */ private ColumnFamilyDescriptor createColumnDescriptor( - final SegmentIdentifier segment, final RocksDBConfiguration configuration) throws RocksDBException { + final SegmentIdentifier segment, final RocksDBConfiguration configuration) + throws RocksDBException { ConfigOptions configOptions = new ConfigOptions(); DBOptions dbOptions = new DBOptions(); List cfDescriptors = new ArrayList<>(); - String latestOptionsFileName = OptionsUtil.getLatestOptionsFileName(configuration.getDatabaseDir().toString(), Env.getDefault()); - LOG.trace("Latest OPTIONS file detected: " + latestOptionsFileName); + String latestOptionsFileName = + OptionsUtil.getLatestOptionsFileName( + configuration.getDatabaseDir().toString(), Env.getDefault()); + LOG.trace("Latest OPTIONS file detected: " + latestOptionsFileName); - String optionsFilePath = configuration.getDatabaseDir().toString() + "/" + latestOptionsFileName; - OptionsUtil.loadOptionsFromFile(configOptions, optionsFilePath, dbOptions, cfDescriptors); + String optionsFilePath = + configuration.getDatabaseDir().toString() + "/" + latestOptionsFileName; + OptionsUtil.loadOptionsFromFile(configOptions, optionsFilePath, dbOptions, cfDescriptors); - LOG.trace("RocksDB options loaded successfully from: " + optionsFilePath); + LOG.trace("RocksDB options loaded successfully from: " + optionsFilePath); - boolean dynamicLevelBytes = true; - if (!cfDescriptors.isEmpty()) { - Optional matchedCfOptions = Optional.empty(); - for (ColumnFamilyDescriptor descriptor : cfDescriptors) { - if (Arrays.equals(descriptor.getName(), segment.getId())) { - matchedCfOptions = Optional.of(descriptor.getOptions()); - break; - } + boolean dynamicLevelBytes = true; + if (!cfDescriptors.isEmpty()) { + Optional matchedCfOptions = Optional.empty(); + for (ColumnFamilyDescriptor descriptor : cfDescriptors) { + if (Arrays.equals(descriptor.getName(), segment.getId())) { + matchedCfOptions = Optional.of(descriptor.getOptions()); + break; } - if (matchedCfOptions.isPresent()) { - dynamicLevelBytes = matchedCfOptions.get().levelCompactionDynamicLevelBytes(); - LOG.trace("dynamicLevelBytes is set to an existing value : " + dynamicLevelBytes); - } } - BlockBasedTableConfig basedTableConfig = createBlockBasedTableConfig(segment, configuration); + if (matchedCfOptions.isPresent()) { + dynamicLevelBytes = matchedCfOptions.get().levelCompactionDynamicLevelBytes(); + LOG.trace("dynamicLevelBytes is set to an existing value : " + dynamicLevelBytes); + } + } + BlockBasedTableConfig basedTableConfig = createBlockBasedTableConfig(segment, configuration); final var options = new ColumnFamilyOptions() .setTtl(0) .setCompressionType(CompressionType.LZ4_COMPRESSION) - .setTableFormatConfig(basedTableConfig).setLevelCompactionDynamicLevelBytes(dynamicLevelBytes); + .setTableFormatConfig(basedTableConfig) + .setLevelCompactionDynamicLevelBytes(dynamicLevelBytes); if (segment.containsStaticData()) { options .setEnableBlobFiles(true)