Skip to content
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

introduce DB options when creating new backend DB #50

Closed
JayT106 opened this issue Sep 12, 2022 · 1 comment · Fixed by #51
Closed

introduce DB options when creating new backend DB #50

JayT106 opened this issue Sep 12, 2022 · 1 comment · Fixed by #51

Comments

@JayT106
Copy link
Contributor

JayT106 commented Sep 12, 2022

When testing Cronos functionalities, we think the changes in tendermint/tm-db#218 made the DB consume too much RAM. Instead of hardcoding the max open file number, we prefer it to be adjustable based on the instance's resources.
Therefore,

We may introduce DBOptions into dbCreator, i.e.

type (
	dbCreator func(name string, dir string, opts DBOptions) (DB, error)

	DBOptions interface {
		Get(string) interface{}
	}
)

and introduce a new method and then update the original NewDB implementation

func NewDBwithOptions(name string, backend BackendType, dir string, opts DBOptions) (DB, error) {

func NewDB(name string, backend BackendType, dir string) (DB, error) {
	return NewDBwithOptions(name, backend, dir, nil)
}

Therefore, it will be easier to make DB adjustments to the Cosmos SDK when the DB supports certain options.

@JayT106
Copy link
Contributor Author

JayT106 commented Sep 12, 2022

relate tendermint/tm-db#272

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant