未验证 提交 59457eb7 编写于 作者: W wei liu 提交者: GitHub

fix get partition progress return wrong error msg (#24899)

Signed-off-by: NWei Liu <wei.liu@zilliz.com>
上级 db31e88a
...@@ -1191,6 +1191,16 @@ func getPartitionProgress( ...@@ -1191,6 +1191,16 @@ func getPartitionProgress(
) )
return return
} }
if resp.GetStatus().GetErrorCode() != commonpb.ErrorCode_Success {
err = merr.Error(resp.GetStatus())
log.Warn("fail to show partitions",
zap.String("collection_name", collectionName),
zap.Strings("partition_names", partitionNames),
zap.String("reason", resp.Status.Reason))
return
}
if len(resp.InMemoryPercentages) != len(partitionIDs) { if len(resp.InMemoryPercentages) != len(partitionIDs) {
errMsg := "fail to show partitions from the querycoord, invalid data num" errMsg := "fail to show partitions from the querycoord, invalid data num"
err = errors.New(errMsg) err = errors.New(errMsg)
......
...@@ -1765,3 +1765,15 @@ func Test_TopKLimit(t *testing.T) { ...@@ -1765,3 +1765,15 @@ func Test_TopKLimit(t *testing.T) {
assert.Error(t, validateTopKLimit(16385)) assert.Error(t, validateTopKLimit(16385))
assert.Error(t, validateTopKLimit(0)) assert.Error(t, validateTopKLimit(0))
} }
func Test_GetPartitionProgressFailed(t *testing.T) {
qc := types.NewMockQueryCoord(t)
qc.EXPECT().ShowPartitions(mock.Anything, mock.Anything).Return(&querypb.ShowPartitionsResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: "Unexpected error",
},
}, nil)
_, _, err := getPartitionProgress(context.TODO(), qc, &commonpb.MsgBase{}, []string{}, "", 1)
assert.Error(t, err)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册