From 9fccbbb92bb84bb4cfc1128dcc4f7b45e26b4b16 Mon Sep 17 00:00:00 2001 From: Enwei Jiao Date: Thu, 12 Jan 2023 15:59:39 +0800 Subject: [PATCH] Remove factory in querycoord (#21659) Signed-off-by: Enwei Jiao --- internal/distributed/querycoord/service.go | 2 +- internal/querycoordv2/server.go | 10 +++------- internal/querycoordv2/server_test.go | 3 +-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/internal/distributed/querycoord/service.go b/internal/distributed/querycoord/service.go index 8263ab10bc..fa48e9ef17 100644 --- a/internal/distributed/querycoord/service.go +++ b/internal/distributed/querycoord/service.go @@ -72,7 +72,7 @@ type Server struct { // NewServer create a new QueryCoord grpc server. func NewServer(ctx context.Context, factory dependency.Factory) (*Server, error) { ctx1, cancel := context.WithCancel(ctx) - svr, err := qc.NewQueryCoord(ctx1, factory) + svr, err := qc.NewQueryCoord(ctx1) if err != nil { cancel() return nil, err diff --git a/internal/querycoordv2/server.go b/internal/querycoordv2/server.go index 85ee60de82..e4bacc8ffb 100644 --- a/internal/querycoordv2/server.go +++ b/internal/querycoordv2/server.go @@ -47,7 +47,6 @@ import ( "github.com/milvus-io/milvus/internal/querycoordv2/session" "github.com/milvus-io/milvus/internal/querycoordv2/task" "github.com/milvus-io/milvus/internal/types" - "github.com/milvus-io/milvus/internal/util/dependency" "github.com/milvus-io/milvus/internal/util/metricsinfo" "github.com/milvus-io/milvus/internal/util/sessionutil" "github.com/milvus-io/milvus/internal/util/tsoutil" @@ -72,7 +71,6 @@ type Server struct { session *sessionutil.Session kv kv.MetaKv idAllocator func() (int64, error) - factory dependency.Factory metricsCacheManager *metricsinfo.MetricsCacheManager // Coordinators @@ -112,12 +110,11 @@ type Server struct { activateFunc func() } -func NewQueryCoord(ctx context.Context, factory dependency.Factory) (*Server, error) { +func NewQueryCoord(ctx context.Context) (*Server, error) { ctx, cancel := context.WithCancel(ctx) server := &Server{ - ctx: ctx, - cancel: cancel, - factory: factory, + ctx: ctx, + cancel: cancel, } server.UpdateStateCode(commonpb.StateCode_Abnormal) return server, nil @@ -156,7 +153,6 @@ func (s *Server) Init() error { s.session.Init(typeutil.QueryCoordRole, s.address, true, true) s.enableActiveStandBy = Params.QueryCoordCfg.EnableActiveStandby.GetAsBool() s.session.SetEnableActiveStandBy(s.enableActiveStandBy) - s.factory.Init(Params) // Init KV etcdKV := etcdkv.NewEtcdKV(s.etcdCli, Params.EtcdCfg.MetaRootPath.GetValue()) diff --git a/internal/querycoordv2/server_test.go b/internal/querycoordv2/server_test.go index 0a2ac153f2..dac8012ad6 100644 --- a/internal/querycoordv2/server_test.go +++ b/internal/querycoordv2/server_test.go @@ -37,7 +37,6 @@ import ( "github.com/milvus-io/milvus/internal/querycoordv2/mocks" "github.com/milvus-io/milvus/internal/querycoordv2/params" "github.com/milvus-io/milvus/internal/querycoordv2/task" - "github.com/milvus-io/milvus/internal/util/dependency" "github.com/milvus-io/milvus/internal/util/etcd" "github.com/milvus-io/milvus/internal/util/paramtable" ) @@ -413,7 +412,7 @@ func (suite *ServerSuite) hackServer() { } func newQueryCoord() (*Server, error) { - server, err := NewQueryCoord(context.Background(), dependency.NewDefaultFactory(true)) + server, err := NewQueryCoord(context.Background()) if err != nil { return nil, err }