Store trielog as blobdb (#6289)

Store trielog as blobdb to improve performance. 

* Store trie_log_storage as blob
* changelog
* Add gc flag for static data
* Updating plugin-api build.gradle with new hash as SegmentIdentifier interface has introduced new method

Signed-off-by: Usman Saleem <usman@usmans.info>
pull/6508/head
Usman Saleem 10 months ago committed by GitHub
parent 4252e47cf7
commit c10cb3d3a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 24
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/storage/keyvalue/KeyValueSegmentIdentifier.java
  3. 2
      plugin-api/build.gradle
  4. 10
      plugin-api/src/main/java/org/hyperledger/besu/plugin/services/storage/SegmentIdentifier.java
  5. 2
      plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java

@ -21,6 +21,7 @@
- Introduce `besu storage x-trie-log prune` experimental offline subcommand which will prune all redundant trie logs except the latest 512 [#6303](https://github.com/hyperledger/besu/pull/6303)
- Introduce caching mechanism to optimize Keccak hash calculations for account storage slots during block processing [#6452](https://github.com/hyperledger/besu/pull/6452)
- Added configuration options for `pragueTime` to genesis file for Prague fork development [#6473](https://github.com/hyperledger/besu/pull/6473)
- Moving trielog storage to RocksDB's blobdb to improve write amplications [#6289](https://github.com/hyperledger/besu/pull/6289)
### Bug fixes
- Fix the way an advertised host configured with `--p2p-host` is treated when communicating with the originator of a PING packet [#6225](https://github.com/hyperledger/besu/pull/6225)

@ -23,15 +23,15 @@ import org.bouncycastle.util.Arrays;
public enum KeyValueSegmentIdentifier implements SegmentIdentifier {
DEFAULT("default".getBytes(StandardCharsets.UTF_8)),
BLOCKCHAIN(new byte[] {1}, true, true),
WORLD_STATE(new byte[] {2}, new int[] {0, 1}, false, true),
WORLD_STATE(new byte[] {2}, new int[] {0, 1}, false, true, false),
PRIVATE_TRANSACTIONS(new byte[] {3}),
PRIVATE_STATE(new byte[] {4}),
PRUNING_STATE(new byte[] {5}, new int[] {0, 1}),
ACCOUNT_INFO_STATE(new byte[] {6}, new int[] {2}, false, true),
ACCOUNT_INFO_STATE(new byte[] {6}, new int[] {2}, false, true, false),
CODE_STORAGE(new byte[] {7}, new int[] {2}),
ACCOUNT_STORAGE_STORAGE(new byte[] {8}, new int[] {2}, false, true),
TRIE_BRANCH_STORAGE(new byte[] {9}, new int[] {2}, false, true),
TRIE_LOG_STORAGE(new byte[] {10}, new int[] {2}),
ACCOUNT_STORAGE_STORAGE(new byte[] {8}, new int[] {2}, false, true, false),
TRIE_BRANCH_STORAGE(new byte[] {9}, new int[] {2}, false, true, false),
TRIE_LOG_STORAGE(new byte[] {10}, new int[] {2}, true, false, true),
VARIABLES(new byte[] {11}), // formerly GOQUORUM_PRIVATE_WORLD_STATE
// previously supported GoQuorum private states
@ -49,6 +49,7 @@ public enum KeyValueSegmentIdentifier implements SegmentIdentifier {
private final int[] versionList;
private final boolean containsStaticData;
private final boolean eligibleToHighSpecFlag;
private final boolean staticDataGarbageCollectionEnabled;
KeyValueSegmentIdentifier(final byte[] id) {
this(id, new int[] {0, 1, 2});
@ -56,22 +57,24 @@ public enum KeyValueSegmentIdentifier implements SegmentIdentifier {
KeyValueSegmentIdentifier(
final byte[] id, final boolean containsStaticData, final boolean eligibleToHighSpecFlag) {
this(id, new int[] {0, 1, 2}, containsStaticData, eligibleToHighSpecFlag);
this(id, new int[] {0, 1, 2}, containsStaticData, eligibleToHighSpecFlag, false);
}
KeyValueSegmentIdentifier(final byte[] id, final int[] versionList) {
this(id, versionList, false, false);
this(id, versionList, false, false, false);
}
KeyValueSegmentIdentifier(
final byte[] id,
final int[] versionList,
final boolean containsStaticData,
final boolean eligibleToHighSpecFlag) {
final boolean eligibleToHighSpecFlag,
final boolean staticDataGarbageCollectionEnabled) {
this.id = id;
this.versionList = versionList;
this.containsStaticData = containsStaticData;
this.eligibleToHighSpecFlag = eligibleToHighSpecFlag;
this.staticDataGarbageCollectionEnabled = staticDataGarbageCollectionEnabled;
}
@Override
@ -94,6 +97,11 @@ public enum KeyValueSegmentIdentifier implements SegmentIdentifier {
return eligibleToHighSpecFlag;
}
@Override
public boolean isStaticDataGarbageCollectionEnabled() {
return staticDataGarbageCollectionEnabled;
}
@Override
public boolean includeInDatabaseVersion(final int version) {
return Arrays.contains(versionList, version);

@ -69,7 +69,7 @@ Calculated : ${currentHash}
tasks.register('checkAPIChanges', FileStateChecker) {
description = "Checks that the API for the Plugin-API project does not change without deliberate thought"
files = sourceSets.main.allJava.files
knownHash = 'VpNy2KuAtEUc9hPguNivbjwy2YM3vIF444RCREJojqY='
knownHash = '3+WNtdl1idY70N/MwVBbopU2ZWyWiu12YV1qaYXprZ8='
}
check.dependsOn('checkAPIChanges')

@ -64,4 +64,14 @@ public interface SegmentIdentifier {
* @return true if the segment is involved with the high spec flag
*/
boolean isEligibleToHighSpecFlag();
/**
* Enable garbage collection for static data. This should be enabled for static data which can be
* deleted or pruned.
*
* @return true if enabled, false otherwise.
*/
default boolean isStaticDataGarbageCollectionEnabled() {
return false;
}
}

@ -188,7 +188,7 @@ public abstract class RocksDBColumnarKeyValueStorage implements SegmentedKeyValu
if (segment.containsStaticData()) {
options
.setEnableBlobFiles(true)
.setEnableBlobGarbageCollection(false)
.setEnableBlobGarbageCollection(segment.isStaticDataGarbageCollectionEnabled())
.setMinBlobSize(100)
.setBlobCompressionType(CompressionType.LZ4_COMPRESSION);
}

Loading…
Cancel
Save