-
Notifications
You must be signed in to change notification settings - Fork 96
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
init: fast query DB #229
Closed
Closed
init: fast query DB #229
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
emidev98
requested review from
javiersuweijie,
tuky191 and
gregnuj
as code owners
December 7, 2023 17:19
…to feat/v2.9/query
…to feat/v2.9/query
tuky191
approved these changes
Jan 10, 2024
javiersuweijie
approved these changes
Jan 16, 2024
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feat/fast_db #229 +/- ##
===============================================
Coverage ? 69.92%
===============================================
Files ? 45
Lines ? 2108
Branches ? 0
===============================================
Hits ? 1474
Misses ? 466
Partials ? 168 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implementation
This solution is based on the previous implementation from Mantlemint, StreamingServices and the possibility of setting a query database in a CosmosSDK app. Querying data from the IAVL CosmosSDK can be slow because the checks that have to be done, the MerkleTree re-balances and different write-read processes that are executed in the node. To data access we decided to stream stores data each time a block is commited to a new LevelDB database with multithreading optimizations and without fraudproof-checks because the block is already validated before being commited.
Downsides
There are two main downsides for this implementation, (1) the data will be duplicated if old history of IAVL node is not deleted and (2) the data in this DB does not check merkle tree validity (because there is no merkle tree) so you have to trust the node provider that didn't manipulated the data.