Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

fix seek lastkey may reach EOF

qieqieplusc7e7431fd367
diff --git a/weed/filer/rocksdb/rocksdb_store.go b/weed/filer/rocksdb/rocksdb_store.go
index 9e058a96de..2d5501637e 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),
}