mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-29 18:38:44 +08:00
fix: fix hasCollection response has no status (#37254)
issue: #37257 Signed-off-by: wayblink <anyang.wang@zilliz.com>
This commit is contained in:
parent
be71b98146
commit
d119a2541a
@ -565,10 +565,13 @@ func (t *hasCollectionTask) PreExecute(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (t *hasCollectionTask) Execute(ctx context.Context) error {
|
||||
t.result = &milvuspb.BoolResponse{
|
||||
Status: merr.Success(),
|
||||
}
|
||||
_, err := globalMetaCache.GetCollectionID(ctx, t.HasCollectionRequest.GetDbName(), t.HasCollectionRequest.GetCollectionName())
|
||||
t.result = &milvuspb.BoolResponse{}
|
||||
// error other than
|
||||
if err != nil && !errors.Is(err, merr.ErrCollectionNotFound) {
|
||||
t.result.Status = merr.Status(err)
|
||||
return err
|
||||
}
|
||||
// if collection not nil, means error is ErrCollectionNotFound, result is false
|
||||
|
@ -1095,6 +1095,7 @@ func TestHasCollectionTask(t *testing.T) {
|
||||
err = task.Execute(ctx)
|
||||
assert.NoError(t, err)
|
||||
assert.False(t, task.result.GetValue())
|
||||
assert.NotNil(t, task.result.GetStatus())
|
||||
|
||||
// rootcoord failed to get response
|
||||
rc.updateState(commonpb.StateCode_Abnormal)
|
||||
|
Loading…
Reference in New Issue
Block a user