2021-10-20 19:41:37 +08: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 10:09:43 +08:00
|
|
|
// with the License. You may obtain a copy of the License at
|
|
|
|
//
|
2021-10-20 19:41:37 +08:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2021-04-19 10:09:43 +08:00
|
|
|
//
|
2021-10-20 19:41:37 +08: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 10:09:43 +08:00
|
|
|
|
2021-06-22 14:40:07 +08:00
|
|
|
package grpcproxy
|
2021-01-22 09:36:18 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2021-02-26 17:44:24 +08:00
|
|
|
"fmt"
|
2021-02-23 09:58:06 +08:00
|
|
|
"io"
|
2021-01-22 09:36:18 +08:00
|
|
|
"net"
|
|
|
|
"strconv"
|
|
|
|
"sync"
|
2021-01-28 20:51:44 +08:00
|
|
|
"time"
|
|
|
|
|
2021-12-20 16:43:05 +08:00
|
|
|
ot "github.com/grpc-ecosystem/go-grpc-middleware/tracing/opentracing"
|
|
|
|
dcc "github.com/milvus-io/milvus/internal/distributed/datacoord/client"
|
|
|
|
icc "github.com/milvus-io/milvus/internal/distributed/indexcoord/client"
|
|
|
|
qcc "github.com/milvus-io/milvus/internal/distributed/querycoord/client"
|
2021-06-18 21:30:08 +08:00
|
|
|
rcc "github.com/milvus-io/milvus/internal/distributed/rootcoord/client"
|
2021-04-22 14:45:57 +08: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/internalpb"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/milvuspb"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/proxypb"
|
2021-06-22 14:40:07 +08:00
|
|
|
"github.com/milvus-io/milvus/internal/proxy"
|
2021-12-20 16:43:05 +08:00
|
|
|
"github.com/milvus-io/milvus/internal/types"
|
2021-04-22 14:45:57 +08:00
|
|
|
"github.com/milvus-io/milvus/internal/util/funcutil"
|
2021-12-17 10:23:15 +08:00
|
|
|
"github.com/milvus-io/milvus/internal/util/paramtable"
|
2021-04-22 14:45:57 +08:00
|
|
|
"github.com/milvus-io/milvus/internal/util/trace"
|
2021-12-17 10:23:15 +08:00
|
|
|
"github.com/milvus-io/milvus/internal/util/typeutil"
|
2021-02-23 11:40:30 +08:00
|
|
|
"github.com/opentracing/opentracing-go"
|
2021-12-20 16:43:05 +08:00
|
|
|
"go.uber.org/zap"
|
|
|
|
"google.golang.org/grpc"
|
2021-11-29 14:25:17 +08:00
|
|
|
"google.golang.org/grpc/keepalive"
|
2021-01-22 09:36:18 +08:00
|
|
|
)
|
|
|
|
|
2021-03-05 11:16:23 +08:00
|
|
|
const (
|
2021-11-29 19:57:57 +08:00
|
|
|
// GRPCMaxMagSize is the max size of grpc message.
|
2021-03-05 11:16:23 +08:00
|
|
|
GRPCMaxMagSize = 2 << 30
|
|
|
|
)
|
|
|
|
|
2021-12-17 10:23:15 +08:00
|
|
|
var Params paramtable.GrpcServerConfig
|
|
|
|
|
2021-11-29 19:57:57 +08:00
|
|
|
// Server is the Proxy Server
|
2021-01-22 09:36:18 +08:00
|
|
|
type Server struct {
|
2021-01-29 09:27:26 +08:00
|
|
|
ctx context.Context
|
|
|
|
wg sync.WaitGroup
|
2021-10-14 17:48:34 +08:00
|
|
|
proxy types.ProxyComponent
|
2021-01-29 09:27:26 +08:00
|
|
|
grpcServer *grpc.Server
|
2021-01-22 09:36:18 +08:00
|
|
|
|
2021-01-29 09:27:26 +08:00
|
|
|
grpcErrChan chan error
|
2021-01-28 20:51:44 +08:00
|
|
|
|
2021-10-14 17:48:34 +08:00
|
|
|
rootCoordClient types.RootCoord
|
|
|
|
dataCoordClient types.DataCoord
|
|
|
|
queryCooedClient types.QueryCoord
|
|
|
|
indexCoordClient types.IndexCoord
|
2021-02-23 09:58:06 +08:00
|
|
|
|
|
|
|
tracer opentracing.Tracer
|
|
|
|
closer io.Closer
|
2021-01-29 09:27:26 +08:00
|
|
|
}
|
2021-01-28 20:51:44 +08:00
|
|
|
|
2021-11-03 19:50:27 +08:00
|
|
|
// NewServer create a Proxy server.
|
2021-02-08 14:30:54 +08:00
|
|
|
func NewServer(ctx context.Context, factory msgstream.Factory) (*Server, error) {
|
2021-01-28 20:51:44 +08:00
|
|
|
|
2021-02-23 09:58:06 +08:00
|
|
|
var err error
|
2021-01-29 09:27:26 +08:00
|
|
|
server := &Server{
|
2021-01-29 17:08:31 +08:00
|
|
|
ctx: ctx,
|
2021-01-29 09:27:26 +08:00
|
|
|
grpcErrChan: make(chan error),
|
2021-01-28 20:51:44 +08:00
|
|
|
}
|
|
|
|
|
2021-06-22 14:40:07 +08:00
|
|
|
server.proxy, err = proxy.NewProxy(server.ctx, factory)
|
2021-01-28 20:51:44 +08:00
|
|
|
if err != nil {
|
2021-01-29 09:27:26 +08:00
|
|
|
return nil, err
|
2021-01-28 20:51:44 +08:00
|
|
|
}
|
2021-01-29 09:27:26 +08:00
|
|
|
return server, err
|
|
|
|
}
|
2021-01-28 20:51:44 +08:00
|
|
|
|
2021-01-29 09:27:26 +08:00
|
|
|
func (s *Server) startGrpcLoop(grpcPort int) {
|
2021-01-28 20:51:44 +08:00
|
|
|
|
2021-01-29 09:27:26 +08:00
|
|
|
defer s.wg.Done()
|
2021-01-28 20:51:44 +08:00
|
|
|
|
2021-11-29 14:25:17 +08: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-06-22 14:40:07 +08:00
|
|
|
log.Debug("proxy", zap.Int("network port", grpcPort))
|
2021-01-29 09:27:26 +08:00
|
|
|
lis, err := net.Listen("tcp", ":"+strconv.Itoa(grpcPort))
|
2021-01-28 20:51:44 +08:00
|
|
|
if err != nil {
|
2021-06-22 14:40:07 +08:00
|
|
|
log.Warn("proxy", zap.String("Server:failed to listen:", err.Error()))
|
2021-01-29 09:27:26 +08:00
|
|
|
s.grpcErrChan <- err
|
|
|
|
return
|
2021-01-28 20:51:44 +08:00
|
|
|
}
|
|
|
|
|
2021-01-29 09:27:26 +08:00
|
|
|
ctx, cancel := context.WithCancel(s.ctx)
|
|
|
|
defer cancel()
|
2021-01-28 20:51:44 +08:00
|
|
|
|
2021-06-17 14:17:56 +08:00
|
|
|
opts := trace.GetInterceptorOpts()
|
2021-03-08 15:49:42 +08:00
|
|
|
s.grpcServer = grpc.NewServer(
|
2021-11-29 14:25:17 +08:00
|
|
|
grpc.KeepaliveEnforcementPolicy(kaep),
|
|
|
|
grpc.KeepaliveParams(kasp),
|
2021-08-04 13:03:24 +08:00
|
|
|
grpc.MaxRecvMsgSize(Params.ServerMaxRecvSize),
|
|
|
|
grpc.MaxSendMsgSize(Params.ServerMaxSendSize),
|
2021-06-17 14:17:56 +08:00
|
|
|
grpc.MaxRecvMsgSize(GRPCMaxMagSize),
|
2021-12-20 16:43:05 +08:00
|
|
|
grpc.UnaryInterceptor(ot.UnaryServerInterceptor(opts...)),
|
|
|
|
grpc.StreamInterceptor(ot.StreamServerInterceptor(opts...)))
|
2021-06-22 16:14:09 +08:00
|
|
|
proxypb.RegisterProxyServer(s.grpcServer, s)
|
2021-01-29 09:27:26 +08:00
|
|
|
milvuspb.RegisterMilvusServiceServer(s.grpcServer, s)
|
2021-01-28 20:51:44 +08:00
|
|
|
|
2021-01-29 09:27:26 +08:00
|
|
|
go funcutil.CheckGrpcReady(ctx, s.grpcErrChan)
|
|
|
|
if err := s.grpcServer.Serve(lis); err != nil {
|
|
|
|
s.grpcErrChan <- err
|
2021-01-28 20:51:44 +08:00
|
|
|
}
|
|
|
|
|
2021-01-29 09:27:26 +08:00
|
|
|
}
|
2021-01-28 20:51:44 +08:00
|
|
|
|
2021-11-29 19:57:57 +08:00
|
|
|
// Start start the Proxy Server
|
2021-01-29 09:27:26 +08:00
|
|
|
func (s *Server) Run() error {
|
2021-01-28 20:51:44 +08:00
|
|
|
|
2021-01-29 09:27:26 +08:00
|
|
|
if err := s.init(); err != nil {
|
2021-01-29 17:29:31 +08:00
|
|
|
return err
|
2021-01-28 20:51:44 +08:00
|
|
|
}
|
2021-10-27 14:56:48 +08:00
|
|
|
log.Debug("Proxy node init done ...")
|
2021-01-28 20:51:44 +08:00
|
|
|
|
2021-01-29 09:27:26 +08:00
|
|
|
if err := s.start(); err != nil {
|
2021-01-28 20:51:44 +08:00
|
|
|
return err
|
|
|
|
}
|
2021-10-27 14:56:48 +08:00
|
|
|
log.Debug("Proxy node start done ...")
|
2021-01-28 20:51:44 +08:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-01-29 09:27:26 +08:00
|
|
|
func (s *Server) init() error {
|
|
|
|
var err error
|
2021-12-17 10:23:15 +08:00
|
|
|
Params.InitOnce(typeutil.ProxyRole)
|
2021-01-22 12:57:23 +08:00
|
|
|
|
2021-09-23 10:53:53 +08:00
|
|
|
proxy.Params.InitOnce()
|
2021-03-23 01:49:50 +08:00
|
|
|
log.Debug("init params done ...")
|
2021-08-31 10:25:59 +08:00
|
|
|
|
|
|
|
// NetworkPort & IP don't matter here, NetworkAddress matters
|
2021-06-22 14:40:07 +08:00
|
|
|
proxy.Params.NetworkPort = Params.Port
|
|
|
|
proxy.Params.IP = Params.IP
|
2021-08-31 10:25:59 +08:00
|
|
|
|
2021-12-17 10:23:15 +08:00
|
|
|
proxy.Params.NetworkAddress = Params.GetAddress()
|
2021-01-29 17:29:31 +08:00
|
|
|
|
2021-06-22 19:08:03 +08:00
|
|
|
closer := trace.InitTracing(fmt.Sprintf("proxy ip: %s, port: %d", Params.IP, Params.Port))
|
2021-02-26 17:44:24 +08:00
|
|
|
s.closer = closer
|
|
|
|
|
2021-06-22 14:40:07 +08:00
|
|
|
log.Debug("proxy", zap.String("proxy host", Params.IP))
|
|
|
|
log.Debug("proxy", zap.Int("proxy port", Params.Port))
|
2021-12-17 10:23:15 +08:00
|
|
|
log.Debug("proxy", zap.String("proxy address", Params.GetAddress()))
|
2021-03-23 01:49:50 +08:00
|
|
|
|
2021-01-29 09:27:26 +08:00
|
|
|
s.wg.Add(1)
|
2021-01-29 17:08:31 +08:00
|
|
|
go s.startGrpcLoop(Params.Port)
|
2021-01-29 09:27:26 +08:00
|
|
|
// wait for grpc server loop start
|
|
|
|
err = <-s.grpcErrChan
|
2021-03-10 09:56:09 +08:00
|
|
|
log.Debug("create grpc server ...")
|
2021-01-29 09:27:26 +08:00
|
|
|
if err != nil {
|
|
|
|
return err
|
2021-01-22 12:57:23 +08:00
|
|
|
}
|
2021-01-29 09:27:26 +08:00
|
|
|
|
2021-10-14 17:48:34 +08:00
|
|
|
if s.rootCoordClient == nil {
|
|
|
|
s.rootCoordClient, err = rcc.NewClient(s.ctx, proxy.Params.MetaRootPath, proxy.Params.EtcdEndpoints)
|
|
|
|
if err != nil {
|
|
|
|
log.Debug("Proxy new rootCoordClient failed ", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
2021-01-22 12:57:23 +08:00
|
|
|
}
|
2021-06-18 21:30:08 +08:00
|
|
|
err = s.rootCoordClient.Init()
|
2021-01-22 12:57:23 +08:00
|
|
|
if err != nil {
|
2021-06-22 14:40:07 +08:00
|
|
|
log.Debug("Proxy new rootCoordClient Init ", zap.Error(err))
|
2021-01-29 09:27:26 +08:00
|
|
|
return err
|
2021-01-22 12:57:23 +08:00
|
|
|
}
|
2021-06-18 21:30:08 +08:00
|
|
|
err = funcutil.WaitForComponentHealthy(s.ctx, s.rootCoordClient, "RootCoord", 1000000, time.Millisecond*200)
|
2021-03-04 22:27:12 +08:00
|
|
|
if err != nil {
|
2021-06-22 14:40:07 +08:00
|
|
|
log.Debug("Proxy WaitForComponentHealthy RootCoord failed ", zap.Error(err))
|
2021-03-04 22:27:12 +08:00
|
|
|
panic(err)
|
|
|
|
}
|
2021-06-22 14:40:07 +08:00
|
|
|
s.proxy.SetRootCoordClient(s.rootCoordClient)
|
2021-06-21 17:28:03 +08:00
|
|
|
log.Debug("set rootcoord client ...")
|
2021-01-22 12:57:23 +08:00
|
|
|
|
2021-10-14 17:48:34 +08:00
|
|
|
if s.dataCoordClient == nil {
|
2021-12-20 16:43:05 +08:00
|
|
|
s.dataCoordClient, err = dcc.NewClient(s.ctx, proxy.Params.MetaRootPath, proxy.Params.EtcdEndpoints)
|
2021-10-14 17:48:34 +08:00
|
|
|
if err != nil {
|
|
|
|
log.Debug("Proxy new dataCoordClient failed ", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
2021-06-23 09:24:10 +08:00
|
|
|
}
|
2021-06-21 18:22:13 +08:00
|
|
|
err = s.dataCoordClient.Init()
|
2021-01-29 09:27:26 +08:00
|
|
|
if err != nil {
|
2021-06-22 14:40:07 +08:00
|
|
|
log.Debug("Proxy dataCoordClient init failed ", zap.Error(err))
|
2021-01-29 09:27:26 +08:00
|
|
|
return err
|
|
|
|
}
|
2021-06-22 16:44:09 +08:00
|
|
|
|
2021-06-22 14:40:07 +08:00
|
|
|
s.proxy.SetDataCoordClient(s.dataCoordClient)
|
2021-06-22 16:44:09 +08:00
|
|
|
log.Debug("set data coordinator address ...")
|
2021-01-29 09:27:26 +08:00
|
|
|
|
2021-10-14 17:48:34 +08:00
|
|
|
if s.indexCoordClient == nil {
|
2021-12-20 16:43:05 +08:00
|
|
|
s.indexCoordClient, err = icc.NewClient(s.ctx, proxy.Params.MetaRootPath, proxy.Params.EtcdEndpoints)
|
2021-10-14 17:48:34 +08:00
|
|
|
if err != nil {
|
|
|
|
log.Debug("Proxy new indexCoordClient failed ", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
2021-06-23 09:24:10 +08:00
|
|
|
}
|
2021-06-21 17:28:03 +08:00
|
|
|
err = s.indexCoordClient.Init()
|
2021-01-22 09:36:18 +08:00
|
|
|
if err != nil {
|
2021-06-22 14:40:07 +08:00
|
|
|
log.Debug("Proxy indexCoordClient init failed ", zap.Error(err))
|
2021-01-22 09:36:18 +08:00
|
|
|
return err
|
|
|
|
}
|
2021-06-22 16:44:09 +08:00
|
|
|
|
2021-06-22 14:40:07 +08:00
|
|
|
s.proxy.SetIndexCoordClient(s.indexCoordClient)
|
2021-06-22 16:44:09 +08:00
|
|
|
log.Debug("set index coordinator client ...")
|
2021-01-29 17:29:31 +08:00
|
|
|
|
2021-10-14 17:48:34 +08:00
|
|
|
if s.queryCooedClient == nil {
|
2021-12-20 16:43:05 +08:00
|
|
|
s.queryCooedClient, err = qcc.NewClient(s.ctx, proxy.Params.MetaRootPath, proxy.Params.EtcdEndpoints)
|
2021-10-14 17:48:34 +08:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-02-05 10:29:14 +08:00
|
|
|
}
|
2021-06-22 16:44:09 +08:00
|
|
|
err = s.queryCooedClient.Init()
|
2021-02-05 10:29:14 +08:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-06-22 16:44:09 +08:00
|
|
|
s.proxy.SetQueryCoordClient(s.queryCooedClient)
|
|
|
|
log.Debug("set query coordinator client ...")
|
2021-01-22 09:36:18 +08:00
|
|
|
|
2021-06-22 14:40:07 +08:00
|
|
|
s.proxy.UpdateStateCode(internalpb.StateCode_Initializing)
|
|
|
|
log.Debug("proxy", zap.Any("state of proxy", internalpb.StateCode_Initializing))
|
2021-01-22 09:36:18 +08:00
|
|
|
|
2021-06-22 14:40:07 +08:00
|
|
|
if err := s.proxy.Init(); err != nil {
|
|
|
|
log.Debug("proxy", zap.String("proxy init error", err.Error()))
|
2021-01-29 09:27:26 +08:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
2021-01-22 09:36:18 +08:00
|
|
|
|
2021-01-29 09:27:26 +08:00
|
|
|
func (s *Server) start() error {
|
2021-12-15 11:47:10 +08:00
|
|
|
err := s.proxy.Start()
|
|
|
|
if err != nil {
|
|
|
|
log.Error("Proxy start failed", zap.Error(err))
|
|
|
|
}
|
|
|
|
err = s.proxy.Register()
|
|
|
|
if err != nil {
|
|
|
|
log.Error("Proxy register service failed ", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-11-29 19:57:57 +08:00
|
|
|
// Stop stop the Proxy Server
|
2021-01-22 09:36:18 +08:00
|
|
|
func (s *Server) Stop() error {
|
2021-12-17 10:23:15 +08:00
|
|
|
log.Debug("Proxy stop", zap.String("Address", Params.GetAddress()))
|
2021-01-22 09:36:18 +08:00
|
|
|
var err error
|
2021-03-26 15:13:33 +08:00
|
|
|
if s.closer != nil {
|
|
|
|
if err = s.closer.Close(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
2021-01-22 09:36:18 +08:00
|
|
|
|
|
|
|
if s.grpcServer != nil {
|
2021-12-07 09:51:56 +08:00
|
|
|
log.Debug("Graceful stop grpc server...")
|
2021-01-22 09:36:18 +08:00
|
|
|
s.grpcServer.GracefulStop()
|
|
|
|
}
|
|
|
|
|
2021-06-22 14:40:07 +08:00
|
|
|
err = s.proxy.Stop()
|
2021-01-22 09:36:18 +08:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
s.wg.Wait()
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-11-29 19:57:57 +08:00
|
|
|
// GetComponentStates get the component states
|
2021-03-12 14:22:09 +08:00
|
|
|
func (s *Server) GetComponentStates(ctx context.Context, request *internalpb.GetComponentStatesRequest) (*internalpb.ComponentStates, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.GetComponentStates(ctx)
|
2021-03-12 14:22:09 +08:00
|
|
|
}
|
|
|
|
|
2021-11-29 19:57:57 +08:00
|
|
|
// GetStatisticsChannel get the statistics channel
|
2021-03-12 14:22:09 +08:00
|
|
|
func (s *Server) GetStatisticsChannel(ctx context.Context, request *internalpb.GetStatisticsChannelRequest) (*milvuspb.StringResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.GetStatisticsChannel(ctx)
|
2021-03-12 14:22:09 +08:00
|
|
|
}
|
|
|
|
|
2021-11-29 19:57:57 +08:00
|
|
|
// InvalidateCollectionMetaCache notifies Proxy to clear all the meta cache of specific collection.
|
2021-01-22 09:36:18 +08:00
|
|
|
func (s *Server) InvalidateCollectionMetaCache(ctx context.Context, request *proxypb.InvalidateCollMetaCacheRequest) (*commonpb.Status, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.InvalidateCollectionMetaCache(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-11-29 19:57:57 +08:00
|
|
|
// ReleaseDQLMessageStream notifies Proxy to release and close the search message stream of specific collection.
|
2021-06-18 10:33:58 +08:00
|
|
|
func (s *Server) ReleaseDQLMessageStream(ctx context.Context, request *proxypb.ReleaseDQLMessageStreamRequest) (*commonpb.Status, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.ReleaseDQLMessageStream(ctx, request)
|
2021-06-17 17:45:56 +08:00
|
|
|
}
|
|
|
|
|
2021-11-29 19:57:57 +08:00
|
|
|
// CreateCollection notifies Proxy to create a collection
|
2021-01-22 09:36:18 +08:00
|
|
|
func (s *Server) CreateCollection(ctx context.Context, request *milvuspb.CreateCollectionRequest) (*commonpb.Status, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.CreateCollection(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-11-29 19:57:57 +08:00
|
|
|
// DropCollection notifies Proxy to drop a collection
|
2021-01-22 09:36:18 +08:00
|
|
|
func (s *Server) DropCollection(ctx context.Context, request *milvuspb.DropCollectionRequest) (*commonpb.Status, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.DropCollection(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-11-29 19:57:57 +08:00
|
|
|
// HasCollection notifies Proxy to check a collection's existence at specified timestamp
|
2021-01-22 09:36:18 +08:00
|
|
|
func (s *Server) HasCollection(ctx context.Context, request *milvuspb.HasCollectionRequest) (*milvuspb.BoolResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.HasCollection(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-11-29 19:57:57 +08:00
|
|
|
// LoadCollection notifies Proxy to load a collection's data
|
2021-01-22 09:36:18 +08:00
|
|
|
func (s *Server) LoadCollection(ctx context.Context, request *milvuspb.LoadCollectionRequest) (*commonpb.Status, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.LoadCollection(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-12-14 11:59:10 +08:00
|
|
|
// ReleaseCollection notifies Proxy to release a collection's data
|
2021-01-22 09:36:18 +08:00
|
|
|
func (s *Server) ReleaseCollection(ctx context.Context, request *milvuspb.ReleaseCollectionRequest) (*commonpb.Status, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.ReleaseCollection(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-12-15 17:01:49 +08:00
|
|
|
// DescribeCollection notifies Proxy to describe a collection
|
2021-01-22 09:36:18 +08:00
|
|
|
func (s *Server) DescribeCollection(ctx context.Context, request *milvuspb.DescribeCollectionRequest) (*milvuspb.DescribeCollectionResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.DescribeCollection(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-12-15 16:59:56 +08:00
|
|
|
// GetCollectionStatistics notifies Proxy to get a collection's Statistics
|
2021-03-12 14:22:09 +08:00
|
|
|
func (s *Server) GetCollectionStatistics(ctx context.Context, request *milvuspb.GetCollectionStatisticsRequest) (*milvuspb.GetCollectionStatisticsResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.GetCollectionStatistics(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-03-12 14:22:09 +08:00
|
|
|
func (s *Server) ShowCollections(ctx context.Context, request *milvuspb.ShowCollectionsRequest) (*milvuspb.ShowCollectionsResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.ShowCollections(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-12-14 16:19:33 +08:00
|
|
|
// CreatePartition notifies Proxy to create a partition
|
2021-01-22 09:36:18 +08:00
|
|
|
func (s *Server) CreatePartition(ctx context.Context, request *milvuspb.CreatePartitionRequest) (*commonpb.Status, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.CreatePartition(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-12-14 16:21:22 +08:00
|
|
|
// DropPartition notifies Proxy to drop a partition
|
2021-01-22 09:36:18 +08:00
|
|
|
func (s *Server) DropPartition(ctx context.Context, request *milvuspb.DropPartitionRequest) (*commonpb.Status, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.DropPartition(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) HasPartition(ctx context.Context, request *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.HasPartition(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-12-15 12:00:20 +08:00
|
|
|
// LoadPartitions notifies Proxy to load the partitions data
|
2021-03-12 14:22:09 +08:00
|
|
|
func (s *Server) LoadPartitions(ctx context.Context, request *milvuspb.LoadPartitionsRequest) (*commonpb.Status, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.LoadPartitions(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-12-16 16:33:44 +08:00
|
|
|
// ReleasePartitions notifies Proxy to release the partitions data
|
2021-03-12 14:22:09 +08:00
|
|
|
func (s *Server) ReleasePartitions(ctx context.Context, request *milvuspb.ReleasePartitionsRequest) (*commonpb.Status, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.ReleasePartitions(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-12-16 16:37:27 +08:00
|
|
|
// GetPartitionStatistics notifies Proxy to get the partitions Statistics info.
|
2021-03-12 14:22:09 +08:00
|
|
|
func (s *Server) GetPartitionStatistics(ctx context.Context, request *milvuspb.GetPartitionStatisticsRequest) (*milvuspb.GetPartitionStatisticsResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.GetPartitionStatistics(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-12-16 20:47:14 +08:00
|
|
|
// ShowPartitions notifies Proxy to show the partitions
|
2021-03-12 14:22:09 +08:00
|
|
|
func (s *Server) ShowPartitions(ctx context.Context, request *milvuspb.ShowPartitionsRequest) (*milvuspb.ShowPartitionsResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.ShowPartitions(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-12-17 14:27:30 +08:00
|
|
|
// CreateIndex notifies Proxy to create index
|
2021-01-22 09:36:18 +08:00
|
|
|
func (s *Server) CreateIndex(ctx context.Context, request *milvuspb.CreateIndexRequest) (*commonpb.Status, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.CreateIndex(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-12-17 14:30:27 +08:00
|
|
|
// DropIndex notifies Proxy to drop index
|
2021-02-20 18:30:37 +08:00
|
|
|
func (s *Server) DropIndex(ctx context.Context, request *milvuspb.DropIndexRequest) (*commonpb.Status, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.DropIndex(ctx, request)
|
2021-02-20 18:30:37 +08:00
|
|
|
}
|
|
|
|
|
2021-01-22 09:36:18 +08:00
|
|
|
func (s *Server) DescribeIndex(ctx context.Context, request *milvuspb.DescribeIndexRequest) (*milvuspb.DescribeIndexResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.DescribeIndex(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-04-27 15:46:45 +08:00
|
|
|
// GetIndexBuildProgress gets index build progress with filed_name and index_name.
|
|
|
|
// IndexRows is the num of indexed rows. And TotalRows is the total number of segment rows.
|
|
|
|
func (s *Server) GetIndexBuildProgress(ctx context.Context, request *milvuspb.GetIndexBuildProgressRequest) (*milvuspb.GetIndexBuildProgressResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.GetIndexBuildProgress(ctx, request)
|
2021-04-27 15:46:45 +08:00
|
|
|
}
|
|
|
|
|
2021-12-21 15:25:08 +08:00
|
|
|
// GetIndexStates gets the index states from proxy.
|
2021-03-12 14:22:09 +08:00
|
|
|
func (s *Server) GetIndexState(ctx context.Context, request *milvuspb.GetIndexStateRequest) (*milvuspb.GetIndexStateResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.GetIndexState(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-06-21 11:42:18 +08:00
|
|
|
func (s *Server) Insert(ctx context.Context, request *milvuspb.InsertRequest) (*milvuspb.MutationResult, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.Insert(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-08-26 12:15:52 +08:00
|
|
|
func (s *Server) Delete(ctx context.Context, request *milvuspb.DeleteRequest) (*milvuspb.MutationResult, error) {
|
|
|
|
return s.proxy.Delete(ctx, request)
|
|
|
|
}
|
|
|
|
|
2021-01-22 09:36:18 +08:00
|
|
|
func (s *Server) Search(ctx context.Context, request *milvuspb.SearchRequest) (*milvuspb.SearchResults, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.Search(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-06-23 16:56:11 +08:00
|
|
|
func (s *Server) Flush(ctx context.Context, request *milvuspb.FlushRequest) (*milvuspb.FlushResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.Flush(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
|
|
|
|
2021-06-04 12:02:34 +08:00
|
|
|
func (s *Server) Query(ctx context.Context, request *milvuspb.QueryRequest) (*milvuspb.QueryResults, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.Query(ctx, request)
|
2021-06-04 12:02:34 +08:00
|
|
|
}
|
|
|
|
|
2021-07-01 18:56:17 +08:00
|
|
|
func (s *Server) CalcDistance(ctx context.Context, request *milvuspb.CalcDistanceRequest) (*milvuspb.CalcDistanceResults, error) {
|
|
|
|
return s.proxy.CalcDistance(ctx, request)
|
|
|
|
}
|
|
|
|
|
2021-03-12 14:22:09 +08:00
|
|
|
func (s *Server) GetDdChannel(ctx context.Context, request *internalpb.GetDdChannelRequest) (*milvuspb.StringResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.GetDdChannel(ctx, request)
|
2021-01-22 09:36:18 +08:00
|
|
|
}
|
2021-02-03 18:55:00 +08:00
|
|
|
|
2021-03-12 14:22:09 +08:00
|
|
|
func (s *Server) GetPersistentSegmentInfo(ctx context.Context, request *milvuspb.GetPersistentSegmentInfoRequest) (*milvuspb.GetPersistentSegmentInfoResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.GetPersistentSegmentInfo(ctx, request)
|
2021-02-03 18:55:00 +08:00
|
|
|
}
|
2021-02-04 14:37:12 +08:00
|
|
|
|
2021-12-21 11:55:31 +08:00
|
|
|
//GetQuerySegmentInfo notifies Proxy to get query segment info.
|
2021-03-12 14:22:09 +08:00
|
|
|
func (s *Server) GetQuerySegmentInfo(ctx context.Context, request *milvuspb.GetQuerySegmentInfoRequest) (*milvuspb.GetQuerySegmentInfoResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.GetQuerySegmentInfo(ctx, request)
|
2021-02-04 14:37:12 +08:00
|
|
|
|
|
|
|
}
|
2021-03-04 22:27:12 +08:00
|
|
|
|
2021-05-25 14:44:43 +08:00
|
|
|
func (s *Server) Dummy(ctx context.Context, request *milvuspb.DummyRequest) (*milvuspb.DummyResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.Dummy(ctx, request)
|
2021-05-25 14:44:43 +08:00
|
|
|
}
|
|
|
|
|
2021-03-12 14:22:09 +08:00
|
|
|
func (s *Server) RegisterLink(ctx context.Context, request *milvuspb.RegisterLinkRequest) (*milvuspb.RegisterLinkResponse, error) {
|
2021-06-22 14:40:07 +08:00
|
|
|
return s.proxy.RegisterLink(ctx, request)
|
2021-03-04 22:27:12 +08:00
|
|
|
}
|
2021-08-18 10:12:10 +08:00
|
|
|
|
2021-12-20 18:58:50 +08:00
|
|
|
// GetMetrics gets the metrics info of proxy.
|
2021-08-18 10:12:10 +08:00
|
|
|
func (s *Server) GetMetrics(ctx context.Context, request *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) {
|
|
|
|
return s.proxy.GetMetrics(ctx, request)
|
|
|
|
}
|
2021-09-18 11:13:51 +08:00
|
|
|
|
2021-11-06 16:54:59 +08:00
|
|
|
func (s *Server) LoadBalance(ctx context.Context, request *milvuspb.LoadBalanceRequest) (*commonpb.Status, error) {
|
|
|
|
return s.proxy.LoadBalance(ctx, request)
|
|
|
|
}
|
|
|
|
|
2021-12-20 19:16:37 +08:00
|
|
|
// CreateAlias notifies Proxy to create alias
|
2021-09-18 11:13:51 +08:00
|
|
|
func (s *Server) CreateAlias(ctx context.Context, request *milvuspb.CreateAliasRequest) (*commonpb.Status, error) {
|
|
|
|
return s.proxy.CreateAlias(ctx, request)
|
|
|
|
}
|
|
|
|
|
2021-12-21 15:12:55 +08:00
|
|
|
// DropAlias notifies Proxy to drop an alias
|
2021-09-18 11:13:51 +08:00
|
|
|
func (s *Server) DropAlias(ctx context.Context, request *milvuspb.DropAliasRequest) (*commonpb.Status, error) {
|
|
|
|
return s.proxy.DropAlias(ctx, request)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) AlterAlias(ctx context.Context, request *milvuspb.AlterAliasRequest) (*commonpb.Status, error) {
|
|
|
|
return s.proxy.AlterAlias(ctx, request)
|
|
|
|
}
|
2021-11-09 14:47:02 +08:00
|
|
|
|
|
|
|
func (s *Server) GetCompactionState(ctx context.Context, req *milvuspb.GetCompactionStateRequest) (*milvuspb.GetCompactionStateResponse, error) {
|
|
|
|
return s.proxy.GetCompactionState(ctx, req)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) ManualCompaction(ctx context.Context, req *milvuspb.ManualCompactionRequest) (*milvuspb.ManualCompactionResponse, error) {
|
|
|
|
return s.proxy.ManualCompaction(ctx, req)
|
|
|
|
}
|
|
|
|
|
2021-12-22 19:13:14 +08:00
|
|
|
// GetCompactionStateWithPlans gets the state of a compaction by plan
|
2021-11-09 14:47:02 +08:00
|
|
|
func (s *Server) GetCompactionStateWithPlans(ctx context.Context, req *milvuspb.GetCompactionPlansRequest) (*milvuspb.GetCompactionPlansResponse, error) {
|
|
|
|
return s.proxy.GetCompactionStateWithPlans(ctx, req)
|
|
|
|
}
|
2021-11-23 10:55:14 +08:00
|
|
|
|
|
|
|
func (s *Server) GetFlushState(ctx context.Context, req *milvuspb.GetFlushStateRequest) (*milvuspb.GetFlushStateResponse, error) {
|
|
|
|
return s.proxy.GetFlushState(ctx, req)
|
|
|
|
}
|