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

[Storage Refactor] Init pebble DB in scaffold. #6949

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

zhangchiqing
Copy link
Member

@zhangchiqing zhangchiqing commented Jan 28, 2025

This PR adds a flag pebble-dir with default value /data/pebble-dir for storing pebble database data. It will be used for the transition from badger to pebbleDB.

@@ -1925,14 +1930,6 @@ func WithLogLevel(level string) Option {
}
}

// WithDB takes precedence over WithDataDir and datadir will be set to empty if DB is set using this option
func WithDB(db *badger.DB) Option {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not being used anywhere

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was added to support the consensus follower

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain it a bit more? I can't find anywhere using it.

I deleted it, and tested localnet, it ran fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you use a consensus follower as a library, you may want to use the same database for the blocks/etc and you app. so there's an option to provide your own db instead of the scaffold always creating one

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. We need to discuss this, because it creates extra complexity, as we are transitioning to pebble DB.

@codecov-commenter
Copy link

codecov-commenter commented Jan 28, 2025

Codecov Report

Attention: Patch coverage is 24.13793% with 22 lines in your changes missing coverage. Please review.

Project coverage is 41.09%. Comparing base (64c8b79) to head (46122fb).
Report is 31 commits behind head on master.

Files with missing lines Patch % Lines
cmd/scaffold.go 0.00% 15 Missing ⚠️
cmd/scaffold/pebble_db.go 45.45% 4 Missing and 2 partials ⚠️
follower/consensus_follower.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6949      +/-   ##
==========================================
- Coverage   41.13%   41.09%   -0.04%     
==========================================
  Files        2119     2124       +5     
  Lines      185938   186155     +217     
==========================================
+ Hits        76479    76496      +17     
- Misses     103054   103249     +195     
- Partials     6405     6410       +5     
Flag Coverage Δ
unittests 41.09% <24.13%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zhangchiqing zhangchiqing marked this pull request as ready for review January 28, 2025 21:19
@zhangchiqing zhangchiqing requested a review from a team as a code owner January 28, 2025 21:19
@@ -1889,9 +1896,7 @@ func WithBindAddress(bindAddress string) Option {

func WithDataDir(dataDir string) Option {
return func(config *BaseConfig) {
if config.db == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was used for the consensus follower

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why we need both WithDB and WithDataDir. I think we should keep only one, no?

@@ -1925,14 +1930,6 @@ func WithLogLevel(level string) Option {
}
}

// WithDB takes precedence over WithDataDir and datadir will be set to empty if DB is set using this option
func WithDB(db *badger.DB) Option {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was added to support the consensus follower

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 this pull request may close these issues.

3 participants