fix seek lastkey may reach EOF

This commit is contained in:
qieqieplus 2021-01-07 17:07:56 +08:00
parent 0764fccde7
commit c7e7431fd3

View file

@ -182,18 +182,10 @@ func enumerate(iter *gorocksdb.Iterator, prefix, lastKey []byte, includeLastKey
} else {
iter.Seek(lastKey)
if !includeLastKey {
key := iter.Key().Data()
if !bytes.HasPrefix(key, prefix) {
return nil
}
if bytes.Equal(key, lastKey) {
if iter.Valid() && !includeLastKey &&
bytes.Equal(iter.Key().Data(), lastKey) {
iter.Next()
}
}
}
i := 0
@ -250,10 +242,6 @@ func (store *RocksDBStore) ListDirectoryPrefixedEntries(ctx context.Context, ful
if fileName == "" {
return true
}
limit--
if limit < 0 {
return false
}
entry := &filer.Entry{
FullPath: weed_util.NewFullPath(string(fullpath), fileName),
}