From 899d31e72d51f01bae511d938779228564fef497 Mon Sep 17 00:00:00 2001 From: neza2017 Date: Tue, 2 Feb 2021 20:09:46 +0800 Subject: [PATCH] Change interface: add index id and index name params Signed-off-by: neza2017 --- internal/distributed/masterservice/masterservice_test.go | 2 +- internal/masterservice/master_service.go | 6 ++++-- internal/masterservice/task.go | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/distributed/masterservice/masterservice_test.go b/internal/distributed/masterservice/masterservice_test.go index f473ea5a18..fca7ce4d02 100644 --- a/internal/distributed/masterservice/masterservice_test.go +++ b/internal/distributed/masterservice/masterservice_test.go @@ -98,7 +98,7 @@ func TestGrpcService(t *testing.T) { var binlogLock sync.Mutex binlogPathArray := make([]string, 0, 16) - core.BuildIndexReq = func(binlog []string, typeParams []*commonpb.KeyValuePair, indexParams []*commonpb.KeyValuePair) (typeutil.UniqueID, error) { + core.BuildIndexReq = func(binlog []string, typeParams []*commonpb.KeyValuePair, indexParams []*commonpb.KeyValuePair, indexID typeutil.UniqueID, indexName string) (typeutil.UniqueID, error) { binlogLock.Lock() defer binlogLock.Unlock() binlogPathArray = append(binlogPathArray, binlog...) diff --git a/internal/masterservice/master_service.go b/internal/masterservice/master_service.go index 0b62fd1482..e164ce7ba9 100644 --- a/internal/masterservice/master_service.go +++ b/internal/masterservice/master_service.go @@ -152,7 +152,7 @@ type Core struct { GetBinlogFilePathsFromDataServiceReq func(segID typeutil.UniqueID, fieldID typeutil.UniqueID) ([]string, error) //TODO, call index builder's client to build index, return build id - BuildIndexReq func(binlog []string, typeParams []*commonpb.KeyValuePair, indexParams []*commonpb.KeyValuePair) (typeutil.UniqueID, error) + BuildIndexReq func(binlog []string, typeParams []*commonpb.KeyValuePair, indexParams []*commonpb.KeyValuePair, indexID typeutil.UniqueID, indexName string) (typeutil.UniqueID, error) //TODO, proxy service interface, notify proxy service to drop collection InvalidateCollectionMetaCache func(ts typeutil.Timestamp, dbName string, collectionName string) error @@ -671,11 +671,13 @@ func (c *Core) SetDataService(s DataServiceInterface) error { } func (c *Core) SetIndexService(s IndexServiceInterface) error { - c.BuildIndexReq = func(binlog []string, typeParams []*commonpb.KeyValuePair, indexParams []*commonpb.KeyValuePair) (typeutil.UniqueID, error) { + c.BuildIndexReq = func(binlog []string, typeParams []*commonpb.KeyValuePair, indexParams []*commonpb.KeyValuePair, indexID typeutil.UniqueID, indexName string) (typeutil.UniqueID, error) { rsp, err := s.BuildIndex(&indexpb.BuildIndexRequest{ DataPaths: binlog, TypeParams: typeParams, IndexParams: indexParams, + IndexID: indexID, + IndexName: indexName, }) if err != nil { return 0, err diff --git a/internal/masterservice/task.go b/internal/masterservice/task.go index 3586151c28..2d6648d4f1 100644 --- a/internal/masterservice/task.go +++ b/internal/masterservice/task.go @@ -628,7 +628,7 @@ func (t *CreateIndexTask) BuildIndex() error { }) } } - bldID, err = t.core.BuildIndexReq(binlogs, t.fieldSchema.TypeParams, t.indexParams) + bldID, err = t.core.BuildIndexReq(binlogs, t.fieldSchema.TypeParams, t.indexParams, idxID, t.indexName) if err != nil { return err }