Reset indexpb for upgrade ()

Signed-off-by: cai.zhang <cai.zhang@zilliz.com>
pull/21622/head
cai.zhang 2023-01-11 14:35:40 +08:00 committed by GitHub
parent df0ffd08ce
commit e127cf7b99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 4020 additions and 4265 deletions

View File

@ -29,7 +29,6 @@ import (
"github.com/milvus-io/milvus/internal/log"
"github.com/milvus-io/milvus/internal/metastore/model"
"github.com/milvus-io/milvus/internal/metrics"
"github.com/milvus-io/milvus/internal/proto/datapb"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/prometheus/client_golang/prometheus"
)
@ -98,7 +97,7 @@ func (m *meta) updateIndexTasksMetrics() {
}
}
func checkParams(fieldIndex *model.Index, req *datapb.CreateIndexRequest) bool {
func checkParams(fieldIndex *model.Index, req *indexpb.CreateIndexRequest) bool {
if len(fieldIndex.TypeParams) != len(req.TypeParams) {
return false
}
@ -137,7 +136,7 @@ func checkParams(fieldIndex *model.Index, req *datapb.CreateIndexRequest) bool {
return !notEq
}
func (m *meta) CanCreateIndex(req *datapb.CreateIndexRequest) (UniqueID, error) {
func (m *meta) CanCreateIndex(req *indexpb.CreateIndexRequest) (UniqueID, error) {
m.RLock()
defer m.RUnlock()
@ -170,7 +169,7 @@ func (m *meta) CanCreateIndex(req *datapb.CreateIndexRequest) (UniqueID, error)
}
// HasSameReq determine whether there are same indexing tasks.
func (m *meta) HasSameReq(req *datapb.CreateIndexRequest) (bool, UniqueID) {
func (m *meta) HasSameReq(req *indexpb.CreateIndexRequest) (bool, UniqueID) {
m.RLock()
defer m.RUnlock()

View File

@ -75,7 +75,7 @@ func TestMeta_CanCreateIndex(t *testing.T) {
buildID2SegmentIndex: map[UniqueID]*model.SegmentIndex{},
}
req := &datapb.CreateIndexRequest{
req := &indexpb.CreateIndexRequest{
CollectionID: collID,
FieldID: fieldID,
IndexName: indexName,
@ -189,7 +189,7 @@ func TestMeta_HasSameReq(t *testing.T) {
buildID2SegmentIndex: map[UniqueID]*model.SegmentIndex{},
}
req := &datapb.CreateIndexRequest{
req := &indexpb.CreateIndexRequest{
CollectionID: collID,
FieldID: fieldID,
IndexName: indexName,

View File

@ -27,7 +27,7 @@ import (
"github.com/milvus-io/milvus/internal/log"
"github.com/milvus-io/milvus/internal/metastore/model"
"github.com/milvus-io/milvus/internal/metrics"
"github.com/milvus-io/milvus/internal/proto/datapb"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/milvus-io/milvus/internal/util/metautil"
"github.com/milvus-io/milvus/internal/util/paramtable"
)
@ -125,7 +125,7 @@ func (s *Server) createIndexForSegmentLoop(ctx context.Context) {
// Index building is asynchronous, so when an index building request comes, an IndexID is assigned to the task and
// will get all flushed segments from DataCoord and record tasks with these segments. The background process
// indexBuilder will find this task and assign it to IndexNode for execution.
func (s *Server) CreateIndex(ctx context.Context, req *datapb.CreateIndexRequest) (*commonpb.Status, error) {
func (s *Server) CreateIndex(ctx context.Context, req *indexpb.CreateIndexRequest) (*commonpb.Status, error) {
log := log.Ctx(ctx)
log.Info("receive CreateIndex request", zap.Int64("CollectionID", req.GetCollectionID()),
zap.String("IndexName", req.GetIndexName()), zap.Int64("fieldID", req.GetFieldID()),
@ -205,7 +205,7 @@ func (s *Server) CreateIndex(ctx context.Context, req *datapb.CreateIndexRequest
}
// GetIndexState gets the index state of the index name in the request from Proxy.
func (s *Server) GetIndexState(ctx context.Context, req *datapb.GetIndexStateRequest) (*datapb.GetIndexStateResponse, error) {
func (s *Server) GetIndexState(ctx context.Context, req *indexpb.GetIndexStateRequest) (*indexpb.GetIndexStateResponse, error) {
log := log.Ctx(ctx)
log.Info("receive GetIndexState request", zap.Int64("collectionID", req.CollectionID),
zap.String("indexName", req.IndexName))
@ -218,7 +218,7 @@ func (s *Server) GetIndexState(ctx context.Context, req *datapb.GetIndexStateReq
log.Warn(msgDataCoordIsUnhealthy(paramtable.GetNodeID()))
errResp.ErrorCode = commonpb.ErrorCode_DataCoordNA
errResp.Reason = msgDataCoordIsUnhealthy(paramtable.GetNodeID())
return &datapb.GetIndexStateResponse{
return &indexpb.GetIndexStateResponse{
Status: errResp,
}, nil
}
@ -229,7 +229,7 @@ func (s *Server) GetIndexState(ctx context.Context, req *datapb.GetIndexStateReq
errResp.Reason = fmt.Sprintf("there is no index on collection: %d with the index name: %s", req.CollectionID, req.IndexName)
log.Error("GetIndexState fail", zap.Int64("collectionID", req.CollectionID),
zap.String("indexName", req.IndexName), zap.String("fail reason", errResp.Reason))
return &datapb.GetIndexStateResponse{
return &indexpb.GetIndexStateResponse{
Status: errResp,
}, nil
}
@ -237,18 +237,18 @@ func (s *Server) GetIndexState(ctx context.Context, req *datapb.GetIndexStateReq
log.Warn(msgAmbiguousIndexName())
errResp.ErrorCode = commonpb.ErrorCode_UnexpectedError
errResp.Reason = msgAmbiguousIndexName()
return &datapb.GetIndexStateResponse{
return &indexpb.GetIndexStateResponse{
Status: errResp,
}, nil
}
ret := &datapb.GetIndexStateResponse{
ret := &indexpb.GetIndexStateResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
},
State: commonpb.IndexState_Finished,
}
indexInfo := &datapb.IndexInfo{
indexInfo := &indexpb.IndexInfo{
IndexedRows: 0,
TotalRows: 0,
State: 0,
@ -265,7 +265,7 @@ func (s *Server) GetIndexState(ctx context.Context, req *datapb.GetIndexStateReq
return ret, nil
}
func (s *Server) GetSegmentIndexState(ctx context.Context, req *datapb.GetSegmentIndexStateRequest) (*datapb.GetSegmentIndexStateResponse, error) {
func (s *Server) GetSegmentIndexState(ctx context.Context, req *indexpb.GetSegmentIndexStateRequest) (*indexpb.GetSegmentIndexStateResponse, error) {
log := log.Ctx(ctx)
log.Info("receive GetSegmentIndexState", zap.Int64("CollectionID", req.GetCollectionID()),
zap.String("IndexName", req.GetIndexName()), zap.Int64s("fieldID", req.GetSegmentIDs()))
@ -277,23 +277,23 @@ func (s *Server) GetSegmentIndexState(ctx context.Context, req *datapb.GetSegmen
log.Warn(msgDataCoordIsUnhealthy(paramtable.GetNodeID()))
errResp.ErrorCode = commonpb.ErrorCode_DataCoordNA
errResp.Reason = msgDataCoordIsUnhealthy(paramtable.GetNodeID())
return &datapb.GetSegmentIndexStateResponse{
return &indexpb.GetSegmentIndexStateResponse{
Status: errResp,
}, nil
}
ret := &datapb.GetSegmentIndexStateResponse{
ret := &indexpb.GetSegmentIndexStateResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
},
States: make([]*datapb.SegmentIndexState, 0),
States: make([]*indexpb.SegmentIndexState, 0),
}
indexID2CreateTs := s.meta.GetIndexIDByName(req.GetCollectionID(), req.GetIndexName())
if len(indexID2CreateTs) == 0 {
errMsg := fmt.Sprintf("there is no index on collection: %d with the index name: %s", req.CollectionID, req.GetIndexName())
log.Error("GetSegmentIndexState fail", zap.Int64("collectionID", req.GetCollectionID()),
zap.String("indexName", req.GetIndexName()), zap.String("fail reason", errMsg))
return &datapb.GetSegmentIndexStateResponse{
return &indexpb.GetSegmentIndexStateResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_IndexNotExist,
Reason: errMsg,
@ -302,7 +302,7 @@ func (s *Server) GetSegmentIndexState(ctx context.Context, req *datapb.GetSegmen
}
for _, segID := range req.SegmentIDs {
state := s.meta.GetSegmentIndexState(req.GetCollectionID(), segID)
ret.States = append(ret.States, &datapb.SegmentIndexState{
ret.States = append(ret.States, &indexpb.SegmentIndexState{
SegmentID: segID,
State: state.state,
FailReason: state.failReason,
@ -314,7 +314,7 @@ func (s *Server) GetSegmentIndexState(ctx context.Context, req *datapb.GetSegmen
}
// completeIndexInfo get the building index row count and index task state
func (s *Server) completeIndexInfo(indexInfo *datapb.IndexInfo, index *model.Index, segments []*SegmentInfo) {
func (s *Server) completeIndexInfo(indexInfo *indexpb.IndexInfo, index *model.Index, segments []*SegmentInfo) {
var (
cntNone = 0
cntUnissued = 0
@ -374,7 +374,7 @@ func (s *Server) completeIndexInfo(indexInfo *datapb.IndexInfo, index *model.Ind
}
// GetIndexBuildProgress get the index building progress by num rows.
func (s *Server) GetIndexBuildProgress(ctx context.Context, req *datapb.GetIndexBuildProgressRequest) (*datapb.GetIndexBuildProgressResponse, error) {
func (s *Server) GetIndexBuildProgress(ctx context.Context, req *indexpb.GetIndexBuildProgressRequest) (*indexpb.GetIndexBuildProgressResponse, error) {
log := log.Ctx(ctx)
log.Info("receive GetIndexBuildProgress request", zap.Int64("collID", req.GetCollectionID()),
zap.String("indexName", req.GetIndexName()))
@ -386,7 +386,7 @@ func (s *Server) GetIndexBuildProgress(ctx context.Context, req *datapb.GetIndex
log.Warn(msgDataCoordIsUnhealthy(paramtable.GetNodeID()))
errResp.ErrorCode = commonpb.ErrorCode_DataCoordNA
errResp.Reason = msgDataCoordIsUnhealthy(paramtable.GetNodeID())
return &datapb.GetIndexBuildProgressResponse{
return &indexpb.GetIndexBuildProgressResponse{
Status: errResp,
}, nil
}
@ -396,14 +396,14 @@ func (s *Server) GetIndexBuildProgress(ctx context.Context, req *datapb.GetIndex
errMsg := fmt.Sprintf("there is no index on collection: %d with the index name: %s", req.CollectionID, req.IndexName)
log.Error("GetIndexBuildProgress fail", zap.Int64("collectionID", req.CollectionID),
zap.String("indexName", req.IndexName), zap.String("fail reason", errMsg))
return &datapb.GetIndexBuildProgressResponse{
return &indexpb.GetIndexBuildProgressResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_IndexNotExist,
Reason: errMsg,
},
}, nil
}
indexInfo := &datapb.IndexInfo{
indexInfo := &indexpb.IndexInfo{
IndexedRows: 0,
TotalRows: 0,
State: 0,
@ -413,7 +413,7 @@ func (s *Server) GetIndexBuildProgress(ctx context.Context, req *datapb.GetIndex
}))
log.Info("GetIndexBuildProgress success", zap.Int64("collectionID", req.GetCollectionID()),
zap.String("indexName", req.GetIndexName()))
return &datapb.GetIndexBuildProgressResponse{
return &indexpb.GetIndexBuildProgressResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
},
@ -423,7 +423,7 @@ func (s *Server) GetIndexBuildProgress(ctx context.Context, req *datapb.GetIndex
}
// DescribeIndex describe the index info of the collection.
func (s *Server) DescribeIndex(ctx context.Context, req *datapb.DescribeIndexRequest) (*datapb.DescribeIndexResponse, error) {
func (s *Server) DescribeIndex(ctx context.Context, req *indexpb.DescribeIndexRequest) (*indexpb.DescribeIndexResponse, error) {
log := log.Ctx(ctx)
log.Info("receive DescribeIndex request", zap.Int64("collID", req.GetCollectionID()),
zap.String("indexName", req.GetIndexName()))
@ -435,7 +435,7 @@ func (s *Server) DescribeIndex(ctx context.Context, req *datapb.DescribeIndexReq
log.Warn(msgDataCoordIsUnhealthy(paramtable.GetNodeID()))
errResp.ErrorCode = commonpb.ErrorCode_DataCoordNA
errResp.Reason = msgDataCoordIsUnhealthy(paramtable.GetNodeID())
return &datapb.DescribeIndexResponse{
return &indexpb.DescribeIndexResponse{
Status: errResp,
}, nil
}
@ -445,7 +445,7 @@ func (s *Server) DescribeIndex(ctx context.Context, req *datapb.DescribeIndexReq
errMsg := fmt.Sprintf("there is no index on collection: %d with the index name: %s", req.CollectionID, req.IndexName)
log.Error("DescribeIndex fail", zap.Int64("collectionID", req.CollectionID),
zap.String("indexName", req.IndexName), zap.String("fail reason", errMsg))
return &datapb.DescribeIndexResponse{
return &indexpb.DescribeIndexResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_IndexNotExist,
Reason: fmt.Sprint("index doesn't exist, collectionID ", req.CollectionID),
@ -457,9 +457,9 @@ func (s *Server) DescribeIndex(ctx context.Context, req *datapb.DescribeIndexReq
segments := s.meta.SelectSegments(func(info *SegmentInfo) bool {
return isFlush(info) && info.CollectionID == req.GetCollectionID()
})
indexInfos := make([]*datapb.IndexInfo, 0)
indexInfos := make([]*indexpb.IndexInfo, 0)
for _, index := range indexes {
indexInfo := &datapb.IndexInfo{
indexInfo := &indexpb.IndexInfo{
CollectionID: index.CollectionID,
FieldID: index.FieldID,
IndexName: index.IndexName,
@ -478,7 +478,7 @@ func (s *Server) DescribeIndex(ctx context.Context, req *datapb.DescribeIndexReq
}
log.Info("DescribeIndex success", zap.Int64("collectionID", req.GetCollectionID()),
zap.String("indexName", req.GetIndexName()))
return &datapb.DescribeIndexResponse{
return &indexpb.DescribeIndexResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
},
@ -489,7 +489,7 @@ func (s *Server) DescribeIndex(ctx context.Context, req *datapb.DescribeIndexReq
// DropIndex deletes indexes based on IndexName. One IndexName corresponds to the index of an entire column. A column is
// divided into many segments, and each segment corresponds to an IndexBuildID. DataCoord uses IndexBuildID to record
// index tasks.
func (s *Server) DropIndex(ctx context.Context, req *datapb.DropIndexRequest) (*commonpb.Status, error) {
func (s *Server) DropIndex(ctx context.Context, req *indexpb.DropIndexRequest) (*commonpb.Status, error) {
log := log.Ctx(ctx)
log.Info("receive DropIndex request", zap.Int64("collectionID", req.GetCollectionID()),
zap.Int64s("partitionIDs", req.GetPartitionIDs()), zap.String("indexName", req.GetIndexName()),
@ -544,7 +544,7 @@ func (s *Server) DropIndex(ctx context.Context, req *datapb.DropIndexRequest) (*
}
// GetIndexInfos gets the index file paths for segment from DataCoord.
func (s *Server) GetIndexInfos(ctx context.Context, req *datapb.GetIndexInfoRequest) (*datapb.GetIndexInfoResponse, error) {
func (s *Server) GetIndexInfos(ctx context.Context, req *indexpb.GetIndexInfoRequest) (*indexpb.GetIndexInfoResponse, error) {
log := log.Ctx(ctx)
log.Info("receive GetIndexInfos request", zap.Int64("collectionID", req.GetCollectionID()),
zap.Int64s("segmentIDs", req.GetSegmentIDs()), zap.String("indexName", req.GetIndexName()))
@ -556,24 +556,24 @@ func (s *Server) GetIndexInfos(ctx context.Context, req *datapb.GetIndexInfoRequ
log.Warn(msgDataCoordIsUnhealthy(paramtable.GetNodeID()))
errResp.ErrorCode = commonpb.ErrorCode_DataCoordNA
errResp.Reason = msgDataCoordIsUnhealthy(paramtable.GetNodeID())
return &datapb.GetIndexInfoResponse{
return &indexpb.GetIndexInfoResponse{
Status: errResp,
}, nil
}
ret := &datapb.GetIndexInfoResponse{
ret := &indexpb.GetIndexInfoResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
},
SegmentInfo: map[int64]*datapb.SegmentIndexInfo{},
SegmentInfo: map[int64]*indexpb.SegmentInfo{},
}
for _, segID := range req.SegmentIDs {
segIdxes := s.meta.GetSegmentIndexes(segID)
ret.SegmentInfo[segID] = &datapb.SegmentIndexInfo{
ret.SegmentInfo[segID] = &indexpb.SegmentInfo{
CollectionID: req.CollectionID,
SegmentID: segID,
EnableIndex: false,
IndexInfos: make([]*datapb.IndexFilePathInfo, 0),
IndexInfos: make([]*indexpb.IndexFilePathInfo, 0),
}
if len(segIdxes) != 0 {
ret.SegmentInfo[segID].EnableIndex = true
@ -582,7 +582,7 @@ func (s *Server) GetIndexInfos(ctx context.Context, req *datapb.GetIndexInfoRequ
indexFilePaths := metautil.BuildSegmentIndexFilePaths(s.meta.chunkManager.RootPath(), segIdx.BuildID, segIdx.IndexVersion,
segIdx.PartitionID, segIdx.SegmentID, segIdx.IndexFileKeys)
ret.SegmentInfo[segID].IndexInfos = append(ret.SegmentInfo[segID].IndexInfos,
&datapb.IndexFilePathInfo{
&indexpb.IndexFilePathInfo{
SegmentID: segID,
FieldID: s.meta.GetFieldIDByIndexID(segIdx.CollectionID, segIdx.IndexID),
IndexID: segIdx.IndexID,

View File

@ -22,6 +22,8 @@ import (
"testing"
"time"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
@ -52,7 +54,7 @@ func TestServer_CreateIndex(t *testing.T) {
Value: "IVF_FLAT",
},
}
req = &datapb.CreateIndexRequest{
req = &indexpb.CreateIndexRequest{
CollectionID: collID,
FieldID: fieldID,
IndexName: indexName,
@ -162,7 +164,7 @@ func TestServer_GetIndexState(t *testing.T) {
}
createTS = uint64(1000)
ctx = context.Background()
req = &datapb.GetIndexStateRequest{
req = &indexpb.GetIndexStateRequest{
CollectionID: collID,
IndexName: "",
}
@ -279,7 +281,7 @@ func TestServer_GetSegmentIndexState(t *testing.T) {
}
createTS = uint64(1000)
ctx = context.Background()
req = &datapb.GetSegmentIndexStateRequest{
req = &indexpb.GetSegmentIndexStateRequest{
CollectionID: collID,
IndexName: "",
SegmentIDs: []UniqueID{segID},
@ -416,7 +418,7 @@ func TestServer_GetIndexBuildProgress(t *testing.T) {
}
createTS = uint64(1000)
ctx = context.Background()
req = &datapb.GetIndexBuildProgressRequest{
req = &indexpb.GetIndexBuildProgressRequest{
CollectionID: collID,
IndexName: "",
}
@ -566,7 +568,7 @@ func TestServer_DescribeIndex(t *testing.T) {
}
createTS = uint64(1000)
ctx = context.Background()
req = &datapb.DescribeIndexRequest{
req = &indexpb.DescribeIndexRequest{
CollectionID: collID,
IndexName: "",
}
@ -791,7 +793,7 @@ func TestServer_DescribeIndex(t *testing.T) {
})
t.Run("describe after drop index", func(t *testing.T) {
status, err := s.DropIndex(ctx, &datapb.DropIndexRequest{
status, err := s.DropIndex(ctx, &indexpb.DropIndexRequest{
CollectionID: collID,
PartitionIDs: nil,
IndexName: "",
@ -828,7 +830,7 @@ func TestServer_DropIndex(t *testing.T) {
}
createTS = uint64(1000)
ctx = context.Background()
req = &datapb.DropIndexRequest{
req = &indexpb.DropIndexRequest{
CollectionID: collID,
IndexName: indexName,
}
@ -965,7 +967,7 @@ func TestServer_DropIndex(t *testing.T) {
})
t.Run("drop one without indexName", func(t *testing.T) {
req = &datapb.DropIndexRequest{
req = &indexpb.DropIndexRequest{
CollectionID: collID,
PartitionIDs: nil,
IndexName: "",
@ -977,7 +979,7 @@ func TestServer_DropIndex(t *testing.T) {
})
t.Run("drop all indexes", func(t *testing.T) {
req = &datapb.DropIndexRequest{
req = &indexpb.DropIndexRequest{
CollectionID: collID,
PartitionIDs: nil,
IndexName: "",
@ -989,7 +991,7 @@ func TestServer_DropIndex(t *testing.T) {
})
t.Run("drop not exist index", func(t *testing.T) {
req = &datapb.DropIndexRequest{
req = &indexpb.DropIndexRequest{
CollectionID: collID,
PartitionIDs: nil,
IndexName: "",
@ -1024,7 +1026,7 @@ func TestServer_GetIndexInfos(t *testing.T) {
}
createTS = uint64(1000)
ctx = context.Background()
req = &datapb.GetIndexInfoRequest{
req = &indexpb.GetIndexInfoRequest{
CollectionID: collID,
SegmentIDs: []UniqueID{segID},
IndexName: indexName,

View File

@ -29,6 +29,7 @@ import (
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
"github.com/milvus-io/milvus/internal/log"
"github.com/milvus-io/milvus/internal/proto/datapb"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/types"
"github.com/milvus-io/milvus/internal/util/commonpbutil"
@ -760,7 +761,7 @@ func (c *Client) CheckHealth(ctx context.Context, req *milvuspb.CheckHealthReque
}
// CreateIndex sends the build index request to IndexCoord.
func (c *Client) CreateIndex(ctx context.Context, req *datapb.CreateIndexRequest) (*commonpb.Status, error) {
func (c *Client) CreateIndex(ctx context.Context, req *indexpb.CreateIndexRequest) (*commonpb.Status, error) {
ret, err := c.grpcClient.ReCall(ctx, func(client datapb.DataCoordClient) (any, error) {
if !funcutil.CheckCtxValid(ctx) {
return nil, ctx.Err()
@ -774,7 +775,7 @@ func (c *Client) CreateIndex(ctx context.Context, req *datapb.CreateIndexRequest
}
// GetIndexState gets the index states from IndexCoord.
func (c *Client) GetIndexState(ctx context.Context, req *datapb.GetIndexStateRequest) (*datapb.GetIndexStateResponse, error) {
func (c *Client) GetIndexState(ctx context.Context, req *indexpb.GetIndexStateRequest) (*indexpb.GetIndexStateResponse, error) {
ret, err := c.grpcClient.ReCall(ctx, func(client datapb.DataCoordClient) (any, error) {
if !funcutil.CheckCtxValid(ctx) {
return nil, ctx.Err()
@ -784,11 +785,11 @@ func (c *Client) GetIndexState(ctx context.Context, req *datapb.GetIndexStateReq
if err != nil || ret == nil {
return nil, err
}
return ret.(*datapb.GetIndexStateResponse), err
return ret.(*indexpb.GetIndexStateResponse), err
}
// GetSegmentIndexState gets the index states from IndexCoord.
func (c *Client) GetSegmentIndexState(ctx context.Context, req *datapb.GetSegmentIndexStateRequest) (*datapb.GetSegmentIndexStateResponse, error) {
func (c *Client) GetSegmentIndexState(ctx context.Context, req *indexpb.GetSegmentIndexStateRequest) (*indexpb.GetSegmentIndexStateResponse, error) {
ret, err := c.grpcClient.ReCall(ctx, func(client datapb.DataCoordClient) (any, error) {
if !funcutil.CheckCtxValid(ctx) {
return nil, ctx.Err()
@ -798,11 +799,11 @@ func (c *Client) GetSegmentIndexState(ctx context.Context, req *datapb.GetSegmen
if err != nil || ret == nil {
return nil, err
}
return ret.(*datapb.GetSegmentIndexStateResponse), err
return ret.(*indexpb.GetSegmentIndexStateResponse), err
}
// GetIndexInfos gets the index file paths from IndexCoord.
func (c *Client) GetIndexInfos(ctx context.Context, req *datapb.GetIndexInfoRequest) (*datapb.GetIndexInfoResponse, error) {
func (c *Client) GetIndexInfos(ctx context.Context, req *indexpb.GetIndexInfoRequest) (*indexpb.GetIndexInfoResponse, error) {
ret, err := c.grpcClient.ReCall(ctx, func(client datapb.DataCoordClient) (any, error) {
if !funcutil.CheckCtxValid(ctx) {
return nil, ctx.Err()
@ -812,11 +813,11 @@ func (c *Client) GetIndexInfos(ctx context.Context, req *datapb.GetIndexInfoRequ
if err != nil || ret == nil {
return nil, err
}
return ret.(*datapb.GetIndexInfoResponse), err
return ret.(*indexpb.GetIndexInfoResponse), err
}
// DescribeIndex describe the index info of the collection.
func (c *Client) DescribeIndex(ctx context.Context, req *datapb.DescribeIndexRequest) (*datapb.DescribeIndexResponse, error) {
func (c *Client) DescribeIndex(ctx context.Context, req *indexpb.DescribeIndexRequest) (*indexpb.DescribeIndexResponse, error) {
ret, err := c.grpcClient.ReCall(ctx, func(client datapb.DataCoordClient) (any, error) {
if !funcutil.CheckCtxValid(ctx) {
return nil, ctx.Err()
@ -826,11 +827,11 @@ func (c *Client) DescribeIndex(ctx context.Context, req *datapb.DescribeIndexReq
if err != nil || ret == nil {
return nil, err
}
return ret.(*datapb.DescribeIndexResponse), err
return ret.(*indexpb.DescribeIndexResponse), err
}
// GetIndexBuildProgress describe the progress of the index.
func (c *Client) GetIndexBuildProgress(ctx context.Context, req *datapb.GetIndexBuildProgressRequest) (*datapb.GetIndexBuildProgressResponse, error) {
func (c *Client) GetIndexBuildProgress(ctx context.Context, req *indexpb.GetIndexBuildProgressRequest) (*indexpb.GetIndexBuildProgressResponse, error) {
ret, err := c.grpcClient.ReCall(ctx, func(client datapb.DataCoordClient) (any, error) {
if !funcutil.CheckCtxValid(ctx) {
return nil, ctx.Err()
@ -840,11 +841,11 @@ func (c *Client) GetIndexBuildProgress(ctx context.Context, req *datapb.GetIndex
if err != nil || ret == nil {
return nil, err
}
return ret.(*datapb.GetIndexBuildProgressResponse), err
return ret.(*indexpb.GetIndexBuildProgressResponse), err
}
// DropIndex sends the drop index request to IndexCoord.
func (c *Client) DropIndex(ctx context.Context, req *datapb.DropIndexRequest) (*commonpb.Status, error) {
func (c *Client) DropIndex(ctx context.Context, req *indexpb.DropIndexRequest) (*commonpb.Status, error) {
ret, err := c.grpcClient.ReCall(ctx, func(client datapb.DataCoordClient) (any, error) {
if !funcutil.CheckCtxValid(ctx) {
return nil, ctx.Err()

View File

@ -25,6 +25,8 @@ import (
"sync"
"time"
"github.com/milvus-io/milvus/internal/proto/indexpb"
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
ot "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing"
clientv3 "go.etcd.io/etcd/client/v3"
@ -158,6 +160,7 @@ func (s *Server) startGrpcLoop(grpcPort int) {
grpc.StreamInterceptor(grpc_middleware.ChainStreamServer(
ot.StreamServerInterceptor(opts...),
logutil.StreamTraceLoggerInterceptor)))
indexpb.RegisterIndexCoordServer(s.grpcServer, s)
datapb.RegisterDataCoordServer(s.grpcServer, s)
go funcutil.CheckGrpcReady(ctx, s.grpcErrChan)
if err := s.grpcServer.Serve(lis); err != nil {
@ -384,36 +387,36 @@ func (s *Server) CheckHealth(ctx context.Context, req *milvuspb.CheckHealthReque
}
// CreateIndex sends the build index request to DataCoord.
func (s *Server) CreateIndex(ctx context.Context, req *datapb.CreateIndexRequest) (*commonpb.Status, error) {
func (s *Server) CreateIndex(ctx context.Context, req *indexpb.CreateIndexRequest) (*commonpb.Status, error) {
return s.dataCoord.CreateIndex(ctx, req)
}
// GetIndexState gets the index states from DataCoord.
// Deprecated: use DescribeIndex instead
func (s *Server) GetIndexState(ctx context.Context, req *datapb.GetIndexStateRequest) (*datapb.GetIndexStateResponse, error) {
func (s *Server) GetIndexState(ctx context.Context, req *indexpb.GetIndexStateRequest) (*indexpb.GetIndexStateResponse, error) {
return s.dataCoord.GetIndexState(ctx, req)
}
func (s *Server) GetSegmentIndexState(ctx context.Context, req *datapb.GetSegmentIndexStateRequest) (*datapb.GetSegmentIndexStateResponse, error) {
func (s *Server) GetSegmentIndexState(ctx context.Context, req *indexpb.GetSegmentIndexStateRequest) (*indexpb.GetSegmentIndexStateResponse, error) {
return s.dataCoord.GetSegmentIndexState(ctx, req)
}
// GetIndexInfos gets the index file paths from DataCoord.
func (s *Server) GetIndexInfos(ctx context.Context, req *datapb.GetIndexInfoRequest) (*datapb.GetIndexInfoResponse, error) {
func (s *Server) GetIndexInfos(ctx context.Context, req *indexpb.GetIndexInfoRequest) (*indexpb.GetIndexInfoResponse, error) {
return s.dataCoord.GetIndexInfos(ctx, req)
}
// DescribeIndex gets all indexes of the collection.
func (s *Server) DescribeIndex(ctx context.Context, req *datapb.DescribeIndexRequest) (*datapb.DescribeIndexResponse, error) {
func (s *Server) DescribeIndex(ctx context.Context, req *indexpb.DescribeIndexRequest) (*indexpb.DescribeIndexResponse, error) {
return s.dataCoord.DescribeIndex(ctx, req)
}
// DropIndex sends the drop index request to DataCoord.
func (s *Server) DropIndex(ctx context.Context, request *datapb.DropIndexRequest) (*commonpb.Status, error) {
func (s *Server) DropIndex(ctx context.Context, request *indexpb.DropIndexRequest) (*commonpb.Status, error) {
return s.dataCoord.DropIndex(ctx, request)
}
// Deprecated: use DescribeIndex instead
func (s *Server) GetIndexBuildProgress(ctx context.Context, req *datapb.GetIndexBuildProgressRequest) (*datapb.GetIndexBuildProgressResponse, error) {
func (s *Server) GetIndexBuildProgress(ctx context.Context, req *indexpb.GetIndexBuildProgressRequest) (*indexpb.GetIndexBuildProgressResponse, error) {
return s.dataCoord.GetIndexBuildProgress(ctx, req)
}

View File

@ -21,6 +21,8 @@ import (
"errors"
"testing"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
"github.com/milvus-io/milvus/internal/proto/datapb"
@ -68,12 +70,12 @@ type MockDataCoord struct {
broadCastResp *commonpb.Status
createIndexResp *commonpb.Status
describeIndexResp *datapb.DescribeIndexResponse
describeIndexResp *indexpb.DescribeIndexResponse
dropIndexResp *commonpb.Status
getIndexStateResp *datapb.GetIndexStateResponse
getIndexBuildProgressResp *datapb.GetIndexBuildProgressResponse
getSegmentIndexStateResp *datapb.GetSegmentIndexStateResponse
getIndexInfosResp *datapb.GetIndexInfoResponse
getIndexStateResp *indexpb.GetIndexStateResponse
getIndexBuildProgressResp *indexpb.GetIndexBuildProgressResponse
getSegmentIndexStateResp *indexpb.GetSegmentIndexStateResponse
getIndexInfosResp *indexpb.GetIndexInfoResponse
}
func (m *MockDataCoord) Init() error {
@ -232,31 +234,31 @@ func (m *MockDataCoord) CheckHealth(ctx context.Context, req *milvuspb.CheckHeal
}, nil
}
func (m *MockDataCoord) CreateIndex(ctx context.Context, req *datapb.CreateIndexRequest) (*commonpb.Status, error) {
func (m *MockDataCoord) CreateIndex(ctx context.Context, req *indexpb.CreateIndexRequest) (*commonpb.Status, error) {
return m.createIndexResp, m.err
}
func (m *MockDataCoord) DescribeIndex(ctx context.Context, req *datapb.DescribeIndexRequest) (*datapb.DescribeIndexResponse, error) {
func (m *MockDataCoord) DescribeIndex(ctx context.Context, req *indexpb.DescribeIndexRequest) (*indexpb.DescribeIndexResponse, error) {
return m.describeIndexResp, m.err
}
func (m *MockDataCoord) GetIndexInfos(ctx context.Context, req *datapb.GetIndexInfoRequest) (*datapb.GetIndexInfoResponse, error) {
func (m *MockDataCoord) GetIndexInfos(ctx context.Context, req *indexpb.GetIndexInfoRequest) (*indexpb.GetIndexInfoResponse, error) {
return m.getIndexInfosResp, m.err
}
func (m *MockDataCoord) GetIndexState(ctx context.Context, req *datapb.GetIndexStateRequest) (*datapb.GetIndexStateResponse, error) {
func (m *MockDataCoord) GetIndexState(ctx context.Context, req *indexpb.GetIndexStateRequest) (*indexpb.GetIndexStateResponse, error) {
return m.getIndexStateResp, m.err
}
func (m *MockDataCoord) GetIndexBuildProgress(ctx context.Context, req *datapb.GetIndexBuildProgressRequest) (*datapb.GetIndexBuildProgressResponse, error) {
func (m *MockDataCoord) GetIndexBuildProgress(ctx context.Context, req *indexpb.GetIndexBuildProgressRequest) (*indexpb.GetIndexBuildProgressResponse, error) {
return m.getIndexBuildProgressResp, m.err
}
func (m *MockDataCoord) GetSegmentIndexState(ctx context.Context, req *datapb.GetSegmentIndexStateRequest) (*datapb.GetSegmentIndexStateResponse, error) {
func (m *MockDataCoord) GetSegmentIndexState(ctx context.Context, req *indexpb.GetSegmentIndexStateRequest) (*indexpb.GetSegmentIndexStateResponse, error) {
return m.getSegmentIndexStateResp, m.err
}
func (m *MockDataCoord) DropIndex(ctx context.Context, req *datapb.DropIndexRequest) (*commonpb.Status, error) {
func (m *MockDataCoord) DropIndex(ctx context.Context, req *indexpb.DropIndexRequest) (*commonpb.Status, error) {
return m.dropIndexResp, m.err
}
@ -577,7 +579,7 @@ func Test_NewServer(t *testing.T) {
t.Run("DescribeIndex", func(t *testing.T) {
server.dataCoord = &MockDataCoord{
describeIndexResp: &datapb.DescribeIndexResponse{},
describeIndexResp: &indexpb.DescribeIndexResponse{},
}
ret, err := server.DescribeIndex(ctx, nil)
assert.NoError(t, err)
@ -595,7 +597,7 @@ func Test_NewServer(t *testing.T) {
t.Run("GetIndexState", func(t *testing.T) {
server.dataCoord = &MockDataCoord{
getIndexStateResp: &datapb.GetIndexStateResponse{},
getIndexStateResp: &indexpb.GetIndexStateResponse{},
}
ret, err := server.GetIndexState(ctx, nil)
assert.NoError(t, err)
@ -604,7 +606,7 @@ func Test_NewServer(t *testing.T) {
t.Run("GetIndexBuildProgress", func(t *testing.T) {
server.dataCoord = &MockDataCoord{
getIndexBuildProgressResp: &datapb.GetIndexBuildProgressResponse{},
getIndexBuildProgressResp: &indexpb.GetIndexBuildProgressResponse{},
}
ret, err := server.GetIndexBuildProgress(ctx, nil)
assert.NoError(t, err)
@ -613,7 +615,7 @@ func Test_NewServer(t *testing.T) {
t.Run("GetSegmentIndexState", func(t *testing.T) {
server.dataCoord = &MockDataCoord{
getSegmentIndexStateResp: &datapb.GetSegmentIndexStateResponse{},
getSegmentIndexStateResp: &indexpb.GetSegmentIndexStateResponse{},
}
ret, err := server.GetSegmentIndexState(ctx, nil)
assert.NoError(t, err)
@ -622,7 +624,7 @@ func Test_NewServer(t *testing.T) {
t.Run("GetIndexInfos", func(t *testing.T) {
server.dataCoord = &MockDataCoord{
getIndexInfosResp: &datapb.GetIndexInfoResponse{},
getIndexInfosResp: &indexpb.GetIndexInfoResponse{},
}
ret, err := server.GetIndexInfos(ctx, nil)
assert.NoError(t, err)

View File

@ -28,6 +28,8 @@ import (
"testing"
"time"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
clientv3 "go.etcd.io/etcd/client/v3"
@ -544,14 +546,6 @@ func (m *MockDataCoord) UpdateChannelCheckpoint(ctx context.Context, req *datapb
return nil, nil
}
func (m *MockDataCoord) AcquireSegmentLock(ctx context.Context, req *datapb.AcquireSegmentLockRequest) (*commonpb.Status, error) {
return nil, nil
}
func (m *MockDataCoord) ReleaseSegmentLock(ctx context.Context, req *datapb.ReleaseSegmentLockRequest) (*commonpb.Status, error) {
return nil, nil
}
func (m *MockDataCoord) BroadcastAlteredCollection(ctx context.Context, req *datapb.AlterCollectionRequest) (*commonpb.Status, error) {
return nil, nil
}
@ -560,31 +554,31 @@ func (m *MockDataCoord) CheckHealth(ctx context.Context, req *milvuspb.CheckHeal
return nil, nil
}
func (m *MockDataCoord) CreateIndex(ctx context.Context, req *datapb.CreateIndexRequest) (*commonpb.Status, error) {
func (m *MockDataCoord) CreateIndex(ctx context.Context, req *indexpb.CreateIndexRequest) (*commonpb.Status, error) {
return nil, nil
}
func (m *MockDataCoord) DropIndex(ctx context.Context, req *datapb.DropIndexRequest) (*commonpb.Status, error) {
func (m *MockDataCoord) DropIndex(ctx context.Context, req *indexpb.DropIndexRequest) (*commonpb.Status, error) {
return nil, nil
}
func (m *MockDataCoord) GetIndexState(ctx context.Context, req *datapb.GetIndexStateRequest) (*datapb.GetIndexStateResponse, error) {
func (m *MockDataCoord) GetIndexState(ctx context.Context, req *indexpb.GetIndexStateRequest) (*indexpb.GetIndexStateResponse, error) {
return nil, nil
}
func (m *MockDataCoord) GetSegmentIndexState(ctx context.Context, req *datapb.GetSegmentIndexStateRequest) (*datapb.GetSegmentIndexStateResponse, error) {
func (m *MockDataCoord) GetSegmentIndexState(ctx context.Context, req *indexpb.GetSegmentIndexStateRequest) (*indexpb.GetSegmentIndexStateResponse, error) {
return nil, nil
}
func (m *MockDataCoord) GetIndexInfos(ctx context.Context, req *datapb.GetIndexInfoRequest) (*datapb.GetIndexInfoResponse, error) {
func (m *MockDataCoord) GetIndexInfos(ctx context.Context, req *indexpb.GetIndexInfoRequest) (*indexpb.GetIndexInfoResponse, error) {
return nil, nil
}
func (m *MockDataCoord) DescribeIndex(ctx context.Context, req *datapb.DescribeIndexRequest) (*datapb.DescribeIndexResponse, error) {
func (m *MockDataCoord) DescribeIndex(ctx context.Context, req *indexpb.DescribeIndexRequest) (*indexpb.DescribeIndexResponse, error) {
return nil, nil
}
func (m *MockDataCoord) GetIndexBuildProgress(ctx context.Context, req *datapb.GetIndexBuildProgressRequest) (*datapb.GetIndexBuildProgressResponse, error) {
func (m *MockDataCoord) GetIndexBuildProgress(ctx context.Context, req *indexpb.GetIndexBuildProgressRequest) (*indexpb.GetIndexBuildProgressResponse, error) {
return nil, nil
}

View File

@ -23,6 +23,8 @@ import (
"strconv"
"strings"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/golang/protobuf/proto"
"go.uber.org/zap"
"golang.org/x/exp/maps"
@ -571,7 +573,7 @@ func (kc *Catalog) ListIndexes(ctx context.Context) ([]*model.Index, error) {
indexes := make([]*model.Index, 0)
for _, value := range values {
meta := &datapb.FieldIndex{}
meta := &indexpb.FieldIndex{}
err = proto.Unmarshal([]byte(value), meta)
if err != nil {
log.Warn("unmarshal index info failed", zap.Error(err))
@ -641,7 +643,7 @@ func (kc *Catalog) ListSegmentIndexes(ctx context.Context) ([]*model.SegmentInde
segIndexes := make([]*model.SegmentIndex, 0)
for _, value := range values {
segmentIndexInfo := &datapb.SegmentIndex{}
segmentIndexInfo := &indexpb.SegmentIndex{}
err = proto.Unmarshal([]byte(value), segmentIndexInfo)
if err != nil {
log.Warn("unmarshal segment index info failed", zap.Error(err))

View File

@ -27,6 +27,8 @@ import (
"testing"
"time"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/golang/protobuf/proto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
@ -893,8 +895,8 @@ func TestCatalog_ListIndexes(t *testing.T) {
t.Run("success", func(t *testing.T) {
txn := &MockedTxnKV{
loadWithPrefix: func(key string) ([]string, []string, error) {
i := &datapb.FieldIndex{
IndexInfo: &datapb.IndexInfo{
i := &indexpb.FieldIndex{
IndexInfo: &indexpb.IndexInfo{
CollectionID: 0,
FieldID: 0,
IndexName: "",
@ -1075,7 +1077,7 @@ func TestCatalog_CreateSegmentIndex(t *testing.T) {
func TestCatalog_ListSegmentIndexes(t *testing.T) {
t.Run("success", func(t *testing.T) {
segIdx := &datapb.SegmentIndex{
segIdx := &indexpb.SegmentIndex{
CollectionID: 0,
PartitionID: 0,
SegmentID: 0,

View File

@ -3,7 +3,7 @@ package model
import (
"github.com/golang/protobuf/proto"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
"github.com/milvus-io/milvus/internal/proto/datapb"
"github.com/milvus-io/milvus/internal/proto/indexpb"
)
type Index struct {
@ -20,7 +20,7 @@ type Index struct {
UserIndexParams []*commonpb.KeyValuePair
}
func UnmarshalIndexModel(indexInfo *datapb.FieldIndex) *Index {
func UnmarshalIndexModel(indexInfo *indexpb.FieldIndex) *Index {
if indexInfo == nil {
return nil
}
@ -39,13 +39,13 @@ func UnmarshalIndexModel(indexInfo *datapb.FieldIndex) *Index {
}
}
func MarshalIndexModel(index *Index) *datapb.FieldIndex {
func MarshalIndexModel(index *Index) *indexpb.FieldIndex {
if index == nil {
return nil
}
return &datapb.FieldIndex{
IndexInfo: &datapb.IndexInfo{
return &indexpb.FieldIndex{
IndexInfo: &indexpb.IndexInfo{
CollectionID: index.CollectionID,
FieldID: index.FieldID,
IndexName: index.IndexName,

View File

@ -3,10 +3,11 @@ package model
import (
"testing"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/stretchr/testify/assert"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
"github.com/milvus-io/milvus/internal/proto/datapb"
)
var (
@ -27,8 +28,8 @@ var (
CreateTime: 1,
}
indexPb = &datapb.FieldIndex{
IndexInfo: &datapb.IndexInfo{
indexPb = &indexpb.FieldIndex{
IndexInfo: &indexpb.IndexInfo{
CollectionID: colID,
FieldID: fieldID,
IndexName: indexName,

View File

@ -3,7 +3,7 @@ package model
import (
"github.com/milvus-io/milvus-proto/go-api/commonpb"
"github.com/milvus-io/milvus/internal/common"
"github.com/milvus-io/milvus/internal/proto/datapb"
"github.com/milvus-io/milvus/internal/proto/indexpb"
)
type SegmentIndex struct {
@ -25,7 +25,7 @@ type SegmentIndex struct {
WriteHandoff bool
}
func UnmarshalSegmentIndexModel(segIndex *datapb.SegmentIndex) *SegmentIndex {
func UnmarshalSegmentIndexModel(segIndex *indexpb.SegmentIndex) *SegmentIndex {
if segIndex == nil {
return nil
}
@ -49,12 +49,12 @@ func UnmarshalSegmentIndexModel(segIndex *datapb.SegmentIndex) *SegmentIndex {
}
}
func MarshalSegmentIndexModel(segIdx *SegmentIndex) *datapb.SegmentIndex {
func MarshalSegmentIndexModel(segIdx *SegmentIndex) *indexpb.SegmentIndex {
if segIdx == nil {
return nil
}
return &datapb.SegmentIndex{
return &indexpb.SegmentIndex{
CollectionID: segIdx.CollectionID,
PartitionID: segIdx.PartitionID,
SegmentID: segIdx.SegmentID,

View File

@ -3,17 +3,18 @@ package model
import (
"testing"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/stretchr/testify/assert"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
"github.com/milvus-io/milvus/internal/proto/datapb"
)
var (
segmentID = int64(1)
buildID = int64(1)
segmentIdxPb = &datapb.SegmentIndex{
segmentIdxPb = &indexpb.SegmentIndex{
CollectionID: colID,
PartitionID: partID,
SegmentID: segmentID,

View File

@ -29,53 +29,6 @@ func (_m *DataCoord) EXPECT() *DataCoord_Expecter {
return &DataCoord_Expecter{mock: &_m.Mock}
}
// AcquireSegmentLock provides a mock function with given fields: ctx, req
func (_m *DataCoord) AcquireSegmentLock(ctx context.Context, req *datapb.AcquireSegmentLockRequest) (*commonpb.Status, error) {
ret := _m.Called(ctx, req)
var r0 *commonpb.Status
if rf, ok := ret.Get(0).(func(context.Context, *datapb.AcquireSegmentLockRequest) *commonpb.Status); ok {
r0 = rf(ctx, req)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*commonpb.Status)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *datapb.AcquireSegmentLockRequest) error); ok {
r1 = rf(ctx, req)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DataCoord_AcquireSegmentLock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AcquireSegmentLock'
type DataCoord_AcquireSegmentLock_Call struct {
*mock.Call
}
// AcquireSegmentLock is a helper method to define mock.On call
// - ctx context.Context
// - req *datapb.AcquireSegmentLockRequest
func (_e *DataCoord_Expecter) AcquireSegmentLock(ctx interface{}, req interface{}) *DataCoord_AcquireSegmentLock_Call {
return &DataCoord_AcquireSegmentLock_Call{Call: _e.mock.On("AcquireSegmentLock", ctx, req)}
}
func (_c *DataCoord_AcquireSegmentLock_Call) Run(run func(ctx context.Context, req *datapb.AcquireSegmentLockRequest)) *DataCoord_AcquireSegmentLock_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*datapb.AcquireSegmentLockRequest))
})
return _c
}
func (_c *DataCoord_AcquireSegmentLock_Call) Return(_a0 *commonpb.Status, _a1 error) *DataCoord_AcquireSegmentLock_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// AssignSegmentID provides a mock function with given fields: ctx, req
func (_m *DataCoord) AssignSegmentID(ctx context.Context, req *datapb.AssignSegmentIDRequest) (*datapb.AssignSegmentIDResponse, error) {
ret := _m.Called(ctx, req)
@ -1272,53 +1225,6 @@ func (_c *DataCoord_Register_Call) Return(_a0 error) *DataCoord_Register_Call {
return _c
}
// ReleaseSegmentLock provides a mock function with given fields: ctx, req
func (_m *DataCoord) ReleaseSegmentLock(ctx context.Context, req *datapb.ReleaseSegmentLockRequest) (*commonpb.Status, error) {
ret := _m.Called(ctx, req)
var r0 *commonpb.Status
if rf, ok := ret.Get(0).(func(context.Context, *datapb.ReleaseSegmentLockRequest) *commonpb.Status); ok {
r0 = rf(ctx, req)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*commonpb.Status)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *datapb.ReleaseSegmentLockRequest) error); ok {
r1 = rf(ctx, req)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DataCoord_ReleaseSegmentLock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReleaseSegmentLock'
type DataCoord_ReleaseSegmentLock_Call struct {
*mock.Call
}
// ReleaseSegmentLock is a helper method to define mock.On call
// - ctx context.Context
// - req *datapb.ReleaseSegmentLockRequest
func (_e *DataCoord_Expecter) ReleaseSegmentLock(ctx interface{}, req interface{}) *DataCoord_ReleaseSegmentLock_Call {
return &DataCoord_ReleaseSegmentLock_Call{Call: _e.mock.On("ReleaseSegmentLock", ctx, req)}
}
func (_c *DataCoord_ReleaseSegmentLock_Call) Run(run func(ctx context.Context, req *datapb.ReleaseSegmentLockRequest)) *DataCoord_ReleaseSegmentLock_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*datapb.ReleaseSegmentLockRequest))
})
return _c
}
func (_c *DataCoord_ReleaseSegmentLock_Call) Return(_a0 *commonpb.Status, _a1 error) *DataCoord_ReleaseSegmentLock_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// SaveBinlogPaths provides a mock function with given fields: ctx, req
func (_m *DataCoord) SaveBinlogPaths(ctx context.Context, req *datapb.SaveBinlogPathsRequest) (*commonpb.Status, error) {
ret := _m.Called(ctx, req)

View File

@ -1,751 +0,0 @@
// Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks
import (
context "context"
commonpb "github.com/milvus-io/milvus-proto/go-api/commonpb"
datapb "github.com/milvus-io/milvus/internal/proto/datapb"
internalpb "github.com/milvus-io/milvus/internal/proto/internalpb"
milvuspb "github.com/milvus-io/milvus-proto/go-api/milvuspb"
mock "github.com/stretchr/testify/mock"
)
// MockIndexCoord is an autogenerated mock type for the IndexCoord type
type MockIndexCoord struct {
mock.Mock
}
type MockIndexCoord_Expecter struct {
mock *mock.Mock
}
func (_m *MockIndexCoord) EXPECT() *MockIndexCoord_Expecter {
return &MockIndexCoord_Expecter{mock: &_m.Mock}
}
// CheckHealth provides a mock function with given fields: ctx, req
func (_m *MockIndexCoord) CheckHealth(ctx context.Context, req *milvuspb.CheckHealthRequest) (*milvuspb.CheckHealthResponse, error) {
ret := _m.Called(ctx, req)
var r0 *milvuspb.CheckHealthResponse
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.CheckHealthRequest) *milvuspb.CheckHealthResponse); ok {
r0 = rf(ctx, req)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*milvuspb.CheckHealthResponse)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.CheckHealthRequest) error); ok {
r1 = rf(ctx, req)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockIndexCoord_CheckHealth_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckHealth'
type MockIndexCoord_CheckHealth_Call struct {
*mock.Call
}
// CheckHealth is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.CheckHealthRequest
func (_e *MockIndexCoord_Expecter) CheckHealth(ctx interface{}, req interface{}) *MockIndexCoord_CheckHealth_Call {
return &MockIndexCoord_CheckHealth_Call{Call: _e.mock.On("CheckHealth", ctx, req)}
}
func (_c *MockIndexCoord_CheckHealth_Call) Run(run func(ctx context.Context, req *milvuspb.CheckHealthRequest)) *MockIndexCoord_CheckHealth_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*milvuspb.CheckHealthRequest))
})
return _c
}
func (_c *MockIndexCoord_CheckHealth_Call) Return(_a0 *milvuspb.CheckHealthResponse, _a1 error) *MockIndexCoord_CheckHealth_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// CreateIndex provides a mock function with given fields: ctx, req
func (_m *MockIndexCoord) CreateIndex(ctx context.Context, req *datapb.CreateIndexRequest) (*commonpb.Status, error) {
ret := _m.Called(ctx, req)
var r0 *commonpb.Status
if rf, ok := ret.Get(0).(func(context.Context, *datapb.CreateIndexRequest) *commonpb.Status); ok {
r0 = rf(ctx, req)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*commonpb.Status)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *datapb.CreateIndexRequest) error); ok {
r1 = rf(ctx, req)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockIndexCoord_CreateIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateIndex'
type MockIndexCoord_CreateIndex_Call struct {
*mock.Call
}
// CreateIndex is a helper method to define mock.On call
// - ctx context.Context
// - req *datapb.CreateIndexRequest
func (_e *MockIndexCoord_Expecter) CreateIndex(ctx interface{}, req interface{}) *MockIndexCoord_CreateIndex_Call {
return &MockIndexCoord_CreateIndex_Call{Call: _e.mock.On("CreateIndex", ctx, req)}
}
func (_c *MockIndexCoord_CreateIndex_Call) Run(run func(ctx context.Context, req *datapb.CreateIndexRequest)) *MockIndexCoord_CreateIndex_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*datapb.CreateIndexRequest))
})
return _c
}
func (_c *MockIndexCoord_CreateIndex_Call) Return(_a0 *commonpb.Status, _a1 error) *MockIndexCoord_CreateIndex_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// DescribeIndex provides a mock function with given fields: ctx, req
func (_m *MockIndexCoord) DescribeIndex(ctx context.Context, req *datapb.DescribeIndexRequest) (*datapb.DescribeIndexResponse, error) {
ret := _m.Called(ctx, req)
var r0 *datapb.DescribeIndexResponse
if rf, ok := ret.Get(0).(func(context.Context, *datapb.DescribeIndexRequest) *datapb.DescribeIndexResponse); ok {
r0 = rf(ctx, req)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*datapb.DescribeIndexResponse)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *datapb.DescribeIndexRequest) error); ok {
r1 = rf(ctx, req)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockIndexCoord_DescribeIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DescribeIndex'
type MockIndexCoord_DescribeIndex_Call struct {
*mock.Call
}
// DescribeIndex is a helper method to define mock.On call
// - ctx context.Context
// - req *datapb.DescribeIndexRequest
func (_e *MockIndexCoord_Expecter) DescribeIndex(ctx interface{}, req interface{}) *MockIndexCoord_DescribeIndex_Call {
return &MockIndexCoord_DescribeIndex_Call{Call: _e.mock.On("DescribeIndex", ctx, req)}
}
func (_c *MockIndexCoord_DescribeIndex_Call) Run(run func(ctx context.Context, req *datapb.DescribeIndexRequest)) *MockIndexCoord_DescribeIndex_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*datapb.DescribeIndexRequest))
})
return _c
}
func (_c *MockIndexCoord_DescribeIndex_Call) Return(_a0 *datapb.DescribeIndexResponse, _a1 error) *MockIndexCoord_DescribeIndex_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// DropIndex provides a mock function with given fields: ctx, req
func (_m *MockIndexCoord) DropIndex(ctx context.Context, req *datapb.DropIndexRequest) (*commonpb.Status, error) {
ret := _m.Called(ctx, req)
var r0 *commonpb.Status
if rf, ok := ret.Get(0).(func(context.Context, *datapb.DropIndexRequest) *commonpb.Status); ok {
r0 = rf(ctx, req)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*commonpb.Status)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *datapb.DropIndexRequest) error); ok {
r1 = rf(ctx, req)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockIndexCoord_DropIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DropIndex'
type MockIndexCoord_DropIndex_Call struct {
*mock.Call
}
// DropIndex is a helper method to define mock.On call
// - ctx context.Context
// - req *datapb.DropIndexRequest
func (_e *MockIndexCoord_Expecter) DropIndex(ctx interface{}, req interface{}) *MockIndexCoord_DropIndex_Call {
return &MockIndexCoord_DropIndex_Call{Call: _e.mock.On("DropIndex", ctx, req)}
}
func (_c *MockIndexCoord_DropIndex_Call) Run(run func(ctx context.Context, req *datapb.DropIndexRequest)) *MockIndexCoord_DropIndex_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*datapb.DropIndexRequest))
})
return _c
}
func (_c *MockIndexCoord_DropIndex_Call) Return(_a0 *commonpb.Status, _a1 error) *MockIndexCoord_DropIndex_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// GetComponentStates provides a mock function with given fields: ctx
func (_m *MockIndexCoord) GetComponentStates(ctx context.Context) (*milvuspb.ComponentStates, error) {
ret := _m.Called(ctx)
var r0 *milvuspb.ComponentStates
if rf, ok := ret.Get(0).(func(context.Context) *milvuspb.ComponentStates); ok {
r0 = rf(ctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*milvuspb.ComponentStates)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(ctx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockIndexCoord_GetComponentStates_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetComponentStates'
type MockIndexCoord_GetComponentStates_Call struct {
*mock.Call
}
// GetComponentStates is a helper method to define mock.On call
// - ctx context.Context
func (_e *MockIndexCoord_Expecter) GetComponentStates(ctx interface{}) *MockIndexCoord_GetComponentStates_Call {
return &MockIndexCoord_GetComponentStates_Call{Call: _e.mock.On("GetComponentStates", ctx)}
}
func (_c *MockIndexCoord_GetComponentStates_Call) Run(run func(ctx context.Context)) *MockIndexCoord_GetComponentStates_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *MockIndexCoord_GetComponentStates_Call) Return(_a0 *milvuspb.ComponentStates, _a1 error) *MockIndexCoord_GetComponentStates_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// GetIndexBuildProgress provides a mock function with given fields: ctx, req
func (_m *MockIndexCoord) GetIndexBuildProgress(ctx context.Context, req *datapb.GetIndexBuildProgressRequest) (*datapb.GetIndexBuildProgressResponse, error) {
ret := _m.Called(ctx, req)
var r0 *datapb.GetIndexBuildProgressResponse
if rf, ok := ret.Get(0).(func(context.Context, *datapb.GetIndexBuildProgressRequest) *datapb.GetIndexBuildProgressResponse); ok {
r0 = rf(ctx, req)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*datapb.GetIndexBuildProgressResponse)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *datapb.GetIndexBuildProgressRequest) error); ok {
r1 = rf(ctx, req)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockIndexCoord_GetIndexBuildProgress_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetIndexBuildProgress'
type MockIndexCoord_GetIndexBuildProgress_Call struct {
*mock.Call
}
// GetIndexBuildProgress is a helper method to define mock.On call
// - ctx context.Context
// - req *datapb.GetIndexBuildProgressRequest
func (_e *MockIndexCoord_Expecter) GetIndexBuildProgress(ctx interface{}, req interface{}) *MockIndexCoord_GetIndexBuildProgress_Call {
return &MockIndexCoord_GetIndexBuildProgress_Call{Call: _e.mock.On("GetIndexBuildProgress", ctx, req)}
}
func (_c *MockIndexCoord_GetIndexBuildProgress_Call) Run(run func(ctx context.Context, req *datapb.GetIndexBuildProgressRequest)) *MockIndexCoord_GetIndexBuildProgress_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*datapb.GetIndexBuildProgressRequest))
})
return _c
}
func (_c *MockIndexCoord_GetIndexBuildProgress_Call) Return(_a0 *datapb.GetIndexBuildProgressResponse, _a1 error) *MockIndexCoord_GetIndexBuildProgress_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// GetIndexInfos provides a mock function with given fields: ctx, req
func (_m *MockIndexCoord) GetIndexInfos(ctx context.Context, req *datapb.GetIndexInfoRequest) (*datapb.GetIndexInfoResponse, error) {
ret := _m.Called(ctx, req)
var r0 *datapb.GetIndexInfoResponse
if rf, ok := ret.Get(0).(func(context.Context, *datapb.GetIndexInfoRequest) *datapb.GetIndexInfoResponse); ok {
r0 = rf(ctx, req)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*datapb.GetIndexInfoResponse)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *datapb.GetIndexInfoRequest) error); ok {
r1 = rf(ctx, req)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockIndexCoord_GetIndexInfos_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetIndexInfos'
type MockIndexCoord_GetIndexInfos_Call struct {
*mock.Call
}
// GetIndexInfos is a helper method to define mock.On call
// - ctx context.Context
// - req *datapb.GetIndexInfoRequest
func (_e *MockIndexCoord_Expecter) GetIndexInfos(ctx interface{}, req interface{}) *MockIndexCoord_GetIndexInfos_Call {
return &MockIndexCoord_GetIndexInfos_Call{Call: _e.mock.On("GetIndexInfos", ctx, req)}
}
func (_c *MockIndexCoord_GetIndexInfos_Call) Run(run func(ctx context.Context, req *datapb.GetIndexInfoRequest)) *MockIndexCoord_GetIndexInfos_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*datapb.GetIndexInfoRequest))
})
return _c
}
func (_c *MockIndexCoord_GetIndexInfos_Call) Return(_a0 *datapb.GetIndexInfoResponse, _a1 error) *MockIndexCoord_GetIndexInfos_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// GetIndexState provides a mock function with given fields: ctx, req
func (_m *MockIndexCoord) GetIndexState(ctx context.Context, req *datapb.GetIndexStateRequest) (*datapb.GetIndexStateResponse, error) {
ret := _m.Called(ctx, req)
var r0 *datapb.GetIndexStateResponse
if rf, ok := ret.Get(0).(func(context.Context, *datapb.GetIndexStateRequest) *datapb.GetIndexStateResponse); ok {
r0 = rf(ctx, req)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*datapb.GetIndexStateResponse)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *datapb.GetIndexStateRequest) error); ok {
r1 = rf(ctx, req)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockIndexCoord_GetIndexState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetIndexState'
type MockIndexCoord_GetIndexState_Call struct {
*mock.Call
}
// GetIndexState is a helper method to define mock.On call
// - ctx context.Context
// - req *datapb.GetIndexStateRequest
func (_e *MockIndexCoord_Expecter) GetIndexState(ctx interface{}, req interface{}) *MockIndexCoord_GetIndexState_Call {
return &MockIndexCoord_GetIndexState_Call{Call: _e.mock.On("GetIndexState", ctx, req)}
}
func (_c *MockIndexCoord_GetIndexState_Call) Run(run func(ctx context.Context, req *datapb.GetIndexStateRequest)) *MockIndexCoord_GetIndexState_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*datapb.GetIndexStateRequest))
})
return _c
}
func (_c *MockIndexCoord_GetIndexState_Call) Return(_a0 *datapb.GetIndexStateResponse, _a1 error) *MockIndexCoord_GetIndexState_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// GetMetrics provides a mock function with given fields: ctx, req
func (_m *MockIndexCoord) GetMetrics(ctx context.Context, req *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) {
ret := _m.Called(ctx, req)
var r0 *milvuspb.GetMetricsResponse
if rf, ok := ret.Get(0).(func(context.Context, *milvuspb.GetMetricsRequest) *milvuspb.GetMetricsResponse); ok {
r0 = rf(ctx, req)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*milvuspb.GetMetricsResponse)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *milvuspb.GetMetricsRequest) error); ok {
r1 = rf(ctx, req)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockIndexCoord_GetMetrics_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMetrics'
type MockIndexCoord_GetMetrics_Call struct {
*mock.Call
}
// GetMetrics is a helper method to define mock.On call
// - ctx context.Context
// - req *milvuspb.GetMetricsRequest
func (_e *MockIndexCoord_Expecter) GetMetrics(ctx interface{}, req interface{}) *MockIndexCoord_GetMetrics_Call {
return &MockIndexCoord_GetMetrics_Call{Call: _e.mock.On("GetMetrics", ctx, req)}
}
func (_c *MockIndexCoord_GetMetrics_Call) Run(run func(ctx context.Context, req *milvuspb.GetMetricsRequest)) *MockIndexCoord_GetMetrics_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*milvuspb.GetMetricsRequest))
})
return _c
}
func (_c *MockIndexCoord_GetMetrics_Call) Return(_a0 *milvuspb.GetMetricsResponse, _a1 error) *MockIndexCoord_GetMetrics_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// GetSegmentIndexState provides a mock function with given fields: ctx, req
func (_m *MockIndexCoord) GetSegmentIndexState(ctx context.Context, req *datapb.GetSegmentIndexStateRequest) (*datapb.GetSegmentIndexStateResponse, error) {
ret := _m.Called(ctx, req)
var r0 *datapb.GetSegmentIndexStateResponse
if rf, ok := ret.Get(0).(func(context.Context, *datapb.GetSegmentIndexStateRequest) *datapb.GetSegmentIndexStateResponse); ok {
r0 = rf(ctx, req)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*datapb.GetSegmentIndexStateResponse)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *datapb.GetSegmentIndexStateRequest) error); ok {
r1 = rf(ctx, req)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockIndexCoord_GetSegmentIndexState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSegmentIndexState'
type MockIndexCoord_GetSegmentIndexState_Call struct {
*mock.Call
}
// GetSegmentIndexState is a helper method to define mock.On call
// - ctx context.Context
// - req *datapb.GetSegmentIndexStateRequest
func (_e *MockIndexCoord_Expecter) GetSegmentIndexState(ctx interface{}, req interface{}) *MockIndexCoord_GetSegmentIndexState_Call {
return &MockIndexCoord_GetSegmentIndexState_Call{Call: _e.mock.On("GetSegmentIndexState", ctx, req)}
}
func (_c *MockIndexCoord_GetSegmentIndexState_Call) Run(run func(ctx context.Context, req *datapb.GetSegmentIndexStateRequest)) *MockIndexCoord_GetSegmentIndexState_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*datapb.GetSegmentIndexStateRequest))
})
return _c
}
func (_c *MockIndexCoord_GetSegmentIndexState_Call) Return(_a0 *datapb.GetSegmentIndexStateResponse, _a1 error) *MockIndexCoord_GetSegmentIndexState_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// GetStatisticsChannel provides a mock function with given fields: ctx
func (_m *MockIndexCoord) GetStatisticsChannel(ctx context.Context) (*milvuspb.StringResponse, error) {
ret := _m.Called(ctx)
var r0 *milvuspb.StringResponse
if rf, ok := ret.Get(0).(func(context.Context) *milvuspb.StringResponse); ok {
r0 = rf(ctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*milvuspb.StringResponse)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(ctx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockIndexCoord_GetStatisticsChannel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStatisticsChannel'
type MockIndexCoord_GetStatisticsChannel_Call struct {
*mock.Call
}
// GetStatisticsChannel is a helper method to define mock.On call
// - ctx context.Context
func (_e *MockIndexCoord_Expecter) GetStatisticsChannel(ctx interface{}) *MockIndexCoord_GetStatisticsChannel_Call {
return &MockIndexCoord_GetStatisticsChannel_Call{Call: _e.mock.On("GetStatisticsChannel", ctx)}
}
func (_c *MockIndexCoord_GetStatisticsChannel_Call) Run(run func(ctx context.Context)) *MockIndexCoord_GetStatisticsChannel_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *MockIndexCoord_GetStatisticsChannel_Call) Return(_a0 *milvuspb.StringResponse, _a1 error) *MockIndexCoord_GetStatisticsChannel_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// Init provides a mock function with given fields:
func (_m *MockIndexCoord) Init() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// MockIndexCoord_Init_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Init'
type MockIndexCoord_Init_Call struct {
*mock.Call
}
// Init is a helper method to define mock.On call
func (_e *MockIndexCoord_Expecter) Init() *MockIndexCoord_Init_Call {
return &MockIndexCoord_Init_Call{Call: _e.mock.On("Init")}
}
func (_c *MockIndexCoord_Init_Call) Run(run func()) *MockIndexCoord_Init_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockIndexCoord_Init_Call) Return(_a0 error) *MockIndexCoord_Init_Call {
_c.Call.Return(_a0)
return _c
}
// Register provides a mock function with given fields:
func (_m *MockIndexCoord) Register() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// MockIndexCoord_Register_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Register'
type MockIndexCoord_Register_Call struct {
*mock.Call
}
// Register is a helper method to define mock.On call
func (_e *MockIndexCoord_Expecter) Register() *MockIndexCoord_Register_Call {
return &MockIndexCoord_Register_Call{Call: _e.mock.On("Register")}
}
func (_c *MockIndexCoord_Register_Call) Run(run func()) *MockIndexCoord_Register_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockIndexCoord_Register_Call) Return(_a0 error) *MockIndexCoord_Register_Call {
_c.Call.Return(_a0)
return _c
}
// ShowConfigurations provides a mock function with given fields: ctx, req
func (_m *MockIndexCoord) ShowConfigurations(ctx context.Context, req *internalpb.ShowConfigurationsRequest) (*internalpb.ShowConfigurationsResponse, error) {
ret := _m.Called(ctx, req)
var r0 *internalpb.ShowConfigurationsResponse
if rf, ok := ret.Get(0).(func(context.Context, *internalpb.ShowConfigurationsRequest) *internalpb.ShowConfigurationsResponse); ok {
r0 = rf(ctx, req)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*internalpb.ShowConfigurationsResponse)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *internalpb.ShowConfigurationsRequest) error); ok {
r1 = rf(ctx, req)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockIndexCoord_ShowConfigurations_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ShowConfigurations'
type MockIndexCoord_ShowConfigurations_Call struct {
*mock.Call
}
// ShowConfigurations is a helper method to define mock.On call
// - ctx context.Context
// - req *internalpb.ShowConfigurationsRequest
func (_e *MockIndexCoord_Expecter) ShowConfigurations(ctx interface{}, req interface{}) *MockIndexCoord_ShowConfigurations_Call {
return &MockIndexCoord_ShowConfigurations_Call{Call: _e.mock.On("ShowConfigurations", ctx, req)}
}
func (_c *MockIndexCoord_ShowConfigurations_Call) Run(run func(ctx context.Context, req *internalpb.ShowConfigurationsRequest)) *MockIndexCoord_ShowConfigurations_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*internalpb.ShowConfigurationsRequest))
})
return _c
}
func (_c *MockIndexCoord_ShowConfigurations_Call) Return(_a0 *internalpb.ShowConfigurationsResponse, _a1 error) *MockIndexCoord_ShowConfigurations_Call {
_c.Call.Return(_a0, _a1)
return _c
}
// Start provides a mock function with given fields:
func (_m *MockIndexCoord) Start() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// MockIndexCoord_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'
type MockIndexCoord_Start_Call struct {
*mock.Call
}
// Start is a helper method to define mock.On call
func (_e *MockIndexCoord_Expecter) Start() *MockIndexCoord_Start_Call {
return &MockIndexCoord_Start_Call{Call: _e.mock.On("Start")}
}
func (_c *MockIndexCoord_Start_Call) Run(run func()) *MockIndexCoord_Start_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockIndexCoord_Start_Call) Return(_a0 error) *MockIndexCoord_Start_Call {
_c.Call.Return(_a0)
return _c
}
// Stop provides a mock function with given fields:
func (_m *MockIndexCoord) Stop() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// MockIndexCoord_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'
type MockIndexCoord_Stop_Call struct {
*mock.Call
}
// Stop is a helper method to define mock.On call
func (_e *MockIndexCoord_Expecter) Stop() *MockIndexCoord_Stop_Call {
return &MockIndexCoord_Stop_Call{Call: _e.mock.On("Stop")}
}
func (_c *MockIndexCoord_Stop_Call) Run(run func()) *MockIndexCoord_Stop_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockIndexCoord_Stop_Call) Return(_a0 error) *MockIndexCoord_Stop_Call {
_c.Call.Return(_a0)
return _c
}
type mockConstructorTestingTNewMockIndexCoord interface {
mock.TestingT
Cleanup(func())
}
// NewMockIndexCoord creates a new instance of MockIndexCoord. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewMockIndexCoord(t mockConstructorTestingTNewMockIndexCoord) *MockIndexCoord {
mock := &MockIndexCoord{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

View File

@ -8,6 +8,7 @@ import "common.proto";
import "internal.proto";
import "milvus.proto";
import "schema.proto";
import "index_coord.proto";
// TODO: import google/protobuf/empty.proto
message Empty {}
@ -67,15 +68,15 @@ service DataCoord {
rpc CheckHealth(milvus.CheckHealthRequest) returns (milvus.CheckHealthResponse) {}
rpc CreateIndex(CreateIndexRequest) returns (common.Status){}
rpc CreateIndex(index.CreateIndexRequest) returns (common.Status){}
// Deprecated: use DescribeIndex instead
rpc GetIndexState(GetIndexStateRequest) returns (GetIndexStateResponse) {}
rpc GetSegmentIndexState(GetSegmentIndexStateRequest) returns (GetSegmentIndexStateResponse) {}
rpc GetIndexInfos(GetIndexInfoRequest) returns (GetIndexInfoResponse){}
rpc DropIndex(DropIndexRequest) returns (common.Status) {}
rpc DescribeIndex(DescribeIndexRequest) returns (DescribeIndexResponse) {}
rpc GetIndexState(index.GetIndexStateRequest) returns (index.GetIndexStateResponse) {}
rpc GetSegmentIndexState(index.GetSegmentIndexStateRequest) returns (index.GetSegmentIndexStateResponse) {}
rpc GetIndexInfos(index.GetIndexInfoRequest) returns (index.GetIndexInfoResponse){}
rpc DropIndex(index.DropIndexRequest) returns (common.Status) {}
rpc DescribeIndex(index.DescribeIndexRequest) returns (index.DescribeIndexResponse) {}
// Deprecated: use DescribeIndex instead
rpc GetIndexBuildProgress(GetIndexBuildProgressRequest) returns (GetIndexBuildProgressResponse) {}
rpc GetIndexBuildProgress(index.GetIndexBuildProgressRequest) returns (index.GetIndexBuildProgressResponse) {}
}
service DataNode {
@ -214,20 +215,6 @@ message GetPartitionStatisticsResponse {
message GetSegmentInfoChannelRequest {
}
message AcquireSegmentLockRequest {
common.MsgBase base = 1;
int64 nodeID = 2;
repeated int64 segmentIDs = 3;
int64 taskID = 4;
}
message ReleaseSegmentLockRequest {
common.MsgBase base = 1;
int64 nodeID = 2;
repeated int64 segmentIDs = 3;
int64 taskID = 4;
}
message VchannelInfo {
int64 collectionID = 1;
string channelName = 2;
@ -656,142 +643,142 @@ message AlterCollectionRequest {
repeated common.KeyValuePair properties = 5;
}
message IndexInfo {
int64 collectionID = 1;
int64 fieldID = 2;
string index_name = 3;
int64 indexID = 4;
repeated common.KeyValuePair type_params = 5;
repeated common.KeyValuePair index_params = 6;
// index build progress
// The real-time statistics may not be expected due to the existence of the compaction mechanism.
int64 indexed_rows = 7;
int64 total_rows = 8;
// index state
common.IndexState state = 9;
string index_state_fail_reason = 10;
bool is_auto_index = 11;
repeated common.KeyValuePair user_index_params = 12;
}
message FieldIndex {
IndexInfo index_info = 1;
bool deleted = 2;
uint64 create_time = 3;
}
message SegmentIndex {
int64 collectionID = 1;
int64 partitionID = 2;
int64 segmentID = 3;
int64 num_rows = 4;
int64 indexID = 5;
int64 buildID = 6;
int64 nodeID = 7;
int64 index_version = 8;
common.IndexState state = 9;
string fail_reason = 10;
repeated string index_file_keys = 11;
bool deleted = 12;
uint64 create_time = 13;
uint64 serialize_size = 14;
bool write_handoff = 15;
}
message GetIndexStateRequest {
int64 collectionID = 1;
string index_name = 2;
}
message GetIndexStateResponse {
common.Status status = 1;
common.IndexState state = 2;
string fail_reason = 3;
}
message GetSegmentIndexStateRequest {
int64 collectionID = 1;
string index_name = 2;
repeated int64 segmentIDs = 3;
}
message SegmentIndexState {
int64 segmentID = 1;
common.IndexState state = 2;
string fail_reason = 3;
}
message GetSegmentIndexStateResponse {
common.Status status = 1;
repeated SegmentIndexState states = 2;
}
message CreateIndexRequest {
int64 collectionID = 1;
int64 fieldID = 2;
string index_name = 3;
repeated common.KeyValuePair type_params = 4;
repeated common.KeyValuePair index_params = 5;
uint64 timestamp = 6;
bool is_auto_index = 7;
repeated common.KeyValuePair user_index_params = 8;
}
message GetIndexInfoRequest {
int64 collectionID = 1;
repeated int64 segmentIDs = 2;
string index_name = 3;
}
message IndexFilePathInfo {
int64 segmentID = 1;
int64 fieldID = 2;
int64 indexID = 3;
int64 buildID = 4;
string index_name = 5;
repeated common.KeyValuePair index_params = 6;
repeated string index_file_paths = 7;
uint64 serialized_size = 8;
int64 index_version = 9;
int64 num_rows = 10;
}
message SegmentIndexInfo {
int64 collectionID = 1;
int64 segmentID = 2;
bool enable_index = 3;
repeated IndexFilePathInfo index_infos = 4;
}
message GetIndexInfoResponse {
common.Status status = 1;
map<int64, SegmentIndexInfo> segment_info = 2;
}
message DropIndexRequest {
int64 collectionID = 1;
repeated int64 partitionIDs = 2;
string index_name = 3;
bool drop_all = 4;
}
message DescribeIndexRequest {
int64 collectionID = 1;
string index_name = 2;
}
message DescribeIndexResponse {
common.Status status = 1;
repeated IndexInfo index_infos = 2;
}
message GetIndexBuildProgressRequest {
int64 collectionID = 1;
string index_name = 2;
}
message GetIndexBuildProgressResponse {
common.Status status = 1;
int64 indexed_rows = 2;
int64 total_rows = 3;
}
//message IndexInfo {
// int64 collectionID = 1;
// int64 fieldID = 2;
// string index_name = 3;
// int64 indexID = 4;
// repeated common.KeyValuePair type_params = 5;
// repeated common.KeyValuePair index_params = 6;
// // index build progress
// // The real-time statistics may not be expected due to the existence of the compaction mechanism.
// int64 indexed_rows = 7;
// int64 total_rows = 8;
// // index state
// common.IndexState state = 9;
// string index_state_fail_reason = 10;
// bool is_auto_index = 11;
// repeated common.KeyValuePair user_index_params = 12;
//}
//
//message FieldIndex {
// IndexInfo index_info = 1;
// bool deleted = 2;
// uint64 create_time = 3;
//}
//
//message SegmentIndex {
// int64 collectionID = 1;
// int64 partitionID = 2;
// int64 segmentID = 3;
// int64 num_rows = 4;
// int64 indexID = 5;
// int64 buildID = 6;
// int64 nodeID = 7;
// int64 index_version = 8;
// common.IndexState state = 9;
// string fail_reason = 10;
// repeated string index_file_keys = 11;
// bool deleted = 12;
// uint64 create_time = 13;
// uint64 serialize_size = 14;
// bool write_handoff = 15;
//}
//
//message GetIndexStateRequest {
// int64 collectionID = 1;
// string index_name = 2;
//}
//
//message GetIndexStateResponse {
// common.Status status = 1;
// common.IndexState state = 2;
// string fail_reason = 3;
//}
//
//message GetSegmentIndexStateRequest {
// int64 collectionID = 1;
// string index_name = 2;
// repeated int64 segmentIDs = 3;
//}
//
//message SegmentIndexState {
// int64 segmentID = 1;
// common.IndexState state = 2;
// string fail_reason = 3;
//}
//
//message GetSegmentIndexStateResponse {
// common.Status status = 1;
// repeated SegmentIndexState states = 2;
//}
//
//message CreateIndexRequest {
// int64 collectionID = 1;
// int64 fieldID = 2;
// string index_name = 3;
// repeated common.KeyValuePair type_params = 4;
// repeated common.KeyValuePair index_params = 5;
// uint64 timestamp = 6;
// bool is_auto_index = 7;
// repeated common.KeyValuePair user_index_params = 8;
//}
//
//message GetIndexInfoRequest {
// int64 collectionID = 1;
// repeated int64 segmentIDs = 2;
// string index_name = 3;
//}
//
//message IndexFilePathInfo {
// int64 segmentID = 1;
// int64 fieldID = 2;
// int64 indexID = 3;
// int64 buildID = 4;
// string index_name = 5;
// repeated common.KeyValuePair index_params = 6;
// repeated string index_file_paths = 7;
// uint64 serialized_size = 8;
// int64 index_version = 9;
// int64 num_rows = 10;
//}
//
//message SegmentIndexInfo {
// int64 collectionID = 1;
// int64 segmentID = 2;
// bool enable_index = 3;
// repeated IndexFilePathInfo index_infos = 4;
//}
//
//message GetIndexInfoResponse {
// common.Status status = 1;
// map<int64, SegmentIndexInfo> segment_info = 2;
//}
//
//message DropIndexRequest {
// int64 collectionID = 1;
// repeated int64 partitionIDs = 2;
// string index_name = 3;
// bool drop_all = 4;
//}
//
//message DescribeIndexRequest {
// int64 collectionID = 1;
// string index_name = 2;
//}
//
//message DescribeIndexResponse {
// common.Status status = 1;
// repeated IndexInfo index_infos = 2;
//}
//
//message GetIndexBuildProgressRequest {
// int64 collectionID = 1;
// string index_name = 2;
//}
//
//message GetIndexBuildProgressResponse {
// common.Status status = 1;
// int64 indexed_rows = 2;
// int64 total_rows = 3;
//}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,265 @@
syntax = "proto3";
package milvus.proto.index;
option go_package = "github.com/milvus-io/milvus/internal/proto/indexpb";
import "common.proto";
import "internal.proto";
import "milvus.proto";
service IndexCoord {
rpc GetComponentStates(milvus.GetComponentStatesRequest) returns (milvus.ComponentStates) {}
rpc GetStatisticsChannel(internal.GetStatisticsChannelRequest) returns(milvus.StringResponse){}
rpc CreateIndex(CreateIndexRequest) returns (common.Status){}
// Deprecated: use DescribeIndex instead
rpc GetIndexState(GetIndexStateRequest) returns (GetIndexStateResponse) {}
rpc GetSegmentIndexState(GetSegmentIndexStateRequest) returns (GetSegmentIndexStateResponse) {}
rpc GetIndexInfos(GetIndexInfoRequest) returns (GetIndexInfoResponse){}
rpc DropIndex(DropIndexRequest) returns (common.Status) {}
rpc DescribeIndex(DescribeIndexRequest) returns (DescribeIndexResponse) {}
// Deprecated: use DescribeIndex instead
rpc GetIndexBuildProgress(GetIndexBuildProgressRequest) returns (GetIndexBuildProgressResponse) {}
rpc ShowConfigurations(internal.ShowConfigurationsRequest) returns (internal.ShowConfigurationsResponse){}
// https://wiki.lfaidata.foundation/display/MIL/MEP+8+--+Add+metrics+for+proxy
rpc GetMetrics(milvus.GetMetricsRequest) returns (milvus.GetMetricsResponse) {}
rpc CheckHealth(milvus.CheckHealthRequest) returns (milvus.CheckHealthResponse) {}
}
service IndexNode {
rpc GetComponentStates(milvus.GetComponentStatesRequest) returns (milvus.ComponentStates) {}
rpc GetStatisticsChannel(internal.GetStatisticsChannelRequest) returns(milvus.StringResponse){}
rpc CreateJob(CreateJobRequest) returns (common.Status) {}
rpc QueryJobs(QueryJobsRequest) returns (QueryJobsResponse) {}
rpc DropJobs(DropJobsRequest) returns (common.Status) {}
rpc GetJobStats(GetJobStatsRequest) returns (GetJobStatsResponse) {}
rpc ShowConfigurations(internal.ShowConfigurationsRequest) returns (internal.ShowConfigurationsResponse){}
// https://wiki.lfaidata.foundation/display/MIL/MEP+8+--+Add+metrics+for+proxy
rpc GetMetrics(milvus.GetMetricsRequest) returns (milvus.GetMetricsResponse) {}
}
message IndexInfo {
int64 collectionID = 1;
int64 fieldID = 2;
string index_name = 3;
int64 indexID = 4;
repeated common.KeyValuePair type_params = 5;
repeated common.KeyValuePair index_params = 6;
// index build progress
// The real-time statistics may not be expected due to the existence of the compaction mechanism.
int64 indexed_rows = 7;
int64 total_rows = 8;
// index state
common.IndexState state = 9;
string index_state_fail_reason = 10;
bool is_auto_index = 11;
repeated common.KeyValuePair user_index_params = 12;
}
message FieldIndex {
IndexInfo index_info = 1;
bool deleted = 2;
uint64 create_time = 3;
}
message SegmentIndex {
int64 collectionID = 1;
int64 partitionID = 2;
int64 segmentID = 3;
int64 num_rows = 4;
int64 indexID = 5;
int64 buildID = 6;
int64 nodeID = 7;
int64 index_version = 8;
common.IndexState state = 9;
string fail_reason = 10;
repeated string index_file_keys = 11;
bool deleted = 12;
uint64 create_time = 13;
uint64 serialize_size = 14;
bool write_handoff = 15;
}
message RegisterNodeRequest {
common.MsgBase base = 1;
common.Address address = 2;
int64 nodeID = 3;
}
message RegisterNodeResponse {
common.Status status = 1;
internal.InitParams init_params = 2;
}
message GetIndexStateRequest {
int64 collectionID = 1;
string index_name = 2;
}
message GetIndexStateResponse {
common.Status status = 1;
common.IndexState state = 2;
string fail_reason = 3;
}
message GetSegmentIndexStateRequest {
int64 collectionID = 1;
string index_name = 2;
repeated int64 segmentIDs = 3;
}
message SegmentIndexState {
int64 segmentID = 1;
common.IndexState state = 2;
string fail_reason = 3;
}
message GetSegmentIndexStateResponse {
common.Status status = 1;
repeated SegmentIndexState states = 2;
}
message CreateIndexRequest {
int64 collectionID = 1;
int64 fieldID = 2;
string index_name = 3;
repeated common.KeyValuePair type_params = 4;
repeated common.KeyValuePair index_params = 5;
uint64 timestamp = 6;
bool is_auto_index = 7;
repeated common.KeyValuePair user_index_params = 8;
}
message GetIndexInfoRequest {
int64 collectionID = 1;
repeated int64 segmentIDs = 2;
string index_name = 3;
}
message IndexFilePathInfo {
int64 segmentID = 1;
int64 fieldID = 2;
int64 indexID = 3;
int64 buildID = 4;
string index_name = 5;
repeated common.KeyValuePair index_params = 6;
repeated string index_file_paths = 7;
uint64 serialized_size = 8;
int64 index_version = 9;
int64 num_rows = 10;
}
message SegmentInfo {
int64 collectionID = 1;
int64 segmentID = 2;
bool enable_index = 3;
repeated IndexFilePathInfo index_infos = 4;
}
message GetIndexInfoResponse {
common.Status status = 1;
map<int64, SegmentInfo> segment_info = 2;
}
message DropIndexRequest {
int64 collectionID = 1;
repeated int64 partitionIDs = 2;
string index_name = 3;
bool drop_all = 4;
}
message DescribeIndexRequest {
int64 collectionID = 1;
string index_name = 2;
}
message DescribeIndexResponse {
common.Status status = 1;
repeated IndexInfo index_infos = 2;
}
message GetIndexBuildProgressRequest {
int64 collectionID = 1;
string index_name = 2;
}
message GetIndexBuildProgressResponse {
common.Status status = 1;
int64 indexed_rows = 2;
int64 total_rows = 3;
}
message StorageConfig {
string address = 1;
string access_keyID = 2;
string secret_access_key = 3;
bool useSSL = 4;
string bucket_name = 5;
string root_path = 6;
bool useIAM = 7;
string IAMEndpoint = 8;
string storage_type = 9;
}
message CreateJobRequest {
string clusterID = 1;
string index_file_prefix = 2;
int64 buildID = 3;
repeated string data_paths = 4;
int64 index_version = 5;
int64 indexID = 6;
string index_name = 7;
StorageConfig storage_config = 8;
repeated common.KeyValuePair index_params = 9;
repeated common.KeyValuePair type_params = 10;
int64 num_rows = 11;
}
message QueryJobsRequest {
string clusterID = 1;
repeated int64 buildIDs = 2;
}
message IndexTaskInfo {
int64 buildID = 1;
common.IndexState state = 2;
repeated string index_file_keys = 3;
uint64 serialized_size = 4;
string fail_reason = 5;
}
message QueryJobsResponse {
common.Status status = 1;
string clusterID = 2;
repeated IndexTaskInfo index_infos = 3;
}
message DropJobsRequest {
string clusterID = 1;
repeated int64 buildIDs = 2;
}
message JobInfo {
int64 num_rows = 1;
int64 dim = 2;
int64 start_time = 3;
int64 end_time = 4;
repeated common.KeyValuePair index_params = 5;
int64 podID = 6;
}
message GetJobStatsRequest {
}
message GetJobStatsResponse {
common.Status status = 1;
int64 total_job_num = 2;
int64 in_progress_job_num = 3;
int64 enqueue_job_num = 4;
int64 task_slots = 5;
repeated JobInfo job_infos = 6;
bool enable_disk = 7;
}

View File

@ -1,94 +0,0 @@
syntax = "proto3";
package milvus.proto.index;
option go_package = "github.com/milvus-io/milvus/internal/proto/indexpb";
import "common.proto";
import "internal.proto";
import "milvus.proto";
service IndexNode {
rpc GetComponentStates(milvus.GetComponentStatesRequest) returns (milvus.ComponentStates) {}
rpc GetStatisticsChannel(internal.GetStatisticsChannelRequest) returns(milvus.StringResponse){}
rpc CreateJob(CreateJobRequest) returns (common.Status) {}
rpc QueryJobs(QueryJobsRequest) returns (QueryJobsResponse) {}
rpc DropJobs(DropJobsRequest) returns (common.Status) {}
rpc GetJobStats(GetJobStatsRequest) returns (GetJobStatsResponse) {}
rpc ShowConfigurations(internal.ShowConfigurationsRequest) returns (internal.ShowConfigurationsResponse){}
// https://wiki.lfaidata.foundation/display/MIL/MEP+8+--+Add+metrics+for+proxy
rpc GetMetrics(milvus.GetMetricsRequest) returns (milvus.GetMetricsResponse) {}
}
message StorageConfig {
string address = 1;
string access_keyID = 2;
string secret_access_key = 3;
bool useSSL = 4;
string bucket_name = 5;
string root_path = 6;
bool useIAM = 7;
string IAMEndpoint = 8;
string storage_type = 9;
}
message CreateJobRequest {
string clusterID = 1;
string index_file_prefix = 2;
int64 buildID = 3;
repeated string data_paths = 4;
int64 index_version = 5;
int64 indexID = 6;
string index_name = 7;
StorageConfig storage_config = 8;
repeated common.KeyValuePair index_params = 9;
repeated common.KeyValuePair type_params = 10;
int64 num_rows = 11;
}
message QueryJobsRequest {
string clusterID = 1;
repeated int64 buildIDs = 2;
}
message IndexTaskInfo {
int64 buildID = 1;
common.IndexState state = 2;
repeated string index_file_keys = 3;
uint64 serialized_size = 4;
string fail_reason = 5;
}
message QueryJobsResponse {
common.Status status = 1;
string clusterID = 2;
repeated IndexTaskInfo index_infos = 3;
}
message DropJobsRequest {
string clusterID = 1;
repeated int64 buildIDs = 2;
}
message JobInfo {
int64 num_rows = 1;
int64 dim = 2;
int64 start_time = 3;
int64 end_time = 4;
repeated common.KeyValuePair index_params = 5;
int64 podID = 6;
}
message GetJobStatsRequest {
}
message GetJobStatsResponse {
common.Status status = 1;
int64 total_job_num = 2;
int64 in_progress_job_num = 3;
int64 enqueue_job_num = 4;
int64 task_slots = 5;
repeated JobInfo job_infos = 6;
bool enable_disk = 7;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,8 @@ import (
"context"
"sync/atomic"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
"github.com/milvus-io/milvus/internal/proto/datapb"
@ -40,8 +42,8 @@ type DataCoordMock struct {
statisticsChannel string
timeTickChannel string
checkHealthFunc func(ctx context.Context, req *milvuspb.CheckHealthRequest) (*milvuspb.CheckHealthResponse, error)
GetIndexStateFunc func(ctx context.Context, request *datapb.GetIndexStateRequest) (*datapb.GetIndexStateResponse, error)
DescribeIndexFunc func(ctx context.Context, request *datapb.DescribeIndexRequest) (*datapb.DescribeIndexResponse, error)
GetIndexStateFunc func(ctx context.Context, request *indexpb.GetIndexStateRequest) (*indexpb.GetIndexStateResponse, error)
DescribeIndexFunc func(ctx context.Context, request *indexpb.DescribeIndexRequest) (*indexpb.DescribeIndexResponse, error)
}
func (coord *DataCoordMock) updateState(state commonpb.StateCode) {
@ -280,22 +282,22 @@ func (coord *DataCoordMock) UpdateChannelCheckpoint(ctx context.Context, req *da
}, nil
}
func (coord *DataCoordMock) CreateIndex(ctx context.Context, req *datapb.CreateIndexRequest) (*commonpb.Status, error) {
func (coord *DataCoordMock) CreateIndex(ctx context.Context, req *indexpb.CreateIndexRequest) (*commonpb.Status, error) {
return &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
Reason: "",
}, nil
}
func (coord *DataCoordMock) DropIndex(ctx context.Context, req *datapb.DropIndexRequest) (*commonpb.Status, error) {
func (coord *DataCoordMock) DropIndex(ctx context.Context, req *indexpb.DropIndexRequest) (*commonpb.Status, error) {
return &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
Reason: "",
}, nil
}
func (coord *DataCoordMock) GetIndexState(ctx context.Context, req *datapb.GetIndexStateRequest) (*datapb.GetIndexStateResponse, error) {
return &datapb.GetIndexStateResponse{
func (coord *DataCoordMock) GetIndexState(ctx context.Context, req *indexpb.GetIndexStateRequest) (*indexpb.GetIndexStateResponse, error) {
return &indexpb.GetIndexStateResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
Reason: "",
@ -306,8 +308,8 @@ func (coord *DataCoordMock) GetIndexState(ctx context.Context, req *datapb.GetIn
}
// GetSegmentIndexState gets the index state of the segments in the request from RootCoord.
func (coord *DataCoordMock) GetSegmentIndexState(ctx context.Context, req *datapb.GetSegmentIndexStateRequest) (*datapb.GetSegmentIndexStateResponse, error) {
return &datapb.GetSegmentIndexStateResponse{
func (coord *DataCoordMock) GetSegmentIndexState(ctx context.Context, req *indexpb.GetSegmentIndexStateRequest) (*indexpb.GetSegmentIndexStateResponse, error) {
return &indexpb.GetSegmentIndexStateResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
Reason: "",
@ -316,8 +318,8 @@ func (coord *DataCoordMock) GetSegmentIndexState(ctx context.Context, req *datap
}
// GetIndexInfos gets the index files of the IndexBuildIDs in the request from RootCoordinator.
func (coord *DataCoordMock) GetIndexInfos(ctx context.Context, req *datapb.GetIndexInfoRequest) (*datapb.GetIndexInfoResponse, error) {
return &datapb.GetIndexInfoResponse{
func (coord *DataCoordMock) GetIndexInfos(ctx context.Context, req *indexpb.GetIndexInfoRequest) (*indexpb.GetIndexInfoResponse, error) {
return &indexpb.GetIndexInfoResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
Reason: "",
@ -326,8 +328,8 @@ func (coord *DataCoordMock) GetIndexInfos(ctx context.Context, req *datapb.GetIn
}
// DescribeIndex describe the index info of the collection.
func (coord *DataCoordMock) DescribeIndex(ctx context.Context, req *datapb.DescribeIndexRequest) (*datapb.DescribeIndexResponse, error) {
return &datapb.DescribeIndexResponse{
func (coord *DataCoordMock) DescribeIndex(ctx context.Context, req *indexpb.DescribeIndexRequest) (*indexpb.DescribeIndexResponse, error) {
return &indexpb.DescribeIndexResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
},
@ -336,8 +338,8 @@ func (coord *DataCoordMock) DescribeIndex(ctx context.Context, req *datapb.Descr
}
// GetIndexBuildProgress get the index building progress by num rows.
func (coord *DataCoordMock) GetIndexBuildProgress(ctx context.Context, req *datapb.GetIndexBuildProgressRequest) (*datapb.GetIndexBuildProgressResponse, error) {
return &datapb.GetIndexBuildProgressResponse{
func (coord *DataCoordMock) GetIndexBuildProgress(ctx context.Context, req *indexpb.GetIndexBuildProgressRequest) (*indexpb.GetIndexBuildProgressResponse, error) {
return &indexpb.GetIndexBuildProgressResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
},

View File

@ -22,6 +22,8 @@ import (
"fmt"
"math"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"go.uber.org/zap"
"github.com/golang/protobuf/proto"
@ -1323,7 +1325,7 @@ func (lct *loadCollectionTask) Execute(ctx context.Context) (err error) {
return err
}
// check index
indexResponse, err := lct.datacoord.DescribeIndex(ctx, &datapb.DescribeIndexRequest{
indexResponse, err := lct.datacoord.DescribeIndex(ctx, &indexpb.DescribeIndexRequest{
CollectionID: collID,
IndexName: "",
})
@ -1541,7 +1543,7 @@ func (lpt *loadPartitionsTask) Execute(ctx context.Context) error {
return err
}
// check index
indexResponse, err := lpt.datacoord.DescribeIndex(ctx, &datapb.DescribeIndexRequest{
indexResponse, err := lpt.datacoord.DescribeIndex(ctx, &indexpb.DescribeIndexRequest{
CollectionID: collID,
IndexName: "",
})

View File

@ -22,7 +22,7 @@ import (
"fmt"
"strconv"
"github.com/milvus-io/milvus/internal/proto/datapb"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"go.uber.org/zap"
@ -303,7 +303,7 @@ func (cit *createIndexTask) Execute(ctx context.Context) error {
cit.req.IndexName = Params.CommonCfg.DefaultIndexName.GetValue() + "_" + strconv.FormatInt(cit.fieldSchema.GetFieldID(), 10)
}
var err error
req := &datapb.CreateIndexRequest{
req := &indexpb.CreateIndexRequest{
CollectionID: cit.collectionID,
FieldID: cit.fieldSchema.GetFieldID(),
IndexName: cit.req.GetIndexName(),
@ -402,7 +402,7 @@ func (dit *describeIndexTask) Execute(ctx context.Context) error {
return fmt.Errorf("failed to parse collection schema: %s", err)
}
resp, err := dit.datacoord.DescribeIndex(ctx, &datapb.DescribeIndexRequest{CollectionID: dit.collectionID, IndexName: dit.IndexName})
resp, err := dit.datacoord.DescribeIndex(ctx, &indexpb.DescribeIndexRequest{CollectionID: dit.collectionID, IndexName: dit.IndexName})
if err != nil || resp == nil {
return err
}
@ -524,7 +524,7 @@ func (dit *dropIndexTask) PreExecute(ctx context.Context) error {
func (dit *dropIndexTask) Execute(ctx context.Context) error {
var err error
dit.result, err = dit.dataCoord.DropIndex(ctx, &datapb.DropIndexRequest{
dit.result, err = dit.dataCoord.DropIndex(ctx, &indexpb.DropIndexRequest{
CollectionID: dit.collectionID,
PartitionIDs: nil,
IndexName: dit.IndexName,
@ -615,7 +615,7 @@ func (gibpt *getIndexBuildProgressTask) Execute(ctx context.Context) error {
gibpt.IndexName = Params.CommonCfg.DefaultIndexName.GetValue()
}
resp, err := gibpt.dataCoord.GetIndexBuildProgress(ctx, &datapb.GetIndexBuildProgressRequest{
resp, err := gibpt.dataCoord.GetIndexBuildProgress(ctx, &indexpb.GetIndexBuildProgressRequest{
CollectionID: collectionID,
IndexName: gibpt.IndexName,
})
@ -706,7 +706,7 @@ func (gist *getIndexStateTask) Execute(ctx context.Context) error {
return err
}
state, err := gist.dataCoord.GetIndexState(ctx, &datapb.GetIndexStateRequest{
state, err := gist.dataCoord.GetIndexState(ctx, &indexpb.GetIndexStateRequest{
CollectionID: collectionID,
IndexName: gist.IndexName,
})

View File

@ -22,12 +22,13 @@ import (
"os"
"testing"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/stretchr/testify/assert"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
"github.com/milvus-io/milvus-proto/go-api/schemapb"
"github.com/milvus-io/milvus/internal/proto/datapb"
"github.com/milvus-io/milvus/internal/proto/querypb"
"github.com/milvus-io/milvus/internal/util/funcutil"
"github.com/milvus-io/milvus/internal/util/paramtable"
@ -86,8 +87,8 @@ func TestGetIndexStateTask_Execute(t *testing.T) {
}, nil
}
datacoord.GetIndexStateFunc = func(ctx context.Context, request *datapb.GetIndexStateRequest) (*datapb.GetIndexStateResponse, error) {
return &datapb.GetIndexStateResponse{
datacoord.GetIndexStateFunc = func(ctx context.Context, request *indexpb.GetIndexStateRequest) (*indexpb.GetIndexStateResponse, error) {
return &indexpb.GetIndexStateResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
},

View File

@ -27,6 +27,8 @@ import (
"testing"
"time"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/golang/protobuf/proto"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
@ -35,7 +37,6 @@ import (
"github.com/milvus-io/milvus/internal/common"
"github.com/milvus-io/milvus/internal/mocks"
"github.com/milvus-io/milvus/internal/mq/msgstream"
"github.com/milvus-io/milvus/internal/proto/datapb"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/proto/querypb"
"github.com/milvus-io/milvus/internal/util/distance"
@ -2398,8 +2399,8 @@ func Test_loadCollectionTask_Execute(t *testing.T) {
})
t.Run("indexcoord describe index not success", func(t *testing.T) {
dc.DescribeIndexFunc = func(ctx context.Context, request *datapb.DescribeIndexRequest) (*datapb.DescribeIndexResponse, error) {
return &datapb.DescribeIndexResponse{
dc.DescribeIndexFunc = func(ctx context.Context, request *indexpb.DescribeIndexRequest) (*indexpb.DescribeIndexResponse, error) {
return &indexpb.DescribeIndexResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: "fail reason",
@ -2412,12 +2413,12 @@ func Test_loadCollectionTask_Execute(t *testing.T) {
})
t.Run("no vector index", func(t *testing.T) {
dc.DescribeIndexFunc = func(ctx context.Context, request *datapb.DescribeIndexRequest) (*datapb.DescribeIndexResponse, error) {
return &datapb.DescribeIndexResponse{
dc.DescribeIndexFunc = func(ctx context.Context, request *indexpb.DescribeIndexRequest) (*indexpb.DescribeIndexResponse, error) {
return &indexpb.DescribeIndexResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
},
IndexInfos: []*datapb.IndexInfo{
IndexInfos: []*indexpb.IndexInfo{
{
CollectionID: collectionID,
FieldID: 100,
@ -2495,8 +2496,8 @@ func Test_loadPartitionTask_Execute(t *testing.T) {
})
t.Run("indexcoord describe index not success", func(t *testing.T) {
dc.DescribeIndexFunc = func(ctx context.Context, request *datapb.DescribeIndexRequest) (*datapb.DescribeIndexResponse, error) {
return &datapb.DescribeIndexResponse{
dc.DescribeIndexFunc = func(ctx context.Context, request *indexpb.DescribeIndexRequest) (*indexpb.DescribeIndexResponse, error) {
return &indexpb.DescribeIndexResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_UnexpectedError,
Reason: "fail reason",
@ -2509,12 +2510,12 @@ func Test_loadPartitionTask_Execute(t *testing.T) {
})
t.Run("no vector index", func(t *testing.T) {
dc.DescribeIndexFunc = func(ctx context.Context, request *datapb.DescribeIndexRequest) (*datapb.DescribeIndexResponse, error) {
return &datapb.DescribeIndexResponse{
dc.DescribeIndexFunc = func(ctx context.Context, request *indexpb.DescribeIndexRequest) (*indexpb.DescribeIndexResponse, error) {
return &indexpb.DescribeIndexResponse{
Status: &commonpb.Status{
ErrorCode: commonpb.ErrorCode_Success,
},
IndexInfos: []*datapb.IndexInfo{
IndexInfos: []*indexpb.IndexInfo{
{
CollectionID: collectionID,
FieldID: 100,

View File

@ -22,6 +22,8 @@ import (
"fmt"
"time"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
"github.com/milvus-io/milvus-proto/go-api/schemapb"
@ -163,7 +165,7 @@ func (broker *CoordinatorBroker) GetIndexInfo(ctx context.Context, collectionID
ctx, cancel := context.WithTimeout(ctx, brokerRPCTimeout)
defer cancel()
resp, err := broker.dataCoord.GetIndexInfos(ctx, &datapb.GetIndexInfoRequest{
resp, err := broker.dataCoord.GetIndexInfos(ctx, &indexpb.GetIndexInfoRequest{
CollectionID: collectionID,
SegmentIDs: []int64{segmentID},
})

View File

@ -5,20 +5,18 @@ import (
"errors"
"fmt"
"github.com/milvus-io/milvus/internal/metastore/model"
"github.com/milvus-io/milvus/internal/util/typeutil"
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
"github.com/milvus-io/milvus/internal/util/commonpbutil"
"github.com/milvus-io/milvus/internal/proto/datapb"
"go.uber.org/zap"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
"github.com/milvus-io/milvus-proto/go-api/schemapb"
"github.com/milvus-io/milvus/internal/log"
"github.com/milvus-io/milvus/internal/metastore/model"
"github.com/milvus-io/milvus/internal/proto/datapb"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/milvus-io/milvus/internal/proto/querypb"
"go.uber.org/zap"
"github.com/milvus-io/milvus/internal/util/commonpbutil"
"github.com/milvus-io/milvus/internal/util/typeutil"
)
type watchInfo struct {
@ -44,8 +42,8 @@ type Broker interface {
GetSegmentStates(context.Context, *datapb.GetSegmentStatesRequest) (*datapb.GetSegmentStatesResponse, error)
DropCollectionIndex(ctx context.Context, collID UniqueID, partIDs []UniqueID) error
GetSegmentIndexState(ctx context.Context, collID UniqueID, indexName string, segIDs []UniqueID) ([]*datapb.SegmentIndexState, error)
DescribeIndex(ctx context.Context, colID UniqueID) (*datapb.DescribeIndexResponse, error)
GetSegmentIndexState(ctx context.Context, collID UniqueID, indexName string, segIDs []UniqueID) ([]*indexpb.SegmentIndexState, error)
DescribeIndex(ctx context.Context, colID UniqueID) (*indexpb.DescribeIndexResponse, error)
BroadcastAlteredCollection(ctx context.Context, req *milvuspb.AlterCollectionRequest) error
}
@ -164,7 +162,7 @@ func (b *ServerBroker) GetSegmentStates(ctx context.Context, req *datapb.GetSegm
}
func (b *ServerBroker) DropCollectionIndex(ctx context.Context, collID UniqueID, partIDs []UniqueID) error {
rsp, err := b.s.dataCoord.DropIndex(ctx, &datapb.DropIndexRequest{
rsp, err := b.s.dataCoord.DropIndex(ctx, &indexpb.DropIndexRequest{
CollectionID: collID,
PartitionIDs: partIDs,
IndexName: "",
@ -179,8 +177,8 @@ func (b *ServerBroker) DropCollectionIndex(ctx context.Context, collID UniqueID,
return nil
}
func (b *ServerBroker) GetSegmentIndexState(ctx context.Context, collID UniqueID, indexName string, segIDs []UniqueID) ([]*datapb.SegmentIndexState, error) {
resp, err := b.s.dataCoord.GetSegmentIndexState(ctx, &datapb.GetSegmentIndexStateRequest{
func (b *ServerBroker) GetSegmentIndexState(ctx context.Context, collID UniqueID, indexName string, segIDs []UniqueID) ([]*indexpb.SegmentIndexState, error) {
resp, err := b.s.dataCoord.GetSegmentIndexState(ctx, &indexpb.GetSegmentIndexStateRequest{
CollectionID: collID,
IndexName: indexName,
SegmentIDs: segIDs,
@ -232,8 +230,8 @@ func (b *ServerBroker) BroadcastAlteredCollection(ctx context.Context, req *milv
return nil
}
func (b *ServerBroker) DescribeIndex(ctx context.Context, colID UniqueID) (*datapb.DescribeIndexResponse, error) {
return b.s.dataCoord.DescribeIndex(ctx, &datapb.DescribeIndexRequest{
func (b *ServerBroker) DescribeIndex(ctx context.Context, colID UniqueID) (*indexpb.DescribeIndexResponse, error) {
return b.s.dataCoord.DescribeIndex(ctx, &indexpb.DescribeIndexRequest{
CollectionID: colID,
})
}

View File

@ -5,6 +5,8 @@ import (
"errors"
"testing"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/milvus-io/milvus/internal/metastore/model"
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
@ -207,10 +209,10 @@ func TestServerBroker_GetSegmentIndexState(t *testing.T) {
t.Run("success", func(t *testing.T) {
c := newTestCore(withValidDataCoord())
c.dataCoord.(*mockDataCoord).GetSegmentIndexStateFunc = func(ctx context.Context, req *datapb.GetSegmentIndexStateRequest) (*datapb.GetSegmentIndexStateResponse, error) {
return &datapb.GetSegmentIndexStateResponse{
c.dataCoord.(*mockDataCoord).GetSegmentIndexStateFunc = func(ctx context.Context, req *indexpb.GetSegmentIndexStateRequest) (*indexpb.GetSegmentIndexStateResponse, error) {
return &indexpb.GetSegmentIndexStateResponse{
Status: succStatus(),
States: []*datapb.SegmentIndexState{
States: []*indexpb.SegmentIndexState{
{
SegmentID: 1,
State: commonpb.IndexState_Finished,

View File

@ -3,6 +3,8 @@ package rootcoord
import (
"context"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
"github.com/milvus-io/milvus/internal/log"
"github.com/milvus-io/milvus/internal/proto/datapb"
@ -15,8 +17,8 @@ type IDAllocator func(count uint32) (UniqueID, UniqueID, error)
type ImportFunc func(ctx context.Context, req *datapb.ImportTaskRequest) (*datapb.ImportTaskResponse, error)
type MarkSegmentsDroppedFunc func(ctx context.Context, segIDs []int64) (*commonpb.Status, error)
type GetSegmentStatesFunc func(ctx context.Context, req *datapb.GetSegmentStatesRequest) (*datapb.GetSegmentStatesResponse, error)
type DescribeIndexFunc func(ctx context.Context, colID UniqueID) (*datapb.DescribeIndexResponse, error)
type GetSegmentIndexStateFunc func(ctx context.Context, collID UniqueID, indexName string, segIDs []UniqueID) ([]*datapb.SegmentIndexState, error)
type DescribeIndexFunc func(ctx context.Context, colID UniqueID) (*indexpb.DescribeIndexResponse, error)
type GetSegmentIndexStateFunc func(ctx context.Context, collID UniqueID, indexName string, segIDs []UniqueID) ([]*indexpb.SegmentIndexState, error)
type UnsetIsImportingStateFunc func(context.Context, *datapb.UnsetIsImportingStateRequest) (*commonpb.Status, error)
type ImportFactory interface {
@ -114,13 +116,13 @@ func GetSegmentStatesWithCore(c *Core) GetSegmentStatesFunc {
}
func DescribeIndexWithCore(c *Core) DescribeIndexFunc {
return func(ctx context.Context, colID UniqueID) (*datapb.DescribeIndexResponse, error) {
return func(ctx context.Context, colID UniqueID) (*indexpb.DescribeIndexResponse, error) {
return c.broker.DescribeIndex(ctx, colID)
}
}
func GetSegmentIndexStateWithCore(c *Core) GetSegmentIndexStateFunc {
return func(ctx context.Context, collID UniqueID, indexName string, segIDs []UniqueID) ([]*datapb.SegmentIndexState, error) {
return func(ctx context.Context, collID UniqueID, indexName string, segIDs []UniqueID) ([]*indexpb.SegmentIndexState, error) {
return c.broker.GetSegmentIndexState(ctx, collID, indexName, segIDs)
}
}

View File

@ -6,6 +6,8 @@ import (
"math/rand"
"os"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
"github.com/milvus-io/milvus/internal/allocator"
@ -157,14 +159,12 @@ type mockDataCoord struct {
types.DataCoord
GetComponentStatesFunc func(ctx context.Context) (*milvuspb.ComponentStates, error)
WatchChannelsFunc func(ctx context.Context, req *datapb.WatchChannelsRequest) (*datapb.WatchChannelsResponse, error)
AcquireSegmentLockFunc func(ctx context.Context, req *datapb.AcquireSegmentLockRequest) (*commonpb.Status, error)
ReleaseSegmentLockFunc func(ctx context.Context, req *datapb.ReleaseSegmentLockRequest) (*commonpb.Status, error)
FlushFunc func(ctx context.Context, req *datapb.FlushRequest) (*datapb.FlushResponse, error)
ImportFunc func(ctx context.Context, req *datapb.ImportTaskRequest) (*datapb.ImportTaskResponse, error)
UnsetIsImportingStateFunc func(ctx context.Context, req *datapb.UnsetIsImportingStateRequest) (*commonpb.Status, error)
broadCastAlteredCollectionFunc func(ctx context.Context, req *datapb.AlterCollectionRequest) (*commonpb.Status, error)
GetSegmentIndexStateFunc func(ctx context.Context, req *datapb.GetSegmentIndexStateRequest) (*datapb.GetSegmentIndexStateResponse, error)
DropIndexFunc func(ctx context.Context, req *datapb.DropIndexRequest) (*commonpb.Status, error)
GetSegmentIndexStateFunc func(ctx context.Context, req *indexpb.GetSegmentIndexStateRequest) (*indexpb.GetSegmentIndexStateResponse, error)
DropIndexFunc func(ctx context.Context, req *indexpb.DropIndexRequest) (*commonpb.Status, error)
}
func newMockDataCoord() *mockDataCoord {
@ -179,14 +179,6 @@ func (m *mockDataCoord) WatchChannels(ctx context.Context, req *datapb.WatchChan
return m.WatchChannelsFunc(ctx, req)
}
func (m *mockDataCoord) AcquireSegmentLock(ctx context.Context, req *datapb.AcquireSegmentLockRequest) (*commonpb.Status, error) {
return m.AcquireSegmentLockFunc(ctx, req)
}
func (m *mockDataCoord) ReleaseSegmentLock(ctx context.Context, req *datapb.ReleaseSegmentLockRequest) (*commonpb.Status, error) {
return m.ReleaseSegmentLockFunc(ctx, req)
}
func (m *mockDataCoord) Flush(ctx context.Context, req *datapb.FlushRequest) (*datapb.FlushResponse, error) {
return m.FlushFunc(ctx, req)
}
@ -209,11 +201,11 @@ func (m *mockDataCoord) CheckHealth(ctx context.Context, req *milvuspb.CheckHeal
}, nil
}
func (m *mockDataCoord) GetSegmentIndexState(ctx context.Context, req *datapb.GetSegmentIndexStateRequest) (*datapb.GetSegmentIndexStateResponse, error) {
func (m *mockDataCoord) GetSegmentIndexState(ctx context.Context, req *indexpb.GetSegmentIndexStateRequest) (*indexpb.GetSegmentIndexStateResponse, error) {
return m.GetSegmentIndexStateFunc(ctx, req)
}
func (m *mockDataCoord) DropIndex(ctx context.Context, req *datapb.DropIndexRequest) (*commonpb.Status, error) {
func (m *mockDataCoord) DropIndex(ctx context.Context, req *indexpb.DropIndexRequest) (*commonpb.Status, error) {
return m.DropIndexFunc(ctx, req)
}
@ -550,12 +542,6 @@ func withInvalidDataCoord() Opt {
dc.WatchChannelsFunc = func(ctx context.Context, req *datapb.WatchChannelsRequest) (*datapb.WatchChannelsResponse, error) {
return nil, errors.New("error mock WatchChannels")
}
dc.AcquireSegmentLockFunc = func(ctx context.Context, req *datapb.AcquireSegmentLockRequest) (*commonpb.Status, error) {
return nil, errors.New("error mock AddSegRefLock")
}
dc.ReleaseSegmentLockFunc = func(ctx context.Context, req *datapb.ReleaseSegmentLockRequest) (*commonpb.Status, error) {
return nil, errors.New("error mock ReleaseSegRefLock")
}
dc.FlushFunc = func(ctx context.Context, req *datapb.FlushRequest) (*datapb.FlushResponse, error) {
return nil, errors.New("error mock Flush")
}
@ -568,10 +554,10 @@ func withInvalidDataCoord() Opt {
dc.broadCastAlteredCollectionFunc = func(ctx context.Context, req *datapb.AlterCollectionRequest) (*commonpb.Status, error) {
return nil, errors.New("error mock broadCastAlteredCollection")
}
dc.GetSegmentIndexStateFunc = func(ctx context.Context, req *datapb.GetSegmentIndexStateRequest) (*datapb.GetSegmentIndexStateResponse, error) {
dc.GetSegmentIndexStateFunc = func(ctx context.Context, req *indexpb.GetSegmentIndexStateRequest) (*indexpb.GetSegmentIndexStateResponse, error) {
return nil, errors.New("error mock GetSegmentIndexStateFunc")
}
dc.DropIndexFunc = func(ctx context.Context, req *datapb.DropIndexRequest) (*commonpb.Status, error) {
dc.DropIndexFunc = func(ctx context.Context, req *indexpb.DropIndexRequest) (*commonpb.Status, error) {
return nil, errors.New("error mock DropIndexFunc")
}
return withDataCoord(dc)
@ -590,12 +576,6 @@ func withFailedDataCoord() Opt {
Status: failStatus(commonpb.ErrorCode_UnexpectedError, "mock watch channels error"),
}, nil
}
dc.AcquireSegmentLockFunc = func(ctx context.Context, req *datapb.AcquireSegmentLockRequest) (*commonpb.Status, error) {
return failStatus(commonpb.ErrorCode_UnexpectedError, "mock add seg ref lock error"), nil
}
dc.ReleaseSegmentLockFunc = func(ctx context.Context, req *datapb.ReleaseSegmentLockRequest) (*commonpb.Status, error) {
return failStatus(commonpb.ErrorCode_UnexpectedError, "mock release seg ref lock error"), nil
}
dc.FlushFunc = func(ctx context.Context, req *datapb.FlushRequest) (*datapb.FlushResponse, error) {
return &datapb.FlushResponse{
Status: failStatus(commonpb.ErrorCode_UnexpectedError, "mock flush error"),
@ -615,12 +595,12 @@ func withFailedDataCoord() Opt {
dc.broadCastAlteredCollectionFunc = func(ctx context.Context, req *datapb.AlterCollectionRequest) (*commonpb.Status, error) {
return failStatus(commonpb.ErrorCode_UnexpectedError, "mock broadcast altered collection error"), nil
}
dc.GetSegmentIndexStateFunc = func(ctx context.Context, req *datapb.GetSegmentIndexStateRequest) (*datapb.GetSegmentIndexStateResponse, error) {
return &datapb.GetSegmentIndexStateResponse{
dc.GetSegmentIndexStateFunc = func(ctx context.Context, req *indexpb.GetSegmentIndexStateRequest) (*indexpb.GetSegmentIndexStateResponse, error) {
return &indexpb.GetSegmentIndexStateResponse{
Status: failStatus(commonpb.ErrorCode_UnexpectedError, "mock GetSegmentIndexStateFunc fail"),
}, nil
}
dc.DropIndexFunc = func(ctx context.Context, req *datapb.DropIndexRequest) (*commonpb.Status, error) {
dc.DropIndexFunc = func(ctx context.Context, req *indexpb.DropIndexRequest) (*commonpb.Status, error) {
return failStatus(commonpb.ErrorCode_UnexpectedError, "mock DropIndexFunc fail"), nil
}
return withDataCoord(dc)
@ -639,12 +619,6 @@ func withValidDataCoord() Opt {
Status: succStatus(),
}, nil
}
dc.AcquireSegmentLockFunc = func(ctx context.Context, req *datapb.AcquireSegmentLockRequest) (*commonpb.Status, error) {
return succStatus(), nil
}
dc.ReleaseSegmentLockFunc = func(ctx context.Context, req *datapb.ReleaseSegmentLockRequest) (*commonpb.Status, error) {
return succStatus(), nil
}
dc.FlushFunc = func(ctx context.Context, req *datapb.FlushRequest) (*datapb.FlushResponse, error) {
return &datapb.FlushResponse{
Status: succStatus(),
@ -661,12 +635,12 @@ func withValidDataCoord() Opt {
dc.broadCastAlteredCollectionFunc = func(ctx context.Context, req *datapb.AlterCollectionRequest) (*commonpb.Status, error) {
return succStatus(), nil
}
dc.GetSegmentIndexStateFunc = func(ctx context.Context, req *datapb.GetSegmentIndexStateRequest) (*datapb.GetSegmentIndexStateResponse, error) {
return &datapb.GetSegmentIndexStateResponse{
dc.GetSegmentIndexStateFunc = func(ctx context.Context, req *indexpb.GetSegmentIndexStateRequest) (*indexpb.GetSegmentIndexStateResponse, error) {
return &indexpb.GetSegmentIndexStateResponse{
Status: succStatus(),
}, nil
}
dc.DropIndexFunc = func(ctx context.Context, req *datapb.DropIndexRequest) (*commonpb.Status, error) {
dc.DropIndexFunc = func(ctx context.Context, req *indexpb.DropIndexRequest) (*commonpb.Status, error) {
return succStatus(), nil
}
return withDataCoord(dc)
@ -787,8 +761,8 @@ type mockBroker struct {
ImportFunc func(ctx context.Context, req *datapb.ImportTaskRequest) (*datapb.ImportTaskResponse, error)
DropCollectionIndexFunc func(ctx context.Context, collID UniqueID, partIDs []UniqueID) error
DescribeIndexFunc func(ctx context.Context, colID UniqueID) (*datapb.DescribeIndexResponse, error)
GetSegmentIndexStateFunc func(ctx context.Context, collID UniqueID, indexName string, segIDs []UniqueID) ([]*datapb.SegmentIndexState, error)
DescribeIndexFunc func(ctx context.Context, colID UniqueID) (*indexpb.DescribeIndexResponse, error)
GetSegmentIndexStateFunc func(ctx context.Context, collID UniqueID, indexName string, segIDs []UniqueID) ([]*indexpb.SegmentIndexState, error)
BroadcastAlteredCollectionFunc func(ctx context.Context, req *milvuspb.AlterCollectionRequest) error
}
@ -813,11 +787,11 @@ func (b mockBroker) DropCollectionIndex(ctx context.Context, collID UniqueID, pa
return b.DropCollectionIndexFunc(ctx, collID, partIDs)
}
func (b mockBroker) DescribeIndex(ctx context.Context, colID UniqueID) (*datapb.DescribeIndexResponse, error) {
func (b mockBroker) DescribeIndex(ctx context.Context, colID UniqueID) (*indexpb.DescribeIndexResponse, error) {
return b.DescribeIndexFunc(ctx, colID)
}
func (b mockBroker) GetSegmentIndexState(ctx context.Context, collID UniqueID, indexName string, segIDs []UniqueID) ([]*datapb.SegmentIndexState, error) {
func (b mockBroker) GetSegmentIndexState(ctx context.Context, collID UniqueID, indexName string, segIDs []UniqueID) ([]*indexpb.SegmentIndexState, error) {
return b.GetSegmentIndexStateFunc(ctx, collID, indexName, segIDs)
}

View File

@ -335,29 +335,29 @@ type DataCoord interface {
// Index building is asynchronous, so when an index building request comes, an IndexID is assigned to the task and
// will get all flushed segments from DataCoord and record tasks with these segments. The background process
// indexBuilder will find this task and assign it to IndexNode for execution.
CreateIndex(ctx context.Context, req *datapb.CreateIndexRequest) (*commonpb.Status, error)
CreateIndex(ctx context.Context, req *indexpb.CreateIndexRequest) (*commonpb.Status, error)
// GetIndexState gets the index state of the index name in the request from Proxy.
// Deprecated: use DescribeIndex instead
GetIndexState(ctx context.Context, req *datapb.GetIndexStateRequest) (*datapb.GetIndexStateResponse, error)
GetIndexState(ctx context.Context, req *indexpb.GetIndexStateRequest) (*indexpb.GetIndexStateResponse, error)
// GetSegmentIndexState gets the index state of the segments in the request from RootCoord.
GetSegmentIndexState(ctx context.Context, req *datapb.GetSegmentIndexStateRequest) (*datapb.GetSegmentIndexStateResponse, error)
GetSegmentIndexState(ctx context.Context, req *indexpb.GetSegmentIndexStateRequest) (*indexpb.GetSegmentIndexStateResponse, error)
// GetIndexInfos gets the index files of the IndexBuildIDs in the request from RootCoordinator.
GetIndexInfos(ctx context.Context, req *datapb.GetIndexInfoRequest) (*datapb.GetIndexInfoResponse, error)
GetIndexInfos(ctx context.Context, req *indexpb.GetIndexInfoRequest) (*indexpb.GetIndexInfoResponse, error)
// DescribeIndex describe the index info of the collection.
DescribeIndex(ctx context.Context, req *datapb.DescribeIndexRequest) (*datapb.DescribeIndexResponse, error)
DescribeIndex(ctx context.Context, req *indexpb.DescribeIndexRequest) (*indexpb.DescribeIndexResponse, error)
// GetIndexBuildProgress get the index building progress by num rows.
// Deprecated: use DescribeIndex instead
GetIndexBuildProgress(ctx context.Context, req *datapb.GetIndexBuildProgressRequest) (*datapb.GetIndexBuildProgressResponse, error)
GetIndexBuildProgress(ctx context.Context, req *indexpb.GetIndexBuildProgressRequest) (*indexpb.GetIndexBuildProgressResponse, error)
// DropIndex deletes indexes based on IndexID. One IndexID corresponds to the index of an entire column. A column is
// divided into many segments, and each segment corresponds to an IndexBuildID. IndexCoord uses IndexBuildID to record
// index tasks. Therefore, when DropIndex is called, delete all tasks corresponding to IndexBuildID corresponding to IndexID.
DropIndex(ctx context.Context, req *datapb.DropIndexRequest) (*commonpb.Status, error)
DropIndex(ctx context.Context, req *indexpb.DropIndexRequest) (*commonpb.Status, error)
}
// DataCoordComponent defines the interface of DataCoord component.

View File

@ -130,11 +130,3 @@ func (m *DataCoordClient) Import(ctx context.Context, req *datapb.ImportTaskRequ
func (m *DataCoordClient) UpdateSegmentStatistics(ctx context.Context, req *datapb.UpdateSegmentStatisticsRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
return &commonpb.Status{}, m.Err
}
func (m *DataCoordClient) AcquireSegmentLock(ctx context.Context, req *datapb.AcquireSegmentLockRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
return &commonpb.Status{}, m.Err
}
func (m *DataCoordClient) ReleaseSegmentLock(ctx context.Context, req *datapb.ReleaseSegmentLockRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
return &commonpb.Status{}, m.Err
}

View File

@ -19,6 +19,8 @@ package mock
import (
"context"
"github.com/milvus-io/milvus/internal/proto/indexpb"
"google.golang.org/grpc"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
@ -149,14 +151,6 @@ func (m *GrpcDataCoordClient) UpdateChannelCheckpoint(ctx context.Context, req *
return &commonpb.Status{}, m.Err
}
func (m *GrpcDataCoordClient) AcquireSegmentLock(ctx context.Context, req *datapb.AcquireSegmentLockRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
return &commonpb.Status{}, m.Err
}
func (m *GrpcDataCoordClient) ReleaseSegmentLock(ctx context.Context, req *datapb.ReleaseSegmentLockRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
return &commonpb.Status{}, m.Err
}
func (m *GrpcDataCoordClient) SaveImportSegment(ctx context.Context, in *datapb.SaveImportSegmentRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
return &commonpb.Status{}, m.Err
}
@ -174,34 +168,34 @@ func (m *GrpcDataCoordClient) BroadcastAlteredCollection(ctx context.Context, in
}
func (m *GrpcDataCoordClient) CreateIndex(ctx context.Context, req *datapb.CreateIndexRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
func (m *GrpcDataCoordClient) CreateIndex(ctx context.Context, req *indexpb.CreateIndexRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
return &commonpb.Status{}, m.Err
}
func (m *GrpcDataCoordClient) DropIndex(ctx context.Context, req *datapb.DropIndexRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
func (m *GrpcDataCoordClient) DropIndex(ctx context.Context, req *indexpb.DropIndexRequest, opts ...grpc.CallOption) (*commonpb.Status, error) {
return &commonpb.Status{}, m.Err
}
func (m *GrpcDataCoordClient) GetIndexState(ctx context.Context, req *datapb.GetIndexStateRequest, opts ...grpc.CallOption) (*datapb.GetIndexStateResponse, error) {
return &datapb.GetIndexStateResponse{}, m.Err
func (m *GrpcDataCoordClient) GetIndexState(ctx context.Context, req *indexpb.GetIndexStateRequest, opts ...grpc.CallOption) (*indexpb.GetIndexStateResponse, error) {
return &indexpb.GetIndexStateResponse{}, m.Err
}
// GetSegmentIndexState gets the index state of the segments in the request from RootCoord.
func (m *GrpcDataCoordClient) GetSegmentIndexState(ctx context.Context, req *datapb.GetSegmentIndexStateRequest, opts ...grpc.CallOption) (*datapb.GetSegmentIndexStateResponse, error) {
return &datapb.GetSegmentIndexStateResponse{}, m.Err
func (m *GrpcDataCoordClient) GetSegmentIndexState(ctx context.Context, req *indexpb.GetSegmentIndexStateRequest, opts ...grpc.CallOption) (*indexpb.GetSegmentIndexStateResponse, error) {
return &indexpb.GetSegmentIndexStateResponse{}, m.Err
}
// GetIndexInfos gets the index files of the IndexBuildIDs in the request from RootCoordinator.
func (m *GrpcDataCoordClient) GetIndexInfos(ctx context.Context, req *datapb.GetIndexInfoRequest, opts ...grpc.CallOption) (*datapb.GetIndexInfoResponse, error) {
return &datapb.GetIndexInfoResponse{}, m.Err
func (m *GrpcDataCoordClient) GetIndexInfos(ctx context.Context, req *indexpb.GetIndexInfoRequest, opts ...grpc.CallOption) (*indexpb.GetIndexInfoResponse, error) {
return &indexpb.GetIndexInfoResponse{}, m.Err
}
// DescribeIndex describe the index info of the collection.
func (m *GrpcDataCoordClient) DescribeIndex(ctx context.Context, req *datapb.DescribeIndexRequest, opts ...grpc.CallOption) (*datapb.DescribeIndexResponse, error) {
return &datapb.DescribeIndexResponse{}, m.Err
func (m *GrpcDataCoordClient) DescribeIndex(ctx context.Context, req *indexpb.DescribeIndexRequest, opts ...grpc.CallOption) (*indexpb.DescribeIndexResponse, error) {
return &indexpb.DescribeIndexResponse{}, m.Err
}
// GetIndexBuildProgress get the index building progress by num rows.
func (m *GrpcDataCoordClient) GetIndexBuildProgress(ctx context.Context, req *datapb.GetIndexBuildProgressRequest, opts ...grpc.CallOption) (*datapb.GetIndexBuildProgressResponse, error) {
return &datapb.GetIndexBuildProgressResponse{}, m.Err
func (m *GrpcDataCoordClient) GetIndexBuildProgress(ctx context.Context, req *indexpb.GetIndexBuildProgressRequest, opts ...grpc.CallOption) (*indexpb.GetIndexBuildProgressResponse, error) {
return &indexpb.GetIndexBuildProgressResponse{}, m.Err
}

View File

@ -57,7 +57,7 @@ ${protoc_opt} --go_out=plugins=grpc,paths=source_relative:./indexcgopb index_cgo
${protoc_opt} --go_out=plugins=grpc,paths=source_relative:./rootcoordpb root_coord.proto
${protoc_opt} --go_out=plugins=grpc,paths=source_relative:./internalpb internal.proto
${protoc_opt} --go_out=plugins=grpc,paths=source_relative:./proxypb proxy.proto
${protoc_opt} --go_out=plugins=grpc,paths=source_relative:./indexpb index_node.proto
${protoc_opt} --go_out=plugins=grpc,paths=source_relative:./indexpb index_coord.proto
${protoc_opt} --go_out=plugins=grpc,paths=source_relative:./datapb data_coord.proto
${protoc_opt} --go_out=plugins=grpc,paths=source_relative:./querypb query_coord.proto
${protoc_opt} --go_out=plugins=grpc,paths=source_relative:./planpb plan.proto