mirror of
https://github.com/luxfi/zapdb.git
synced 2026-07-27 06:54:45 +00:00
Check maxVersion across all tables which overlaps with key range within a level
This commit is contained in:
+6
-4
@@ -239,6 +239,7 @@ func (s *levelHandler) get(key []byte) (y.ValueStruct, error) {
|
||||
tables, decr := s.getTableForKey(key)
|
||||
keyNoTs := y.ParseKey(key)
|
||||
|
||||
var maxVs y.ValueStruct
|
||||
for _, th := range tables {
|
||||
if th.DoesNotHave(keyNoTs) {
|
||||
y.NumLSMBloomHits.Add(s.strLevel, 1)
|
||||
@@ -254,12 +255,13 @@ func (s *levelHandler) get(key []byte) (y.ValueStruct, error) {
|
||||
continue
|
||||
}
|
||||
if y.SameKey(key, it.Key()) {
|
||||
vs := it.Value()
|
||||
vs.Version = y.ParseTs(it.Key())
|
||||
return vs, decr()
|
||||
if version := y.ParseTs(it.Key()); maxVs.Version < version {
|
||||
maxVs = it.Value()
|
||||
maxVs.Version = version
|
||||
}
|
||||
}
|
||||
}
|
||||
return y.ValueStruct{}, decr()
|
||||
return maxVs, decr()
|
||||
}
|
||||
|
||||
// appendIterators appends iterators to an array of iterators, for merging.
|
||||
|
||||
Reference in New Issue
Block a user