From 5caba7a16791a855aeec4a6b8627ea1185b80693 Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Tue, 2 Jul 2024 03:57:25 +1000 Subject: [PATCH] Add rocksdb and trie-log subcommands to storage command (#1642) * Add rocksdb and trie-log subcommands to storage command Signed-off-by: Simon Dudley * copy edits Signed-off-by: joan e * Slight reword Signed-off-by: joan e * update Signed-off-by: joan e --------- Signed-off-by: joan e Co-authored-by: Joan E <153745173+joaniefromtheblock@users.noreply.github.com> Co-authored-by: joan e --- .../reference/cli/subcommands.md | 129 +++++++++++++++++- 1 file changed, 126 insertions(+), 3 deletions(-) diff --git a/docs/public-networks/reference/cli/subcommands.md b/docs/public-networks/reference/cli/subcommands.md index 36ef4faac69..e0c898f1ab6 100644 --- a/docs/public-networks/reference/cli/subcommands.md +++ b/docs/public-networks/reference/cli/subcommands.md @@ -306,7 +306,7 @@ If you need to downgrade Besu, run this subcommand before installing the previou ```bash -besu storage revert-variables --config-file +besu --config-file storage revert-variables ``` @@ -314,7 +314,7 @@ besu storage revert-variables --config-file ```bash -besu storage revert-variables --config-file ../besu-local-nodes/config/besu/besu1.conf +besu --config-file config.toml storage revert-variables ``` @@ -326,6 +326,129 @@ If you need to downgrade Besu, first run this subcommand specifying the path to the [configuration file](../../how-to/use-configuration-file/index.md) normally used to start Besu. +### `rocksdb usage` + + + + + +```bash +besu --config-file storage rocksdb usage +``` + + + + + +```bash +besu --config-file config.toml storage rocksdb usage +``` + + + + + +```bash +|--------------------------------|-----------------|-------------|-----------------|------------------| +| Column Family | Keys | Total Size | SST Files Size | Blob Files Size | +|--------------------------------|-----------------|-------------|-----------------|------------------| +| BLOCKCHAIN | 2355141414 | 933 GiB | 166 GiB | 767 GiB | +| VARIABLES | 26 | 240 KiB | 240 KiB | 0 B | +| ACCOUNT_INFO_STATE | 9634454 | 496 MiB | 496 MiB | 0 B | +| ACCOUNT_STORAGE_STORAGE | 24041432 | 1 GiB | 1 GiB | 0 B | +| CODE_STORAGE | 37703864 | 12 GiB | 12 GiB | 0 B | +| TRIE_BRANCH_STORAGE | 1885032116 | 138 GiB | 138 GiB | 0 B | +| TRIE_LOG_STORAGE | 267301 | 17 GiB | 17 GiB | 0 B | +|--------------------------------|-----------------|-------------|-----------------|------------------| +| ESTIMATED TOTAL | 4311820607 | 1104 GiB | 337 GiB | 767 GiB | +|--------------------------------|-----------------|-------------|-----------------|------------------| +``` + + + + + +Displays the disk space used by the RocksDB key-value database, categorized into column families. + +### `trie-log` + +Provides actions related to managing, recording, and logging changes for the Bonsai Trie data. + +#### `count` + + + + + +```bash +besu --config-file storage trie-log count +``` + + + + + +```bash +besu --config-file config.toml storage trie-log count +``` + + + + + +```bash +trieLog count: 742311 + - canonical count: 681039 + - fork count: 217 + - orphaned count: 61055 +``` + + + + + +Displays the number of trie logs in the database. +This is the number of keys for the `TRIE_LOG_STORAGE` [column family in RocksDB](#rocksdb-usage). +The following are specified in the `trieLog count`: +- `canonical count` represents the finalized blockchain. +- `fork count` represents non-finalized branches of the blockchain. +- `orphaned count` represents trie logs not in the blockchain, which can occur during block creation. + +#### `prune` + + + + + +```bash +besu --config-file storage trie-log prune +``` + + + + + +```bash +besu --config-file config.toml storage trie-log prune +``` + + + + + +```bash +besu --config-file config.toml --bonsai-historical-block-limit=1024 storage trie-log prune +``` + + + + + +Removes all trie log layers below the specified retention limit, including orphaned trie logs. +You can configure the retention limit using [`--bonsai-historical-block-limit`](options.md#bonsai-historical-block-limit). +The retention limit should match the configuration used with [`--bonsai-limit-trie-logs-enabled`](options.md#bonsai-limit-trie-logs-enabled). +The default limit is `512`. + ## `validate-config` @@ -341,7 +464,7 @@ besu validate-config --config-file ```bash -besu validate-config --config-file ../besu-local-nodes/config/besu/besu1.conf +besu validate-config --config-file config.toml ```