aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqieqieplus <admin@qieqie.me>2021-01-07 17:07:56 +0800
committerqieqieplus <admin@qieqie.me>2021-01-07 17:07:56 +0800
commitc7e7431fd367117590930cc1948aa9a25da60d7a (patch)
treeec304e30af93e28c36331bdd775749df7d0c65cf
parent0764fccde7f88fb0d3b2b5824f03ed2cdc2ca42b (diff)
downloadseaweedfs-c7e7431fd367117590930cc1948aa9a25da60d7a.tar.xz
seaweedfs-c7e7431fd367117590930cc1948aa9a25da60d7a.zip
fix seek lastkey may reach EOF
-rw-r--r--weed/filer/rocksdb/rocksdb_store.go18
1 files changed, 3 insertions, 15 deletions
diff --git a/weed/filer/rocksdb/rocksdb_store.go b/weed/filer/rocksdb/rocksdb_store.go
index 9e058a96d..2d5501637 100644
--- a/weed/filer/rocksdb/rocksdb_store.go
+++ b/weed/filer/rocksdb/rocksdb_store.go
@@ -182,17 +182,9 @@ 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) {
- iter.Next()
- }
-
+ if iter.Valid() && !includeLastKey &&
+ bytes.Equal(iter.Key().Data(), lastKey) {
+ iter.Next()
}
}
@@ -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),
}