Browse Source
Merge pull request #1738 from qieqieplus/rocksdb
fix rocksdb crash when list directory
pull/1743/head
Chris Lu
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
14 deletions
-
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), |
|
|
|
} |
|
|
|