Set GetIndexBuildProgress is compatible with SDK version 2.1 (#21622)

Signed-off-by: cai.zhang <cai.zhang@zilliz.com>
pull/21509/head
cai.zhang 2023-01-11 16:59:42 +08:00 committed by GitHub
parent e127cf7b99
commit f02ccfb422
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 0 deletions

View File

@ -403,6 +403,15 @@ func (s *Server) GetIndexBuildProgress(ctx context.Context, req *indexpb.GetInde
},
}, nil
}
if len(indexes) > 1 {
log.Warn(msgAmbiguousIndexName())
errResp.ErrorCode = commonpb.ErrorCode_UnexpectedError
errResp.Reason = msgAmbiguousIndexName()
return &indexpb.GetIndexBuildProgressResponse{
Status: errResp,
}, nil
}
indexInfo := &indexpb.IndexInfo{
IndexedRows: 0,
TotalRows: 0,

View File

@ -543,6 +543,40 @@ func TestServer_GetIndexBuildProgress(t *testing.T) {
assert.Equal(t, int64(10250), resp.GetTotalRows())
assert.Equal(t, int64(10250), resp.GetIndexedRows())
})
t.Run("multiple index", func(t *testing.T) {
s.meta.indexes[collID] = map[UniqueID]*model.Index{
indexID: {
TenantID: "",
CollectionID: collID,
FieldID: fieldID,
IndexID: indexID,
IndexName: indexName,
IsDeleted: false,
CreateTime: createTS,
TypeParams: typeParams,
IndexParams: indexParams,
IsAutoIndex: false,
UserIndexParams: nil,
},
indexID + 1: {
TenantID: "",
CollectionID: collID,
FieldID: fieldID + 1,
IndexID: indexID + 1,
IndexName: "_default_idx_102",
IsDeleted: false,
CreateTime: 0,
TypeParams: nil,
IndexParams: nil,
IsAutoIndex: false,
UserIndexParams: nil,
},
}
resp, err := s.GetIndexBuildProgress(ctx, req)
assert.NoError(t, err)
assert.Equal(t, commonpb.ErrorCode_UnexpectedError, resp.GetStatus().GetErrorCode())
})
}
func TestServer_DescribeIndex(t *testing.T) {