-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Pruning cleanup #1533
Pruning cleanup #1533
Conversation
a2f958a
to
43db01b
Compare
Codecov Report
@@ Coverage Diff @@
## master #1533 +/- ##
==========================================
- Coverage 63.04% 62.84% -0.21%
==========================================
Files 123 124 +1
Lines 6960 6992 +32
==========================================
+ Hits 4388 4394 +6
- Misses 2321 2346 +25
- Partials 251 252 +1 |
43db01b
to
d66e5a7
Compare
store/rootmultistore.go
Outdated
@@ -40,6 +42,7 @@ func NewCommitMultiStore(db dbm.DB) *rootMultiStore { | |||
storesParams: make(map[StoreKey]storeParams), | |||
stores: make(map[StoreKey]CommitStore), | |||
keysByName: make(map[string]StoreKey), | |||
pruning: viper.GetString("pruning"), |
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.
;)
d66e5a7
to
242a1d7
Compare
242a1d7
to
7d147d4
Compare
Updated to use functional options. We should still do some CLI / gaiad testing, but that could wait on a refactor / clean up of test_cli in general. |
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 👍
1fa9460
to
2546b8e
Compare
Is there any chance we can get this in before gaia-7000 launches? |
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.
Yeah, this LGTM 🎉
47040cf
to
0a51c56
Compare
store/iavlstore.go
Outdated
// Implements Committer. | ||
func (st *iavlStore) SetPruning(pruning string) { | ||
switch pruning { | ||
case "everything": |
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.
Can pruning
be an enum instead of a string, or is that hard to use with functional options?
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 could. Would just have to move this switch case into the baseapp.SetPruning function and have it translate to enum there, so that the Committer SetPruning function could take enums.
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.
An enum would be better I think; if the user specifies an invalid option we should fail.
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.
👍
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.
Logic LGTM; a few suggestions.
store/iavlstore.go
Outdated
@@ -16,18 +16,19 @@ import ( | |||
const ( | |||
defaultIAVLCacheSize = 10000 | |||
defaultIAVLNumRecent = 100 | |||
defaultIAVLStoreEvery = 1 | |||
defaultIAVLStoreEvery = 10000 |
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.
Can we choose one strategy (syncable
) as default instead of duplicating constants?
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.
Can do. The constants aren't actually being used currently anyway, just there for the constructor before SetPruning is called. I could change the constructor to not take them in as parameters and only use SetPruning, but that would change all the tests. Simpler solution is to just have LoadIAVLStore pass in zero for both and then call SetPruning.
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
// File for storing in-package BaseApp optional functions, |
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.
Cool - is it also possible to set these options in config.toml
or a Gaia-specific file / is there some way we could architect that?
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.
We should definitely have this able to be set in config, but I think currently everything in the toml is managed by tendermint, so we would either have to add it there, or make a another config file. I would say we should make a separate issue to plan out how we want to do gaia/app specific config files.
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.
72a3469
to
341e1d0
Compare
Great work! |
ref: #1516