diff --git a/internal/datacoord/index_service.go b/internal/datacoord/index_service.go index 3853ae492a..1b13a7e91d 100644 --- a/internal/datacoord/index_service.go +++ b/internal/datacoord/index_service.go @@ -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, diff --git a/internal/datacoord/index_service_test.go b/internal/datacoord/index_service_test.go index 74c68aad8b..3c61b92a66 100644 --- a/internal/datacoord/index_service_test.go +++ b/internal/datacoord/index_service_test.go @@ -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) {