Skip to content

Commit

Permalink
fix(iterators): Do not return error on missing vlog
Browse files Browse the repository at this point in the history
  • Loading branch information
Ibrahim Jarif committed Nov 24, 2020
1 parent 340ccfc commit ad2cf99
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,27 @@ func (item *Item) yieldItemValue() ([]byte, func(), error) {
if err != nil {
db.opt.Logger.Errorf("Unable to read: Key: %v, Version : %v, meta: %v, userMeta: %v"+
" Error: %v", key, item.version, item.meta, item.userMeta, err)
txn := db.NewTransaction(false)
defer txn.Discard()

iopt := DefaultIteratorOptions
iopt.AllVersions = true
iopt.InternalAccess = true

it := txn.NewKeyIterator(item.Key(), iopt)
defer it.Close()
for it.Rewind(); it.Valid(); it.Next() {
item := it.Item()
var vp valuePointer
if item.meta&bitValuePointer > 0 {
vp.Decode(item.vptr)
}
db.opt.Logger.Errorf("Key: %v, Version : %v, meta: %v, userMeta: %v valuePointer: %+v",
item.Key(), item.version, item.meta, item.userMeta, vp)
}
}
return result, cb, err
// Don't return error if we cannot read the value. Just log the error.
return result, cb, nil
}

func runCallback(cb func()) {
Expand Down

0 comments on commit ad2cf99

Please sign in to comment.