Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename IndexService to IndexCoord #5932

Merged
merged 16 commits into from
Jun 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename indexservice to indexcoord
Signed-off-by: yudong.cai <yudong.cai@zilliz.com>
  • Loading branch information
cydrain committed Jun 21, 2021
commit 4cae213e2e3ab695156bfb53fb3507937ce0d514
26 changes: 13 additions & 13 deletions internal/distributed/indexservice/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ type Client struct {
reconnTry int
}

func getIndexServiceaddr(sess *sessionutil.Session) (string, error) {
key := typeutil.IndexServiceRole
func getIndexCoordAddr(sess *sessionutil.Session) (string, error) {
key := typeutil.IndexCoordRole
msess, _, err := sess.GetSessions(key)
if err != nil {
log.Debug("IndexServiceClient GetSessions failed", zap.Any("key", key), zap.Error(err))
log.Debug("IndexCoordClient GetSessions failed", zap.Any("key", key), zap.Error(err))
return "", err
}
log.Debug("IndexServiceClient GetSessions success", zap.Any("key", key), zap.Any("msess", msess))
log.Debug("IndexCoordClient GetSessions success", zap.Any("key", key), zap.Any("msess", msess))
ms, ok := msess[key]
if !ok {
log.Debug("IndexServiceClient msess key not existed", zap.Any("key", key), zap.Any("len of msess", len(msess)))
log.Debug("IndexCoordClient msess key not existed", zap.Any("key", key), zap.Any("len of msess", len(msess)))
return "", fmt.Errorf("number of indexservice is incorrect, %d", len(msess))
}
return ms.Address, nil
Expand Down Expand Up @@ -85,24 +85,24 @@ func (c *Client) Init() error {

func (c *Client) connect() error {
var err error
getIndexServiceaddrFn := func() error {
c.addr, err = getIndexServiceaddr(c.sess)
getIndexCoordaddrFn := func() error {
c.addr, err = getIndexCoordAddr(c.sess)
if err != nil {
return err
}
return nil
}
err = retry.Retry(c.reconnTry, 3*time.Second, getIndexServiceaddrFn)
err = retry.Retry(c.reconnTry, 3*time.Second, getIndexCoordaddrFn)
if err != nil {
log.Debug("IndexServiceClient getIndexServiceAddress failed", zap.Error(err))
log.Debug("IndexCoordClient getIndexCoordAddress failed", zap.Error(err))
return err
}
log.Debug("IndexServiceClient getIndexServiceAddress success")
log.Debug("IndexCoordClient getIndexCoordAddress success")
connectGrpcFunc := func() error {
ctx, cancelFunc := context.WithTimeout(c.ctx, c.timeout)
defer cancelFunc()
opts := trace.GetInterceptorOpts()
log.Debug("IndexServiceClient try connect ", zap.String("address", c.addr))
log.Debug("IndexCoordClient try connect ", zap.String("address", c.addr))
conn, err := grpc.DialContext(ctx, c.addr, grpc.WithInsecure(), grpc.WithBlock(),
grpc.WithUnaryInterceptor(
grpc_opentracing.UnaryClientInterceptor(opts...)),
Expand All @@ -117,10 +117,10 @@ func (c *Client) connect() error {

err = retry.Retry(c.reconnTry, 500*time.Millisecond, connectGrpcFunc)
if err != nil {
log.Debug("IndexServiceClient try connect failed", zap.Error(err))
log.Debug("IndexCoordClient try connect failed", zap.Error(err))
return err
}
log.Debug("IndexServiceClient connect success")
log.Debug("IndexCoordClient connect success")
c.grpcClient = indexpb.NewIndexServiceClient(c.conn)
return nil
}
Expand Down
15 changes: 6 additions & 9 deletions internal/distributed/indexservice/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
"sync"

"go.uber.org/zap"
"google.golang.org/grpc"

grpc_opentracing "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing"
ot "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing"
"github.com/milvus-io/milvus/internal/indexservice"
"github.com/milvus-io/milvus/internal/log"
"github.com/milvus-io/milvus/internal/proto/commonpb"
Expand All @@ -31,14 +32,13 @@ import (
"github.com/milvus-io/milvus/internal/util/funcutil"
"github.com/milvus-io/milvus/internal/util/trace"
"github.com/milvus-io/milvus/internal/util/typeutil"
"google.golang.org/grpc"
)

type UniqueID = typeutil.UniqueID
type Timestamp = typeutil.Timestamp

type Server struct {
indexcoord *indexcoord.IndexService
indexcoord *indexcoord.IndexCoord

grpcServer *grpc.Server
grpcErrChan chan error
Expand Down Expand Up @@ -167,10 +167,8 @@ func (s *Server) startGrpcLoop(grpcPort int) {
s.grpcServer = grpc.NewServer(
grpc.MaxRecvMsgSize(math.MaxInt32),
grpc.MaxSendMsgSize(math.MaxInt32),
grpc.UnaryInterceptor(
grpc_opentracing.UnaryServerInterceptor(opts...)),
grpc.StreamInterceptor(
grpc_opentracing.StreamServerInterceptor(opts...)))
grpc.UnaryInterceptor(ot.UnaryServerInterceptor(opts...)),
grpc.StreamInterceptor(ot.StreamServerInterceptor(opts...)))
indexpb.RegisterIndexServiceServer(s.grpcServer, s)

go funcutil.CheckGrpcReady(ctx, s.grpcErrChan)
Expand All @@ -181,9 +179,8 @@ func (s *Server) startGrpcLoop(grpcPort int) {
}

func NewServer(ctx context.Context) (*Server, error) {

ctx1, cancel := context.WithCancel(ctx)
serverImp, err := indexcoord.NewIndexService(ctx)
serverImp, err := indexcoord.NewIndexCoord(ctx)
if err != nil {
defer cancel()
return nil, err
Expand Down
Loading