aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2021-01-07 02:26:41 -0800
committerGitHub <noreply@github.com>2021-01-07 02:26:41 -0800
commit07f4703bfcaeb03fbc89d11f91a0317274f99002 (patch)
treee5556c8059465bc57fd0218b9674271fcbb7d22d
parente327385644324776d0a2a06935bfc89dc58546a3 (diff)
parent0f18592315e8a184f1733d9eb9ddc77e682e0c23 (diff)
downloadseaweedfs-07f4703bfcaeb03fbc89d11f91a0317274f99002.tar.xz
seaweedfs-07f4703bfcaeb03fbc89d11f91a0317274f99002.zip
Merge pull request #1738 from qieqieplus/rocksdb
fix rocksdb crash when list directory
-rw-r--r--weed/filer/rocksdb/rocksdb_store.go18
1 files changed, 4 insertions, 14 deletions
diff --git a/weed/filer/rocksdb/rocksdb_store.go b/weed/filer/rocksdb/rocksdb_store.go
index 9e058a96d..0793f547c 100644
--- a/weed/filer/rocksdb/rocksdb_store.go
+++ b/weed/filer/rocksdb/rocksdb_store.go
@@ -181,18 +181,12 @@ func enumerate(iter *gorocksdb.Iterator, prefix, lastKey []byte, includeLastKey
iter.Seek(prefix)
} 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() {
+ if bytes.Equal(iter.Key().Data(), lastKey) {
+ iter.Next()
+ }
}
-
}
}
@@ -250,10 +244,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),
}