mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-21 22:12:36 +00:00
filerstore: return real errors from KvGet on MongoDB, ArangoDB, Elastic
These stores mapped every lookup failure to ErrKvNotFound, so a database error looked identical to a missing key: hard-link records could appear gone while links still owned their chunks, and path timestamp reads could treat committed state as absent. Return the underlying error and keep ErrKvNotFound for genuinely missing keys.
This commit is contained in:
@@ -39,7 +39,7 @@ func (store *ArangodbStore) KvGet(ctx context.Context, key []byte) (value []byte
|
||||
}
|
||||
if err != nil {
|
||||
glog.ErrorfCtx(ctx, "kv get: %s %v", string(key), err)
|
||||
return nil, filer.ErrKvNotFound
|
||||
return nil, err
|
||||
}
|
||||
return arrayToBytes(model.Meta), nil
|
||||
}
|
||||
|
||||
@@ -37,13 +37,16 @@ func (store *ElasticStore) KvGet(ctx context.Context, key []byte) (value []byte,
|
||||
if elastic.IsNotFound(err) {
|
||||
return value, filer.ErrKvNotFound
|
||||
}
|
||||
if err != nil {
|
||||
glog.ErrorfCtx(ctx, "find key(%s),%v.", string(key), err)
|
||||
return value, err
|
||||
}
|
||||
if searchResult != nil && searchResult.Found {
|
||||
esEntry := &ESKVEntry{}
|
||||
if err := jsoniter.Unmarshal(searchResult.Source, esEntry); err == nil {
|
||||
return esEntry.Value, nil
|
||||
}
|
||||
}
|
||||
glog.ErrorfCtx(ctx, "find key(%s),%v.", string(key), err)
|
||||
return value, filer.ErrKvNotFound
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ func (store *MongodbStore) KvGet(ctx context.Context, key []byte) (value []byte,
|
||||
err = store.connect.Database(store.database).Collection(store.collectionName).FindOne(ctx, where).Decode(&data)
|
||||
if err != mongo.ErrNoDocuments && err != nil {
|
||||
glog.ErrorfCtx(ctx, "kv get: %v", err)
|
||||
return nil, filer.ErrKvNotFound
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(data.Meta) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user