-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- move the common functions out and use them in getBatch and get
- Avoid allocating vss and seeks slices
- define a function for converting ValueStruct to Item type
- 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
No description provided.