-
Notifications
You must be signed in to change notification settings - Fork 710
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
feat/Add memiavl based storage #2973
Conversation
go.mod
Outdated
@@ -221,8 +233,13 @@ replace ( | |||
// Use special SDK v0.47.x release with support for both ICS and LSM | |||
github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.47.10-ics-lsm | |||
|
|||
// use memiavl for faster storage | |||
github.com/cosmos/cosmos-sdk/store => github.com/crypto-org-chain/cronos/store v0.0.5-0.20240301012710-e9bb006c8d14 | |||
github.com/cosmos/cosmos-sdk/versiondb => github.com/crypto-org-chain/cronos/versiondb v0.0.5-0.20240301012710-e9bb006c8d14 |
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 one is not needed for memiavl alone.
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.
Thank you @yihuang for the review and comment
Would it be useful for RPC/API providers that need to be able to provide query results with data from different heights?
Or is this only useful for creating statesync snapshots on a verison that memiavl does not snapshot?
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.
Would it be useful for RPC/API providers that need to be able to provide query results with data from different heights?
It do support historical state/proof queries, and the supported range is determined by the memiavl.snapshot-keep-recent
config, it support historical query from the oldest available snapshot to latest height.
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.
But I have to say, historical query is not that efficient with memiavl, I'm not sure how it performs under load, we use versiondb aka. state storage to provide state queries, only use memiavl to provide proof queries.
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.
If historical state/proof query support is removed (no go mod replace), will it case any problems for validators or users of API/RPC?
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.
Lets keep versiondb to help the RPC node providers. The store mod replace will be removed.
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.
Or is this only useful for creating statesync snapshots on a verison that memiavl does not snapshot?
You can't create state sync snapshot from versiondb, because it don't have information for the branch nodes, only leaf key value pairs.
and memiavl do support creating state sync snapshots for all the intermediate versions between the oldest snapshot and the latest height.
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.
Thank you for the clarification. For others reviewing, we discussed how to enable snapshots for intermediate versions here: cosmos/iavl#878 (comment)
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.
Thank you for the clarification. For others reviewing, we discussed how to enable snapshots for intermediate versions here: cosmos/iavl#878 (comment)
maybe you can add some comments for the individual parameters here for now.
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.
Comments on parameters added
go.mod
Outdated
@@ -221,8 +233,13 @@ replace ( | |||
// Use special SDK v0.47.x release with support for both ICS and LSM | |||
github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.47.10-ics-lsm | |||
|
|||
// use memiavl for faster storage | |||
github.com/cosmos/cosmos-sdk/store => github.com/crypto-org-chain/cronos/store v0.0.5-0.20240301012710-e9bb006c8d14 |
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 replacement is not needed, the github.com/crypto-org-chain/cronos/store
is not a replacement for the cosmos store package.
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.
Is it okay to NOT replace cosmos-sdk/store and only use cronos/store for the helper function?
memiavlstore "github.com/crypto-org-chain/cronos/store"
baseAppOptions = memiavlstore.SetupMemIAVL(logger, homePath, appOpts, false, false, baseAppOptions)
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.
it's not supposed to replace cosmos-sdk/store
at all, it's a different package ;D
it implements the same interfaces, and hook into cosmos-sdk to replace the default root multistore.
go.mod
Outdated
@@ -16,6 +18,7 @@ require ( | |||
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.2 | |||
github.com/cosmos/ibc-go/v7 v7.3.2 | |||
github.com/cosmos/interchain-security/v3 v3.3.0 | |||
github.com/crypto-org-chain/cronos/store v0.0.0-00010101000000-000000000000 |
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.
github.com/crypto-org-chain/cronos/store v0.0.0-00010101000000-000000000000 | |
github.com/crypto-org-chain/cronos/store v0.0.5-0.20240301012710-e9bb006c8d14 |
I think you can pin the version here, and remove the replacement.
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.
Will try again. go mod tidy kept on putting zeros.
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.
will be able to fix after removing the replace
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.
fixed
3ca7cd9
to
071abe4
Compare
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.
Thank you for your contribution and opening a PR.
I went over the PR and the linked issues/PRs on other repos.
I'm not certain we can just add it - we need to do more extensive testing.
I'm not certain the cosmos-sdk/versiondb
needs to be replaced.
I need more information to figure out what this means for future chain upgrades:
- Can we upgrade to v16 and add these without issues?
- Is this a purely optional feature?
- Does this impact upgrade speed and how?
If we add it, does it affect all users?
With this, we would need some docs or guides to communicate to validators how and why use this. Would you be able to provide a more comprehensive guide?
@yihuang - Do you have a chance to comment on this?
memiavl is an alternate key value storage db. On Jackal chain, running memiavl prior to upgrade and after upgrade resulted in a fast upgrade with no problems. Mixing db drivers before and after upgrade will not work. Similar as switching goleveldb to rocksdb. Must delete local database storage and resync when database drivers change.
Purely optional and opt-in by configuration.
Default opt-out. PR is configured for Opt-in-only by operators who are interested.
Upgrade speed should be much faster. The one hour downtime for the previous hub upgrade would be greatly reduced. If you prefer an actual tested time, can provision a node an give an actual time. The statesync chunk apply time for Theta Testnet is approximately: 70 minutes for goleveldb (as is - on test server) Upgrades changing key value pairs should have similar performance improvements. Statesync is an upgrade from height 0 to current head height.
Typically no issue seen adding. memiavl needs to be active
If this PR is acceptable, we can allocate time to create usage documentation prior to merge. |
Yes, unneeded, there's no this package in the first place. |
updated code to remove version db as suggested by @yihuang go 1.22 required
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Description
Add memiavl storage support
No operational change when memiavl is not enabled.
Note github.com/crypto-org-chain/cronos requires go 1.22
Statesync, Snapshot, Validation works well in Theta Testnet as provided in this branch against v15.0.0-rc3
https://github.com/chillyvee/gaia/tree/cv15.0.0-rc3-memiavl
Quickly test on theta testnet with app.toml as follows:
The statesync chunk apply time for Theta Testnet is approximately:
This work follows a general effort to provide options to increase the speed of statesync and improved i/o utilization.
Related discussion here:
cosmos/iavl#878
Author Checklist
I have...
!
to the type prefix if API, client, or state breaking change (i.e., requires minor or major version bump).changelog
(for details, see contributing guidelines)Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change