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

feat!: add goleveldb and remove pebbledb build flag #202

Merged
merged 5 commits into from
Sep 20, 2024
Merged

Conversation

melekes
Copy link
Contributor

@melekes melekes commented Sep 19, 2024

Because goleveldb won't be the default CometBFT DB in the future.

Also, minor updates to CI/linting and improvements to logic in pebbledb.

because goleveldb won't be the default CometBFT DB in the future.
@melekes melekes requested a review from a team as a code owner September 19, 2024 05:31
@melekes melekes self-assigned this Sep 19, 2024
@melekes melekes changed the title feat: add goleveldb build flag feat!: add goleveldb build flag Sep 19, 2024
@melekes melekes removed the automerge label Sep 19, 2024
@melekes melekes changed the title feat!: add goleveldb build flag feat!: add goleveldb and remove pebbledb build flag Sep 19, 2024
Copy link
Contributor

@andynog andynog left a comment

Choose a reason for hiding this comment

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

looks good to me, added a few comments.

I'd just add some additional context in the PR description to include information saying there were also minor updates to CI/linting and improvements to logic in other DBs.

Thanks!

return nil
}
return nil
return db.db.Delete(key, pebble.Sync)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm assuming the previous logic was wrong because a nil was returned if there was an err, but changing to the return of db.db.Delete an error will be returned if there's one. I think that's the expected behavior and I'm assuming there was a bug in the old logic, just want to highlight that.

@@ -160,8 +149,7 @@ func (db *PebbleDB) Compact(start, end []byte) (err error) {
if end == nil && iter.Last() {
end = append(end, iter.Key()...)
}
err = db.db.Compact(start, end, true)
return
return db.db.Compact(start, end, true)
Copy link
Contributor

Choose a reason for hiding this comment

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

that is OK, no need to assign to err but this can be overridden by the defer func() if iter.Close() errors out. But that's the expected behavior I believe.


func TestGoLevelDBBackend(t *testing.T) {
name := fmt.Sprintf("test_%x", randStr(12))
db, err := NewDB(name, GoLevelDBBackend, "")
Copy link
Contributor

Choose a reason for hiding this comment

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

noted that the GoLevelDBBackend const will always be included because it's part of db.go which doesn't have the goleveldb flag. It's not harmful because unused const are safe in Go, but in the future if we have more build flags, we could add something like

//go:build goleveldb
// +build goleveldb

package db

const (
	GoLevelDBBackend BackendType = "goleveldb"
)

@melekes melekes added this pull request to the merge queue Sep 20, 2024
Merged via the queue into main with commit b31daa3 Sep 20, 2024
8 checks passed
@melekes melekes deleted the 578-pebbledb branch September 20, 2024 05:43
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.

2 participants