From aa40295f06b198e873b84c6f304c071b92a6b375 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 1 Sep 2020 22:48:23 -0700 Subject: [PATCH] leveldb: report not found entry --- weed/filer/leveldb/leveldb_store_kv.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/weed/filer/leveldb/leveldb_store_kv.go b/weed/filer/leveldb/leveldb_store_kv.go index 7fe1d3356..f686cbf21 100644 --- a/weed/filer/leveldb/leveldb_store_kv.go +++ b/weed/filer/leveldb/leveldb_store_kv.go @@ -3,6 +3,8 @@ package leveldb import ( "context" "fmt" + "github.com/chrislusf/seaweedfs/weed/filer" + "github.com/syndtr/goleveldb/leveldb" ) func (store *LevelDBStore) KvPut(ctx context.Context, key []byte, value []byte) (err error) { @@ -20,6 +22,10 @@ func (store *LevelDBStore) KvGet(ctx context.Context, key []byte) (value []byte, value, err = store.db.Get(key, nil) + if err == leveldb.ErrNotFound { + return nil, filer.ErrKvNotFound + } + if err != nil { return nil, fmt.Errorf("kv get: %v", err) }