-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Use Tendermint db-backend config value instead of compile-time DBBackend value #10948
Comments
Im a fan of this, would you be open to submitting a pr? |
Yeah. I can PR it. I'm not sure when I'll be able to get to it though. I'll assign it to myself when I start on it. |
I've updated the ticket to reflect the Tendermint v0.35.x config key |
PR ready for review: #11188 |
In what circumstances do you want to do this? |
@peterbourgon If I had to guess, he is fiddling with the databases and testing, so it is useful to him to have multiple db's in the compiled binary-- I say this because it'd be useful to me, too. Could always just recompile, but the current setup isn't great, it actually led to me making a mistake where I thought I'd enabled rocks but had only been using rocks on some data. |
This is how things are done on the tendermint side, it is nice to have this feature imo. Setting a build flag has confused users. |
speaking of this, does this look like a valid way to set those ldflags?
|
One scenario is testing. It's easier to test different db backends if they're all running the same binary. Another scenario is migrating to a new backend. It's significantly easier to manage with this change. By making it a config option, nodes can migrate to a new backend as they please rather than having to bring down the entire chain for the migration as an upgrade. Additionally, it makes it easier to get real-word performance statistics based on actual use. You could have nodes with the exact same compiled binary running different backend-dbs. It removes one aspect of uncertainty in the stats. If you're asking for a circumstance when I'd want to switch from one db backend to another, it's when there are performance issues that might be solved by using a different database backend. The only situation I can think of where I'd WANT this to be a compile time decision is as a secret feature that's incubating. |
That looks right to me. |
The use case makes lot of sense. Especially for upgrade proposals - validators should be able to decide what DB backend they want to use. Currently they would need to manually recompile the binary. |
I added this note on the PR, but wanted to add it here too for visibility: I realized last night that this change might be troublesome for some users of the SDK. Currently, there is a possibility that a node has two different DB backends: one for the Tendermint DBs (that get their type from the config file's This doesn't appear to be an issue if one is Nodes with two different db backends will either have to migrate their DBs, or rebuild them. I'm going to put an entry under To not need to migrate/rebuild during an upgrade, node operators would need to:
This way, during the upgrade, when |
Summary
Use the Tendermint
db-backend
config value instead of thetypes.DBBackend
value that must be set during compilation (e.g. withldflags='-w -s -X github.com/cosmos/cosmos-sdk/types.DBBackend=rocksdb'
).Problem Definition
As a blockchain engineer, I want to decide the db backend after compiling so that it's easier for nodes to switch from one backend to another.
For example, I'd like to enable support for both leveldb and rocksdb. But Cosmos-SDK prevents this because I must define
github.com/cosmos/cosmos-sdk/types.DBBackend
at compile time; I can only have one. Tendermint already allows this through compile-time tags that only enable support, e.g.-tags "gcc cleveldb rocksdb"
.If I could support both, then node operators could stop their node, change the config, migrate their data, then start their node back up again. Since I can only support one, all of this must be done during an upgrade, increasing downtime.
Proposal
Refactor the
types.utils
funcNewLevelDB
and it's usage so that the tendermint config'sdb-backend
value is used instead ofbackend
(which is based on theDBBackend
variable and set during aninit
func). Remove theDBBackend
variable.For Admin Use
The text was updated successfully, but these errors were encountered: