Skip to content

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

Merged
melekes merged 5 commits intomainfrom
578-pebbledb
Sep 20, 2024
Merged

feat!: add goleveldb and remove pebbledb build flag#202
melekes merged 5 commits intomainfrom
578-pebbledb

Conversation

@melekes
Copy link
Copy Markdown
Collaborator

@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
Copy Markdown
Collaborator

@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
Copy Markdown
Collaborator

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.

}
err = db.db.Compact(start, end, true)
return
return db.db.Compact(start, end, true)
Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator

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
@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