-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rocksdb plugin to support OptimisticTransactionDb and TransactionDb #5328
Rocksdb plugin to support OptimisticTransactionDb and TransactionDb #5328
Conversation
…t to optimistic and pessimistic Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
|
...perledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java
Fixed
Show fixed
Hide fixed
...esu/plugin/services/storage/rocksdb/segmented/PessimisticRocksDBColumnarKeyValueStorage.java
Fixed
Show fixed
Hide fixed
...esu/plugin/services/storage/rocksdb/segmented/PessimisticRocksDBColumnarKeyValueStorage.java
Fixed
Show fixed
Hide fixed
...besu/plugin/services/storage/rocksdb/segmented/OptimisticRocksDBColumnarKeyValueStorage.java
Fixed
Show fixed
Hide fixed
...besu/plugin/services/storage/rocksdb/segmented/OptimisticRocksDBColumnarKeyValueStorage.java
Fixed
Show fixed
Hide fixed
...perledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java
Fixed
Show fixed
Hide fixed
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
...perledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java
Fixed
Show fixed
Hide fixed
...perledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java
Fixed
Show fixed
Hide fixed
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
LOG.info("FOREST mode detected, using pessimistic DB."); | ||
segmentedStorage = | ||
new PessimisticRocksDBColumnarKeyValueStorage( | ||
rocksDBConfiguration, | ||
segmentsForVersion, | ||
ignorableSegments, | ||
metricsSystem, | ||
rocksDBMetricsFactory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be done just for databaseVersion 1 in the switch statement as that indicates the db format is forest. Then the isForestStorageFormat wouldn't be needed either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created that flag on purpose cause it took me some time to understand that DBversion actually is related to forest or bonsai. I think the usage of numbers to identify version is fine. But giving some more context to the code so next devs to touch don't spend time trying to understand what this version means.
In my first draft I wasted some time piping the StorageFormat through the plugin API because I didn't know that database version represented that same information.
...esu/plugin/services/storage/rocksdb/segmented/PessimisticRocksDBColumnarKeyValueStorage.java
Outdated
Show resolved
Hide resolved
...esu/plugin/services/storage/rocksdb/segmented/PessimisticRocksDBColumnarKeyValueStorage.java
Outdated
Show resolved
Hide resolved
Can you explain the benefits of these modes/this PR? I think a review from @garyschulte at some point be useful as well (not urgent prior to the next release). |
The main benefit is that it simplifies concurrency for forest mode. Bonsai relies on Snapshots, which require OptimisticTransactionDb. For some reason Optimistic causes transaction locking timeouts for forest mode. We could spend time on forest to discover why, but if we can avoid the issue by reverting toTransactionDb instead, that is a win. I think there is value in having the ability to configure both modes with the rocksdb plugin, so that neither storage format forces the other mode to use a specific transaction mode. |
@non-fungible-nelson It is pretty much impossible to sync a node currently using Forest (fast/snap/checkpoint). The worldstate(ws) download pipeline gets a lot of locking timeouts like Gary said and halts. We tried different approachs to avoid the ws pipeline to break (mostly some retries logics). Eventually switching Forest back to Pessimistic mode puts Forest back on track to get the the initial sync working. |
@garyschulte |
...java/org/hyperledger/besu/plugin/services/storage/rocksdb/RocksDBKeyValueStorageFactory.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, minor suggestions about naming and adapter split.
...ger/besu/plugin/services/storage/rocksdb/unsegmented/RocksDBColumnarKeyValueStorageTest.java
Outdated
Show resolved
Hide resolved
...java/org/hyperledger/besu/plugin/services/storage/rocksdb/RocksDBKeyValueStorageFactory.java
Outdated
Show resolved
Hide resolved
...esu/plugin/services/storage/rocksdb/segmented/PessimisticRocksDBColumnarKeyValueStorage.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
…actionDB Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
javadoc - needs a find/replace for pessimistic
...u/plugin/services/storage/rocksdb/segmented/TransactionDBRocksDBColumnarKeyValueStorage.java
Outdated
Show resolved
Hide resolved
...u/plugin/services/storage/rocksdb/segmented/TransactionDBRocksDBColumnarKeyValueStorage.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
...besu/plugin/services/storage/rocksdb/segmented/OptimisticRocksDBColumnarKeyValueStorage.java
Outdated
Show resolved
Hide resolved
...besu/plugin/services/storage/rocksdb/segmented/OptimisticRocksDBColumnarKeyValueStorage.java
Outdated
Show resolved
Hide resolved
...perledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java
Show resolved
Hide resolved
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one more nitpick about class naming
...java/org/hyperledger/besu/plugin/services/storage/rocksdb/RocksDBKeyValueStorageFactory.java
Outdated
Show resolved
Hide resolved
.../java/org/hyperledger/besu/services/kvstore/NonSnappableSegmentedKeyValueStorageAdapter.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢
# Conflicts: # CHANGELOG.md
…yperledger#5328) * Refactor to make RocksDBColumnarKeyValueStorage abstract and extend it to optimistic and pessimistic. Atm Forest has a concurrency level that does not cope well with the OptimisticTransactionDB and RocksDB ends up raising a lot of Busy when committing RocksDBTransactions. A TransactionDB will do conflict checking for all write operations (Put, Delete and Merge), including writes performed outside a Transaction according to RocksDB. This does impact the times we see when syncing so likely not the final solution for Forest. Bonsai should continue using OptimisticTransactionDB. Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com> --------- Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
…yperledger#5328) * Refactor to make RocksDBColumnarKeyValueStorage abstract and extend it to optimistic and pessimistic. Atm Forest has a concurrency level that does not cope well with the OptimisticTransactionDB and RocksDB ends up raising a lot of Busy when committing RocksDBTransactions. A TransactionDB will do conflict checking for all write operations (Put, Delete and Merge), including writes performed outside a Transaction according to RocksDB. This does impact the times we see when syncing so likely not the final solution for Forest. Bonsai should continue using OptimisticTransactionDB. Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com> --------- Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
PR description
Tis PR introduces some changes to the RocksDB plugin to allow using the DB in either pessimistic or optimistic transaction mode.
Currently pessimistic is tied to the usage of Forest data format.
The refactor was done with the intent to keep bonsai as it is currently with usage of the optimistic transaction db.
This is just a initial draft not ready for review yet.
Fixed Issue(s)
Fixes #5300
Scenarios tested:
Sepolia
Goerli
Mainnet
Backwards compatibility