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

Added get multiple api for badger #2173

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

harshil-goel
Copy link
Contributor

No description provided.

@harshil-goel harshil-goel requested a review from a team as a code owner February 18, 2025 09:01
Copy link
Member

@mangalaman93 mangalaman93 left a comment

Choose a reason for hiding this comment

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

  1. move the common functions out and use them in getBatch and get
  2. Avoid allocating vss and seeks slices
  3. define a function for converting ValueStruct to Item type
  4. Consider taking the []*Item as an argument instead of constructing it inside GetBatch

db.go Outdated
@@ -736,6 +736,8 @@ func (db *DB) getMemTables() ([]*memTable, func()) {
// get returns the value in memtable or disk for given key.
// Note that value will include meta byte.
//
// getBatch would return the values of list of keys in order
Copy link
Member

Choose a reason for hiding this comment

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

The first word of the comment must be the same name as the function, same for get as well

db.go Outdated
@@ -747,7 +749,54 @@ func (db *DB) getMemTables() ([]*memTable, func()) {
// do that. For every get("fooX") call where X is the version, we will search
// for "fooX" in all the levels of the LSM tree. This is expensive but it
// removes the overhead of handling move keys completely.
func (db *DB) getBatch(keys [][]byte, keysRead []bool) ([]y.ValueStruct, error) {
if db.IsClosed() {
return []y.ValueStruct{}, ErrDBClosed
Copy link
Member

Choose a reason for hiding this comment

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

can this not be nil, ErrDBClosed?

db.go Outdated
if keysRead[j] {
continue
}
version := y.ParseTs(key)
Copy link
Member

Choose a reason for hiding this comment

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

this can be an argument to the function

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

Successfully merging this pull request may close these issues.

2 participants