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 ce9b13a0377..5ef091c9c3a 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 @@ -16,9 +16,6 @@ import static java.util.stream.Collectors.toUnmodifiableSet; -import com.google.common.base.Splitter; -import com.google.common.collect.Streams; -import org.apache.tuweni.bytes.Bytes; import org.hyperledger.besu.plugin.services.MetricsSystem; import org.hyperledger.besu.plugin.services.exception.StorageException; import org.hyperledger.besu.plugin.services.metrics.OperationTimer; @@ -34,7 +31,6 @@ import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Optional; @@ -44,7 +40,10 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import com.google.common.base.Splitter; +import com.google.common.collect.Streams; import org.apache.commons.lang3.tuple.Pair; +import org.apache.tuweni.bytes.Bytes; import org.rocksdb.BlockBasedTableConfig; import org.rocksdb.BloomFilter; import org.rocksdb.ColumnFamilyDescriptor; @@ -165,18 +164,14 @@ public RocksDBColumnarKeyValueStorage( txOptions = new TransactionDBOptions(); columnHandles = new ArrayList<>(columnDescriptors.size()); } catch (RocksDBException e) { - List knownSegments = Streams.concat( - defaultSegments.stream(), - ignorableSegments.stream()) - .distinct() - .toList(); + List knownSegments = + Streams.concat(defaultSegments.stream(), ignorableSegments.stream()).distinct().toList(); throw parseRocksDBException(e, knownSegments); } } private static StorageException parseRocksDBException( - final RocksDBException ex, - final List knownSegments) { + final RocksDBException ex, final List knownSegments) { String message = ex.getMessage(); // parse out unprintable segment names for a more useful exception: @@ -185,20 +180,23 @@ private static StorageException parseRocksDBException( String substring = message.substring(message.indexOf(": ") + 2); List unHandledSegments = new ArrayList<>(); - Splitter.on(", ").splitToStream(substring) - .forEach(part -> { - byte[] bytes = part.getBytes(StandardCharsets.UTF_8); - unHandledSegments.add( - knownSegments.stream().filter(seg -> Arrays.equals(seg.getId(), bytes)) - .findFirst() - .map(SegmentIdentifier::getName) - .orElse("unknown segment:{" + Bytes.of(bytes).toHexString() + "}")); - - }); + Splitter.on(", ") + .splitToStream(substring) + .forEach( + part -> { + byte[] bytes = part.getBytes(StandardCharsets.UTF_8); + unHandledSegments.add( + knownSegments.stream() + .filter(seg -> Arrays.equals(seg.getId(), bytes)) + .findFirst() + .map(SegmentIdentifier::getName) + .orElse("unknown segment:{" + Bytes.of(bytes).toHexString() + "}")); + }); return new StorageException( - "RocksDBException: Unhandled column families: [" + - unHandledSegments.stream().collect(Collectors.joining(", ")) + "]"); + "RocksDBException: Unhandled column families: [" + + unHandledSegments.stream().collect(Collectors.joining(", ")) + + "]"); } else { return new StorageException(ex); }