...
The issue for Bonsai archive is here. There's also and the PR is here. For context there was originally a draft PR which was a start at delivering the feature, and a re-based branch of that PR https://github.com/jframe/besu/tree/multi-version-flat-db-rebase
...
Design
When Bonsai DB is enabled the node switches between FULL and PARTIAL modes automatically, depending on what state the DB is currently in - there is no config/CLI arg to switch between them. For ARCHIVE mode it would make sense to have a config/CLI option such as --bonsai-archive-enabled=true
(which defaults to false
)makes use of additional DB segments to store flat data in addition to the state trie. These segments include:
- ACCOUNT_INFO_STATE
- ACCOUNT_STORAGE_STORAGE
- CODE_STORAGE
These are used to store account state, account storage, and code respectively.
In order to provide access to historic state and account storage, 2 new DB segments have been introduced:
- ACCOUNT_INFO_STATE_ARCHIVE
- ACCOUNT_STORAGE_ARCHIVE
Configuration
Bonsai archive is delivered as a new data storage format. Initially it will be experimental. To create a Bonsai archive node use --data-storage-format=X_BONSAI_ARCHIVE
Rocks DB column families
Currently the column families are identified by an individual byte. You need to know that e.g. 0x0a maps to "TRIE_LOG_STORAGE". The Bonsai archive work might be a good time to update the column families from bytes to string names to make querying the DB directly easier. This would likely mean moving the DATABASE_METADATA version from 2
to 3
and would require decisions about whether to upgrade existing DBs or just use the new names for new DBs.