Remove RocksDb deprecated option maxBackgroundCompactions (#5339)

* Removing RocksDB option MaxBackgroundCompactions deprecated in version 8.0

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>

---------

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
pull/5360/head
Gabriel Fukushima 2 years ago committed by GitHub
parent 0ff62a06b2
commit 9978cb48a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/PrivacyNode.java
  2. 2
      besu/src/test/java/org/hyperledger/besu/PrivacyTest.java
  3. 2
      besu/src/test/java/org/hyperledger/besu/RunnerTest.java
  4. 1
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/bonsai/AbstractIsolationTests.java
  5. 2
      ethereum/eth/src/jmh/java/org/hyperledger/besu/ethereum/eth/sync/worldstate/WorldStateDownloaderBenchmark.java
  6. 19
      plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/configuration/RocksDBCLIOptions.java
  7. 13
      plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/configuration/RocksDBConfiguration.java
  8. 22
      plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/configuration/RocksDBConfigurationBuilder.java
  9. 13
      plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/configuration/RocksDBFactoryConfiguration.java
  10. 2
      plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java
  11. 1
      plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/unsegmented/RocksDBKeyValueStorage.java
  12. 30
      plugins/rocksdb/src/test/java/org/hyperledger/besu/plugin/services/storage/rocksdb/RocksDBCLIOptionsTest.java

@ -18,7 +18,6 @@ import static org.hyperledger.besu.controller.BesuController.DATABASE_PATH;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_BACKGROUND_THREAD_COUNT;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_CACHE_CAPACITY;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_IS_HIGH_SPEC;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_MAX_BACKGROUND_COMPACTIONS;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_MAX_OPEN_FILES;
import org.hyperledger.besu.crypto.KeyPairUtil;
@ -278,7 +277,6 @@ public class PrivacyNode implements AutoCloseable {
() ->
new RocksDBFactoryConfiguration(
DEFAULT_MAX_OPEN_FILES,
DEFAULT_MAX_BACKGROUND_COMPACTIONS,
DEFAULT_BACKGROUND_THREAD_COUNT,
DEFAULT_CACHE_CAPACITY,
DEFAULT_IS_HIGH_SPEC),

@ -20,7 +20,6 @@ import static org.hyperledger.besu.ethereum.core.PrivacyParameters.FLEXIBLE_PRIV
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_BACKGROUND_THREAD_COUNT;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_CACHE_CAPACITY;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_IS_HIGH_SPEC;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_MAX_BACKGROUND_COMPACTIONS;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_MAX_OPEN_FILES;
import org.hyperledger.besu.config.GenesisConfigFile;
@ -134,7 +133,6 @@ public class PrivacyTest {
() ->
new RocksDBFactoryConfiguration(
DEFAULT_MAX_OPEN_FILES,
DEFAULT_MAX_BACKGROUND_COMPACTIONS,
DEFAULT_BACKGROUND_THREAD_COUNT,
DEFAULT_CACHE_CAPACITY,
DEFAULT_IS_HIGH_SPEC),

@ -20,7 +20,6 @@ import static org.hyperledger.besu.cli.config.NetworkName.DEV;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_BACKGROUND_THREAD_COUNT;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_CACHE_CAPACITY;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_IS_HIGH_SPEC;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_MAX_BACKGROUND_COMPACTIONS;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_MAX_OPEN_FILES;
import org.hyperledger.besu.cli.config.EthNetworkConfig;
@ -381,7 +380,6 @@ public final class RunnerTest {
() ->
new RocksDBFactoryConfiguration(
DEFAULT_MAX_OPEN_FILES,
DEFAULT_MAX_BACKGROUND_COMPACTIONS,
DEFAULT_BACKGROUND_THREAD_COUNT,
DEFAULT_CACHE_CAPACITY,
DEFAULT_IS_HIGH_SPEC),

@ -131,7 +131,6 @@ public abstract class AbstractIsolationTests {
() ->
new RocksDBFactoryConfiguration(
1024 /* MAX_OPEN_FILES*/,
4 /*MAX_BACKGROUND_COMPACTIONS*/,
4 /*BACKGROUND_THREAD_COUNT*/,
8388608 /*CACHE_CAPACITY*/,
false),

@ -18,7 +18,6 @@ import static org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_BACKGROUND_THREAD_COUNT;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_CACHE_CAPACITY;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_IS_HIGH_SPEC;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_MAX_BACKGROUND_COMPACTIONS;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_MAX_OPEN_FILES;
import org.hyperledger.besu.datatypes.Hash;
@ -166,7 +165,6 @@ public class WorldStateDownloaderBenchmark {
() ->
new RocksDBFactoryConfiguration(
DEFAULT_MAX_OPEN_FILES,
DEFAULT_MAX_BACKGROUND_COMPACTIONS,
DEFAULT_BACKGROUND_THREAD_COUNT,
DEFAULT_CACHE_CAPACITY,
DEFAULT_IS_HIGH_SPEC),

@ -24,8 +24,7 @@ public class RocksDBCLIOptions {
public static final int DEFAULT_MAX_OPEN_FILES = 1024;
/** The constant DEFAULT_CACHE_CAPACITY. */
public static final long DEFAULT_CACHE_CAPACITY = 134217728;
/** The constant DEFAULT_MAX_BACKGROUND_COMPACTIONS. */
public static final int DEFAULT_MAX_BACKGROUND_COMPACTIONS = 4;
/** The constant DEFAULT_BACKGROUND_THREAD_COUNT. */
public static final int DEFAULT_BACKGROUND_THREAD_COUNT = 4;
/** The constant DEFAULT_IS_HIGH_SPEC. */
@ -35,9 +34,6 @@ public class RocksDBCLIOptions {
public static final String MAX_OPEN_FILES_FLAG = "--Xplugin-rocksdb-max-open-files";
/** The constant CACHE_CAPACITY_FLAG. */
public static final String CACHE_CAPACITY_FLAG = "--Xplugin-rocksdb-cache-capacity";
/** The constant MAX_BACKGROUND_COMPACTIONS_FLAG. */
public static final String MAX_BACKGROUND_COMPACTIONS_FLAG =
"--Xplugin-rocksdb-max-background-compactions";
/** The constant BACKGROUND_THREAD_COUNT_FLAG. */
public static final String BACKGROUND_THREAD_COUNT_FLAG =
"--Xplugin-rocksdb-background-thread-count";
@ -62,15 +58,6 @@ public class RocksDBCLIOptions {
description = "Cache capacity of RocksDB (default: ${DEFAULT-VALUE})")
long cacheCapacity;
/** The Max background compactions. */
@CommandLine.Option(
names = {MAX_BACKGROUND_COMPACTIONS_FLAG},
hidden = true,
defaultValue = "4",
paramLabel = "<INTEGER>",
description = "Maximum number of RocksDB background compactions (default: ${DEFAULT-VALUE})")
int maxBackgroundCompactions;
/** The Background thread count. */
@CommandLine.Option(
names = {BACKGROUND_THREAD_COUNT_FLAG},
@ -110,7 +97,6 @@ public class RocksDBCLIOptions {
final RocksDBCLIOptions options = create();
options.maxOpenFiles = config.getMaxOpenFiles();
options.cacheCapacity = config.getCacheCapacity();
options.maxBackgroundCompactions = config.getMaxBackgroundCompactions();
options.backgroundThreadCount = config.getBackgroundThreadCount();
options.isHighSpec = config.isHighSpec();
return options;
@ -123,7 +109,7 @@ public class RocksDBCLIOptions {
*/
public RocksDBFactoryConfiguration toDomainObject() {
return new RocksDBFactoryConfiguration(
maxOpenFiles, maxBackgroundCompactions, backgroundThreadCount, cacheCapacity, isHighSpec);
maxOpenFiles, backgroundThreadCount, cacheCapacity, isHighSpec);
}
/**
@ -140,7 +126,6 @@ public class RocksDBCLIOptions {
return MoreObjects.toStringHelper(this)
.add("maxOpenFiles", maxOpenFiles)
.add("cacheCapacity", cacheCapacity)
.add("maxBackgroundCompactions", maxBackgroundCompactions)
.add("backgroundThreadCount", backgroundThreadCount)
.add("isHighSpec", isHighSpec)
.toString();

@ -22,7 +22,6 @@ public class RocksDBConfiguration {
private final Path databaseDir;
private final int maxOpenFiles;
private final String label;
private final int maxBackgroundCompactions;
private final int backgroundThreadCount;
private final long cacheCapacity;
private final boolean isHighSpec;
@ -32,7 +31,6 @@ public class RocksDBConfiguration {
*
* @param databaseDir the database dir
* @param maxOpenFiles the max open files
* @param maxBackgroundCompactions the max background compactions
* @param backgroundThreadCount the background thread count
* @param cacheCapacity the cache capacity
* @param label the label
@ -41,12 +39,10 @@ public class RocksDBConfiguration {
public RocksDBConfiguration(
final Path databaseDir,
final int maxOpenFiles,
final int maxBackgroundCompactions,
final int backgroundThreadCount,
final long cacheCapacity,
final String label,
final boolean isHighSpec) {
this.maxBackgroundCompactions = maxBackgroundCompactions;
this.backgroundThreadCount = backgroundThreadCount;
this.databaseDir = databaseDir;
this.maxOpenFiles = maxOpenFiles;
@ -73,15 +69,6 @@ public class RocksDBConfiguration {
return maxOpenFiles;
}
/**
* Gets max background compactions.
*
* @return the max background compactions
*/
public int getMaxBackgroundCompactions() {
return maxBackgroundCompactions;
}
/**
* Gets background thread count.
*

@ -17,7 +17,6 @@ package org.hyperledger.besu.plugin.services.storage.rocksdb.configuration;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_BACKGROUND_THREAD_COUNT;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_CACHE_CAPACITY;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_IS_HIGH_SPEC;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_MAX_BACKGROUND_COMPACTIONS;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_MAX_OPEN_FILES;
import java.nio.file.Path;
@ -29,7 +28,6 @@ public class RocksDBConfigurationBuilder {
private String label = "blockchain";
private int maxOpenFiles = DEFAULT_MAX_OPEN_FILES;
private long cacheCapacity = DEFAULT_CACHE_CAPACITY;
private int maxBackgroundCompactions = DEFAULT_MAX_BACKGROUND_COMPACTIONS;
private int backgroundThreadCount = DEFAULT_BACKGROUND_THREAD_COUNT;
private boolean isHighSpec = DEFAULT_IS_HIGH_SPEC;
@ -77,17 +75,6 @@ public class RocksDBConfigurationBuilder {
return this;
}
/**
* Max background compactions.
*
* @param maxBackgroundCompactions the max background compactions
* @return the rocks db configuration builder
*/
public RocksDBConfigurationBuilder maxBackgroundCompactions(final int maxBackgroundCompactions) {
this.maxBackgroundCompactions = maxBackgroundCompactions;
return this;
}
/**
* Background thread count.
*
@ -120,7 +107,6 @@ public class RocksDBConfigurationBuilder {
return new RocksDBConfigurationBuilder()
.backgroundThreadCount(configuration.getBackgroundThreadCount())
.cacheCapacity(configuration.getCacheCapacity())
.maxBackgroundCompactions(configuration.getMaxBackgroundCompactions())
.maxOpenFiles(configuration.getMaxOpenFiles())
.isHighSpec(configuration.isHighSpec());
}
@ -132,12 +118,6 @@ public class RocksDBConfigurationBuilder {
*/
public RocksDBConfiguration build() {
return new RocksDBConfiguration(
databaseDir,
maxOpenFiles,
maxBackgroundCompactions,
backgroundThreadCount,
cacheCapacity,
label,
isHighSpec);
databaseDir, maxOpenFiles, backgroundThreadCount, cacheCapacity, label, isHighSpec);
}
}

@ -18,7 +18,6 @@ package org.hyperledger.besu.plugin.services.storage.rocksdb.configuration;
public class RocksDBFactoryConfiguration {
private final int maxOpenFiles;
private final int maxBackgroundCompactions;
private final int backgroundThreadCount;
private final long cacheCapacity;
private final boolean isHighSpec;
@ -27,18 +26,15 @@ public class RocksDBFactoryConfiguration {
* Instantiates a new RocksDb factory configuration.
*
* @param maxOpenFiles the max open files
* @param maxBackgroundCompactions the max background compactions
* @param backgroundThreadCount the background thread count
* @param cacheCapacity the cache capacity
* @param isHighSpec the is high spec
*/
public RocksDBFactoryConfiguration(
final int maxOpenFiles,
final int maxBackgroundCompactions,
final int backgroundThreadCount,
final long cacheCapacity,
final boolean isHighSpec) {
this.maxBackgroundCompactions = maxBackgroundCompactions;
this.backgroundThreadCount = backgroundThreadCount;
this.maxOpenFiles = maxOpenFiles;
this.cacheCapacity = cacheCapacity;
@ -54,15 +50,6 @@ public class RocksDBFactoryConfiguration {
return maxOpenFiles;
}
/**
* Gets max background compactions.
*
* @return the max background compactions
*/
public int getMaxBackgroundCompactions() {
return maxBackgroundCompactions;
}
/**
* Gets background thread count.
*

@ -166,7 +166,6 @@ public class RocksDBColumnarKeyValueStorage
.setCreateIfMissing(true)
.setMaxOpenFiles(configuration.getMaxOpenFiles())
.setDbWriteBufferSize(ROCKSDB_MEMTABLE_SIZE_HIGH_SPEC)
.setMaxBackgroundCompactions(configuration.getMaxBackgroundCompactions())
.setStatistics(stats)
.setCreateMissingColumnFamilies(true)
.setEnv(
@ -177,7 +176,6 @@ public class RocksDBColumnarKeyValueStorage
new DBOptions()
.setCreateIfMissing(true)
.setMaxOpenFiles(configuration.getMaxOpenFiles())
.setMaxBackgroundCompactions(configuration.getMaxBackgroundCompactions())
.setStatistics(stats)
.setCreateMissingColumnFamilies(true)
.setEnv(

@ -84,7 +84,6 @@ public class RocksDBKeyValueStorage implements KeyValueStorage {
.setCreateIfMissing(true)
.setMaxOpenFiles(configuration.getMaxOpenFiles())
.setTableFormatConfig(createBlockBasedTableConfig(configuration))
.setMaxBackgroundCompactions(configuration.getMaxBackgroundCompactions())
.setStatistics(stats);
options.getEnv().setBackgroundThreads(configuration.getBackgroundThreadCount());

@ -19,10 +19,8 @@ import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_BACKGROUND_THREAD_COUNT;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_CACHE_CAPACITY;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_IS_HIGH_SPEC;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_MAX_BACKGROUND_COMPACTIONS;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.DEFAULT_MAX_OPEN_FILES;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.IS_HIGH_SPEC;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.MAX_BACKGROUND_COMPACTIONS_FLAG;
import static org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions.MAX_OPEN_FILES_FLAG;
import org.hyperledger.besu.plugin.services.storage.rocksdb.configuration.RocksDBCLIOptions;
@ -43,8 +41,6 @@ public class RocksDBCLIOptionsTest {
assertThat(configuration).isNotNull();
assertThat(configuration.getBackgroundThreadCount()).isEqualTo(DEFAULT_BACKGROUND_THREAD_COUNT);
assertThat(configuration.getCacheCapacity()).isEqualTo(DEFAULT_CACHE_CAPACITY);
assertThat(configuration.getMaxBackgroundCompactions())
.isEqualTo(DEFAULT_MAX_BACKGROUND_COMPACTIONS);
assertThat(configuration.getMaxOpenFiles()).isEqualTo(DEFAULT_MAX_OPEN_FILES);
assertThat(configuration.isHighSpec()).isEqualTo(DEFAULT_IS_HIGH_SPEC);
}
@ -62,8 +58,6 @@ public class RocksDBCLIOptionsTest {
assertThat(configuration).isNotNull();
assertThat(configuration.getBackgroundThreadCount()).isEqualTo(expectedBackgroundThreadCount);
assertThat(configuration.getCacheCapacity()).isEqualTo(DEFAULT_CACHE_CAPACITY);
assertThat(configuration.getMaxBackgroundCompactions())
.isEqualTo(DEFAULT_MAX_BACKGROUND_COMPACTIONS);
assertThat(configuration.getMaxOpenFiles()).isEqualTo(DEFAULT_MAX_OPEN_FILES);
assertThat(configuration.isHighSpec()).isEqualTo(DEFAULT_IS_HIGH_SPEC);
}
@ -79,26 +73,6 @@ public class RocksDBCLIOptionsTest {
assertThat(configuration).isNotNull();
assertThat(configuration.getBackgroundThreadCount()).isEqualTo(DEFAULT_BACKGROUND_THREAD_COUNT);
assertThat(configuration.getCacheCapacity()).isEqualTo(expectedCacheCapacity);
assertThat(configuration.getMaxBackgroundCompactions())
.isEqualTo(DEFAULT_MAX_BACKGROUND_COMPACTIONS);
assertThat(configuration.getMaxOpenFiles()).isEqualTo(DEFAULT_MAX_OPEN_FILES);
assertThat(configuration.isHighSpec()).isEqualTo(DEFAULT_IS_HIGH_SPEC);
}
@Test
public void customMaxBackgroundCompactions() {
final RocksDBCLIOptions options = RocksDBCLIOptions.create();
final int expectedMaxBackgroundCompactions = 223344;
new CommandLine(options)
.parseArgs(MAX_BACKGROUND_COMPACTIONS_FLAG, "" + expectedMaxBackgroundCompactions);
final RocksDBFactoryConfiguration configuration = options.toDomainObject();
assertThat(configuration).isNotNull();
assertThat(configuration.getBackgroundThreadCount()).isEqualTo(DEFAULT_BACKGROUND_THREAD_COUNT);
assertThat(configuration.getCacheCapacity()).isEqualTo(DEFAULT_CACHE_CAPACITY);
assertThat(configuration.getMaxBackgroundCompactions())
.isEqualTo(expectedMaxBackgroundCompactions);
assertThat(configuration.getMaxOpenFiles()).isEqualTo(DEFAULT_MAX_OPEN_FILES);
assertThat(configuration.isHighSpec()).isEqualTo(DEFAULT_IS_HIGH_SPEC);
}
@ -114,8 +88,6 @@ public class RocksDBCLIOptionsTest {
assertThat(configuration).isNotNull();
assertThat(configuration.getBackgroundThreadCount()).isEqualTo(DEFAULT_BACKGROUND_THREAD_COUNT);
assertThat(configuration.getCacheCapacity()).isEqualTo(DEFAULT_CACHE_CAPACITY);
assertThat(configuration.getMaxBackgroundCompactions())
.isEqualTo(DEFAULT_MAX_BACKGROUND_COMPACTIONS);
assertThat(configuration.getMaxOpenFiles()).isEqualTo(expectedMaxOpenFiles);
assertThat(configuration.isHighSpec()).isEqualTo(DEFAULT_IS_HIGH_SPEC);
}
@ -130,8 +102,6 @@ public class RocksDBCLIOptionsTest {
assertThat(configuration).isNotNull();
assertThat(configuration.getBackgroundThreadCount()).isEqualTo(DEFAULT_BACKGROUND_THREAD_COUNT);
assertThat(configuration.getCacheCapacity()).isEqualTo(DEFAULT_CACHE_CAPACITY);
assertThat(configuration.getMaxBackgroundCompactions())
.isEqualTo(DEFAULT_MAX_BACKGROUND_COMPACTIONS);
assertThat(configuration.isHighSpec()).isEqualTo(Boolean.TRUE);
}
}

Loading…
Cancel
Save