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:
Chris Lu
2026-10-17 21:42:36 -07:00
parent 0369a3127a
commit a6c5ea68cc
3 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -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
}
+4 -1
View File
@@ -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
}
+1 -1
View File
@@ -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 {