2021-10-19 08:53:23 +00:00
|
|
|
// Licensed to the LF AI & Data foundation under one
|
|
|
|
// or more contributor license agreements. See the NOTICE file
|
|
|
|
// distributed with this work for additional information
|
|
|
|
// regarding copyright ownership. The ASF licenses this file
|
|
|
|
// to you under the Apache License, Version 2.0 (the
|
|
|
|
// "License"); you may not use this file except in compliance
|
2021-04-19 07:16:33 +00:00
|
|
|
// with the License. You may obtain a copy of the License at
|
|
|
|
//
|
2021-10-19 08:53:23 +00:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2021-04-19 07:16:33 +00:00
|
|
|
//
|
2021-10-19 08:53:23 +00:00
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2021-04-19 07:16:33 +00:00
|
|
|
|
2021-02-23 03:40:30 +00:00
|
|
|
package grpcdatanode
|
2021-01-19 03:37:16 +00:00
|
|
|
|
|
|
|
import (
|
2021-01-22 01:36:40 +00:00
|
|
|
"context"
|
2021-03-05 02:15:27 +00:00
|
|
|
"errors"
|
2021-02-24 01:48:17 +00:00
|
|
|
"fmt"
|
|
|
|
"io"
|
2021-01-24 13:20:11 +00:00
|
|
|
"net"
|
|
|
|
"strconv"
|
2021-02-26 02:13:36 +00:00
|
|
|
"sync"
|
|
|
|
"time"
|
2021-01-22 01:36:40 +00:00
|
|
|
|
2021-12-20 08:43:05 +00:00
|
|
|
ot "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing"
|
2021-04-22 06:45:57 +00:00
|
|
|
dn "github.com/milvus-io/milvus/internal/datanode"
|
2021-12-20 08:43:05 +00:00
|
|
|
dcc "github.com/milvus-io/milvus/internal/distributed/datacoord/client"
|
2021-06-18 13:30:08 +00:00
|
|
|
rcc "github.com/milvus-io/milvus/internal/distributed/rootcoord/client"
|
2021-04-22 06:45:57 +00:00
|
|
|
"github.com/milvus-io/milvus/internal/log"
|
|
|
|
"github.com/milvus-io/milvus/internal/msgstream"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/commonpb"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/datapb"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/internalpb"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/milvuspb"
|
|
|
|
"github.com/milvus-io/milvus/internal/types"
|
2021-12-29 06:35:21 +00:00
|
|
|
"github.com/milvus-io/milvus/internal/util/etcd"
|
2021-04-22 06:45:57 +00:00
|
|
|
"github.com/milvus-io/milvus/internal/util/funcutil"
|
2021-12-17 02:23:15 +00:00
|
|
|
"github.com/milvus-io/milvus/internal/util/paramtable"
|
2021-04-22 06:45:57 +00:00
|
|
|
"github.com/milvus-io/milvus/internal/util/trace"
|
2021-12-17 02:23:15 +00:00
|
|
|
"github.com/milvus-io/milvus/internal/util/typeutil"
|
2021-12-29 06:35:21 +00:00
|
|
|
clientv3 "go.etcd.io/etcd/client/v3"
|
2021-12-20 08:43:05 +00:00
|
|
|
"go.uber.org/zap"
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
"google.golang.org/grpc/keepalive"
|
2021-01-19 03:37:16 +00:00
|
|
|
)
|
|
|
|
|
2021-12-28 11:34:58 +00:00
|
|
|
// Params contains parameters for datanode grpc server.
|
2021-12-17 02:23:15 +00:00
|
|
|
var Params paramtable.GrpcServerConfig
|
|
|
|
|
2021-01-19 03:37:16 +00:00
|
|
|
type Server struct {
|
2021-10-09 02:10:59 +00:00
|
|
|
datanode types.DataNodeComponent
|
2021-02-23 03:40:30 +00:00
|
|
|
wg sync.WaitGroup
|
|
|
|
grpcErrChan chan error
|
|
|
|
grpcServer *grpc.Server
|
|
|
|
ctx context.Context
|
|
|
|
cancel context.CancelFunc
|
2021-12-29 06:35:21 +00:00
|
|
|
etcdCli *clientv3.Client
|
|
|
|
msFactory msgstream.Factory
|
2021-02-23 03:40:30 +00:00
|
|
|
|
2021-06-21 10:22:13 +00:00
|
|
|
rootCoord types.RootCoord
|
|
|
|
dataCoord types.DataCoord
|
2021-02-24 01:48:17 +00:00
|
|
|
|
2021-12-29 06:35:21 +00:00
|
|
|
newRootCoordClient func(string, *clientv3.Client) (types.RootCoord, error)
|
|
|
|
newDataCoordClient func(string, *clientv3.Client) (types.DataCoord, error)
|
2021-05-08 06:07:04 +00:00
|
|
|
|
2021-02-24 01:48:17 +00:00
|
|
|
closer io.Closer
|
2021-01-22 01:36:40 +00:00
|
|
|
}
|
|
|
|
|
2022-01-07 13:13:37 +00:00
|
|
|
// NewServer new DataNode grpc server
|
2021-05-08 06:07:04 +00:00
|
|
|
func NewServer(ctx context.Context, factory msgstream.Factory) (*Server, error) {
|
2021-02-04 12:31:23 +00:00
|
|
|
ctx1, cancel := context.WithCancel(ctx)
|
2021-01-27 03:34:16 +00:00
|
|
|
var s = &Server{
|
2021-02-23 03:40:30 +00:00
|
|
|
ctx: ctx1,
|
|
|
|
cancel: cancel,
|
|
|
|
msFactory: factory,
|
|
|
|
grpcErrChan: make(chan error),
|
2021-12-29 06:35:21 +00:00
|
|
|
newRootCoordClient: func(etcdMetaRoot string, client *clientv3.Client) (types.RootCoord, error) {
|
|
|
|
return rcc.NewClient(ctx1, etcdMetaRoot, client)
|
2021-05-08 06:07:04 +00:00
|
|
|
},
|
2021-12-29 06:35:21 +00:00
|
|
|
newDataCoordClient: func(etcdMetaRoot string, client *clientv3.Client) (types.DataCoord, error) {
|
|
|
|
return dcc.NewClient(ctx1, etcdMetaRoot, client)
|
2021-05-08 06:07:04 +00:00
|
|
|
},
|
2021-01-27 03:34:16 +00:00
|
|
|
}
|
2021-01-24 13:20:11 +00:00
|
|
|
|
2021-03-05 12:41:34 +00:00
|
|
|
s.datanode = dn.NewDataNode(s.ctx, s.msFactory)
|
2021-02-23 03:40:30 +00:00
|
|
|
|
|
|
|
return s, nil
|
|
|
|
}
|
|
|
|
|
2021-05-08 06:07:04 +00:00
|
|
|
func (s *Server) startGrpc() error {
|
|
|
|
s.wg.Add(1)
|
2021-12-17 02:23:15 +00:00
|
|
|
go s.startGrpcLoop(Params.Listener)
|
2021-05-08 06:07:04 +00:00
|
|
|
// wait for grpc server loop start
|
|
|
|
err := <-s.grpcErrChan
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-12-13 05:24:16 +00:00
|
|
|
// startGrpcLoop starts the grep loop of datanode component.
|
2021-04-28 10:43:48 +00:00
|
|
|
func (s *Server) startGrpcLoop(listener net.Listener) {
|
2021-02-23 03:40:30 +00:00
|
|
|
defer s.wg.Done()
|
2021-11-29 06:25:17 +00:00
|
|
|
var kaep = keepalive.EnforcementPolicy{
|
|
|
|
MinTime: 5 * time.Second, // If a client pings more than once every 5 seconds, terminate the connection
|
|
|
|
PermitWithoutStream: true, // Allow pings even when there are no active streams
|
|
|
|
}
|
|
|
|
|
|
|
|
var kasp = keepalive.ServerParameters{
|
|
|
|
Time: 60 * time.Second, // Ping the client if it is idle for 60 seconds to ensure the connection is still active
|
|
|
|
Timeout: 10 * time.Second, // Wait 10 second for the ping ack before assuming the connection is dead
|
|
|
|
}
|
2021-02-23 03:40:30 +00:00
|
|
|
|
2021-06-17 06:17:56 +00:00
|
|
|
opts := trace.GetInterceptorOpts()
|
2021-03-08 07:49:42 +00:00
|
|
|
s.grpcServer = grpc.NewServer(
|
2021-11-29 06:25:17 +00:00
|
|
|
grpc.KeepaliveEnforcementPolicy(kaep),
|
|
|
|
grpc.KeepaliveParams(kasp),
|
2021-08-04 05:03:24 +00:00
|
|
|
grpc.MaxRecvMsgSize(Params.ServerMaxRecvSize),
|
|
|
|
grpc.MaxSendMsgSize(Params.ServerMaxSendSize),
|
2021-12-20 08:43:05 +00:00
|
|
|
grpc.UnaryInterceptor(ot.UnaryServerInterceptor(opts...)),
|
|
|
|
grpc.StreamInterceptor(ot.StreamServerInterceptor(opts...)))
|
2021-02-23 03:40:30 +00:00
|
|
|
datapb.RegisterDataNodeServer(s.grpcServer, s)
|
2021-01-24 13:20:11 +00:00
|
|
|
|
2021-02-23 03:40:30 +00:00
|
|
|
ctx, cancel := context.WithCancel(s.ctx)
|
|
|
|
defer cancel()
|
2021-01-24 13:20:11 +00:00
|
|
|
|
2021-02-23 03:40:30 +00:00
|
|
|
go funcutil.CheckGrpcReady(ctx, s.grpcErrChan)
|
2021-04-28 10:43:48 +00:00
|
|
|
if err := s.grpcServer.Serve(listener); err != nil {
|
2021-02-26 02:13:36 +00:00
|
|
|
log.Warn("DataNode Start Grpc Failed!")
|
2021-02-23 03:40:30 +00:00
|
|
|
s.grpcErrChan <- err
|
2021-01-24 13:20:11 +00:00
|
|
|
}
|
2021-02-23 03:40:30 +00:00
|
|
|
|
2021-01-22 01:36:40 +00:00
|
|
|
}
|
|
|
|
|
2021-12-29 06:35:21 +00:00
|
|
|
func (s *Server) SetEtcdClient(client *clientv3.Client) {
|
|
|
|
s.datanode.SetEtcdClient(client)
|
|
|
|
}
|
|
|
|
|
2021-06-21 09:28:03 +00:00
|
|
|
func (s *Server) SetRootCoordInterface(ms types.RootCoord) error {
|
2021-10-09 02:10:59 +00:00
|
|
|
return s.datanode.SetRootCoord(ms)
|
2021-01-26 06:46:54 +00:00
|
|
|
}
|
|
|
|
|
2021-06-21 10:22:13 +00:00
|
|
|
func (s *Server) SetDataCoordInterface(ds types.DataCoord) error {
|
2021-10-09 02:10:59 +00:00
|
|
|
return s.datanode.SetDataCoord(ds)
|
2021-01-26 06:46:54 +00:00
|
|
|
}
|
|
|
|
|
2021-12-13 05:15:13 +00:00
|
|
|
// Run initializes and starts Datanode's grpc service.
|
2021-02-23 03:40:30 +00:00
|
|
|
func (s *Server) Run() error {
|
|
|
|
if err := s.init(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-10-27 06:54:59 +00:00
|
|
|
log.Debug("DataNode init done ...")
|
2021-02-23 03:40:30 +00:00
|
|
|
|
|
|
|
if err := s.start(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-10-27 06:54:59 +00:00
|
|
|
log.Debug("DataNode start done ...")
|
2021-02-23 03:40:30 +00:00
|
|
|
return nil
|
2021-01-22 01:36:40 +00:00
|
|
|
}
|
|
|
|
|
2021-12-10 14:51:23 +00:00
|
|
|
// Stop stops Datanode's grpc service.
|
2021-01-22 01:36:40 +00:00
|
|
|
func (s *Server) Stop() error {
|
2021-12-17 02:23:15 +00:00
|
|
|
log.Debug("Datanode stop", zap.String("Address", Params.GetAddress()))
|
2021-03-26 07:13:33 +00:00
|
|
|
if s.closer != nil {
|
|
|
|
if err := s.closer.Close(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-02-24 01:48:17 +00:00
|
|
|
}
|
2021-02-04 12:31:23 +00:00
|
|
|
s.cancel()
|
2021-12-29 06:35:21 +00:00
|
|
|
if s.etcdCli != nil {
|
|
|
|
defer s.etcdCli.Close()
|
|
|
|
}
|
2021-02-23 03:40:30 +00:00
|
|
|
if s.grpcServer != nil {
|
2021-12-08 07:09:42 +00:00
|
|
|
log.Debug("Graceful stop grpc server...")
|
2021-09-17 09:49:58 +00:00
|
|
|
// make graceful stop has a timeout
|
|
|
|
stopped := make(chan struct{})
|
|
|
|
go func() {
|
|
|
|
s.grpcServer.GracefulStop()
|
|
|
|
close(stopped)
|
|
|
|
}()
|
|
|
|
|
|
|
|
t := time.NewTimer(10 * time.Second)
|
|
|
|
select {
|
|
|
|
case <-t.C:
|
|
|
|
// hard stop since grace timeout
|
|
|
|
s.grpcServer.Stop()
|
|
|
|
case <-stopped:
|
|
|
|
t.Stop()
|
|
|
|
}
|
2021-02-23 03:40:30 +00:00
|
|
|
}
|
|
|
|
|
2021-03-05 12:41:34 +00:00
|
|
|
err := s.datanode.Stop()
|
2021-02-23 03:40:30 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
s.wg.Wait()
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-12-13 05:27:49 +00:00
|
|
|
// init initializes Datanode's grpc service.
|
2021-02-23 03:40:30 +00:00
|
|
|
func (s *Server) init() error {
|
2021-02-26 09:44:24 +00:00
|
|
|
ctx := context.Background()
|
2021-12-17 02:23:15 +00:00
|
|
|
Params.InitOnce(typeutil.DataNodeRole)
|
2021-02-23 03:40:30 +00:00
|
|
|
|
2021-09-23 02:53:53 +00:00
|
|
|
dn.Params.InitOnce()
|
2021-12-23 10:39:11 +00:00
|
|
|
dn.Params.DataNodeCfg.Port = Params.Port
|
|
|
|
dn.Params.DataNodeCfg.IP = Params.IP
|
2021-03-22 17:49:50 +00:00
|
|
|
|
2021-12-29 06:35:21 +00:00
|
|
|
etcdCli, err := etcd.GetEtcdClient(&dn.Params.BaseParams)
|
|
|
|
if err != nil {
|
|
|
|
log.Debug("DataNode connect to etcd failed", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
s.etcdCli = etcdCli
|
|
|
|
s.SetEtcdClient(s.etcdCli)
|
2021-03-26 07:13:33 +00:00
|
|
|
closer := trace.InitTracing(fmt.Sprintf("data_node ip: %s, port: %d", Params.IP, Params.Port))
|
2021-02-26 09:44:24 +00:00
|
|
|
s.closer = closer
|
2021-04-28 10:43:48 +00:00
|
|
|
addr := Params.IP + ":" + strconv.Itoa(Params.Port)
|
|
|
|
log.Debug("DataNode address", zap.String("address", addr))
|
2021-02-26 09:44:24 +00:00
|
|
|
|
2021-12-29 06:35:21 +00:00
|
|
|
err = s.startGrpc()
|
2021-02-23 03:40:30 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-06-22 11:08:03 +00:00
|
|
|
// --- RootCoord Client ---
|
2021-06-21 09:28:03 +00:00
|
|
|
if s.newRootCoordClient != nil {
|
|
|
|
log.Debug("Init root coord client ...")
|
2022-01-07 08:15:26 +00:00
|
|
|
rootCoordClient, err := s.newRootCoordClient(dn.Params.BaseParams.MetaRootPath, s.etcdCli)
|
2021-05-08 06:07:04 +00:00
|
|
|
if err != nil {
|
2021-06-21 09:28:03 +00:00
|
|
|
log.Debug("DataNode newRootCoordClient failed", zap.Error(err))
|
2021-05-08 06:07:04 +00:00
|
|
|
panic(err)
|
|
|
|
}
|
2021-06-21 09:28:03 +00:00
|
|
|
if err = rootCoordClient.Init(); err != nil {
|
|
|
|
log.Debug("DataNode rootCoordClient Init failed", zap.Error(err))
|
2021-05-08 06:07:04 +00:00
|
|
|
panic(err)
|
|
|
|
}
|
2021-06-21 09:28:03 +00:00
|
|
|
if err = rootCoordClient.Start(); err != nil {
|
|
|
|
log.Debug("DataNode rootCoordClient Start failed", zap.Error(err))
|
2021-05-08 06:07:04 +00:00
|
|
|
panic(err)
|
|
|
|
}
|
2021-06-21 09:28:03 +00:00
|
|
|
err = funcutil.WaitForComponentHealthy(ctx, rootCoordClient, "RootCoord", 1000000, time.Millisecond*200)
|
2021-05-08 06:07:04 +00:00
|
|
|
if err != nil {
|
2021-06-21 09:28:03 +00:00
|
|
|
log.Debug("DataNode wait rootCoord ready failed", zap.Error(err))
|
2021-05-08 06:07:04 +00:00
|
|
|
panic(err)
|
|
|
|
}
|
2021-06-21 09:28:03 +00:00
|
|
|
log.Debug("DataNode rootCoord is ready")
|
|
|
|
if err = s.SetRootCoordInterface(rootCoordClient); err != nil {
|
2021-05-08 06:07:04 +00:00
|
|
|
panic(err)
|
|
|
|
}
|
2021-02-23 03:40:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// --- Data Server Client ---
|
2021-06-21 10:22:13 +00:00
|
|
|
if s.newDataCoordClient != nil {
|
2021-05-08 06:07:04 +00:00
|
|
|
log.Debug("DataNode Init data service client ...")
|
2022-01-07 08:15:26 +00:00
|
|
|
dataCoordClient, err := s.newDataCoordClient(dn.Params.BaseParams.MetaRootPath, s.etcdCli)
|
2021-06-23 01:24:10 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Debug("DataNode newDataCoordClient failed", zap.Error(err))
|
|
|
|
panic(err)
|
|
|
|
}
|
2021-06-21 10:22:13 +00:00
|
|
|
if err = dataCoordClient.Init(); err != nil {
|
|
|
|
log.Debug("DataNode newDataCoord failed", zap.Error(err))
|
2021-05-08 06:07:04 +00:00
|
|
|
panic(err)
|
|
|
|
}
|
2021-06-21 10:22:13 +00:00
|
|
|
if err = dataCoordClient.Start(); err != nil {
|
|
|
|
log.Debug("DataNode dataCoordClient Start failed", zap.Error(err))
|
2021-05-08 06:07:04 +00:00
|
|
|
panic(err)
|
|
|
|
}
|
2021-06-21 10:22:13 +00:00
|
|
|
err = funcutil.WaitForComponentInitOrHealthy(ctx, dataCoordClient, "DataCoord", 1000000, time.Millisecond*200)
|
2021-05-08 06:07:04 +00:00
|
|
|
if err != nil {
|
2021-06-21 10:22:13 +00:00
|
|
|
log.Debug("DataNode wait dataCoordClient ready failed", zap.Error(err))
|
2021-05-08 06:07:04 +00:00
|
|
|
panic(err)
|
|
|
|
}
|
2021-06-21 10:22:13 +00:00
|
|
|
log.Debug("DataNode dataCoord is ready")
|
|
|
|
if err = s.SetDataCoordInterface(dataCoordClient); err != nil {
|
2021-05-08 06:07:04 +00:00
|
|
|
panic(err)
|
|
|
|
}
|
2021-02-23 03:40:30 +00:00
|
|
|
}
|
|
|
|
|
2021-12-23 10:39:11 +00:00
|
|
|
s.datanode.SetNodeID(dn.Params.DataNodeCfg.NodeID)
|
2021-03-12 06:22:09 +00:00
|
|
|
s.datanode.UpdateStateCode(internalpb.StateCode_Initializing)
|
2021-02-23 03:40:30 +00:00
|
|
|
|
2021-03-05 12:41:34 +00:00
|
|
|
if err := s.datanode.Init(); err != nil {
|
|
|
|
log.Warn("datanode init error: ", zap.Error(err))
|
2021-02-23 03:40:30 +00:00
|
|
|
return err
|
|
|
|
}
|
2021-06-03 06:58:34 +00:00
|
|
|
log.Debug("DataNode", zap.Any("State", internalpb.StateCode_Initializing))
|
2021-02-23 03:40:30 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-12-10 14:55:16 +00:00
|
|
|
// start starts datanode's grpc service.
|
2021-02-23 03:40:30 +00:00
|
|
|
func (s *Server) start() error {
|
2021-06-08 11:25:37 +00:00
|
|
|
if err := s.datanode.Start(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
err := s.datanode.Register()
|
|
|
|
if err != nil {
|
|
|
|
log.Debug("DataNode Register etcd failed", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
2021-01-22 01:36:40 +00:00
|
|
|
}
|
|
|
|
|
2021-12-13 01:31:38 +00:00
|
|
|
// GetComponentStates gets the component states of Datanode
|
2021-03-12 06:22:09 +00:00
|
|
|
func (s *Server) GetComponentStates(ctx context.Context, req *internalpb.GetComponentStatesRequest) (*internalpb.ComponentStates, error) {
|
2021-03-05 12:41:34 +00:00
|
|
|
return s.datanode.GetComponentStates(ctx)
|
2021-01-22 01:36:40 +00:00
|
|
|
}
|
|
|
|
|
2021-12-13 01:33:28 +00:00
|
|
|
// GetStatisticsChannel gets the statistics channel of Datanode.
|
2021-03-12 06:22:09 +00:00
|
|
|
func (s *Server) GetStatisticsChannel(ctx context.Context, req *internalpb.GetStatisticsChannelRequest) (*milvuspb.StringResponse, error) {
|
|
|
|
return s.datanode.GetStatisticsChannel(ctx)
|
2021-01-22 01:36:40 +00:00
|
|
|
}
|
|
|
|
|
2021-12-08 01:39:15 +00:00
|
|
|
// Deprecated
|
2021-03-12 06:22:09 +00:00
|
|
|
func (s *Server) WatchDmChannels(ctx context.Context, req *datapb.WatchDmChannelsRequest) (*commonpb.Status, error) {
|
|
|
|
return s.datanode.WatchDmChannels(ctx, req)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) FlushSegments(ctx context.Context, req *datapb.FlushSegmentsRequest) (*commonpb.Status, error) {
|
2021-10-09 02:10:59 +00:00
|
|
|
if s.datanode.GetStateCode() != internalpb.StateCode_Healthy {
|
2021-02-02 01:52:42 +00:00
|
|
|
return &commonpb.Status{
|
2021-03-10 14:06:22 +00:00
|
|
|
ErrorCode: commonpb.ErrorCode_UnexpectedError,
|
2021-02-02 01:52:42 +00:00
|
|
|
Reason: "DataNode isn't healthy.",
|
2021-03-05 02:15:27 +00:00
|
|
|
}, errors.New("DataNode is not ready yet")
|
2021-02-02 01:52:42 +00:00
|
|
|
}
|
2021-03-12 06:22:09 +00:00
|
|
|
return s.datanode.FlushSegments(ctx, req)
|
2021-01-19 03:37:16 +00:00
|
|
|
}
|
2021-09-01 02:13:15 +00:00
|
|
|
|
2021-12-13 01:25:30 +00:00
|
|
|
// GetMetrics gets the metrics info of Datanode.
|
2021-09-01 02:13:15 +00:00
|
|
|
func (s *Server) GetMetrics(ctx context.Context, request *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) {
|
|
|
|
return s.datanode.GetMetrics(ctx, request)
|
|
|
|
}
|
2021-11-05 14:25:00 +00:00
|
|
|
|
|
|
|
func (s *Server) Compaction(ctx context.Context, request *datapb.CompactionPlan) (*commonpb.Status, error) {
|
|
|
|
return s.datanode.Compaction(ctx, request)
|
|
|
|
}
|