2021-10-22 06:03:30 +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 05:47:10 +00:00
|
|
|
// with the License. You may obtain a copy of the License at
|
|
|
|
//
|
2021-10-22 06:03:30 +00:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2021-04-19 05:47:10 +00:00
|
|
|
//
|
2021-10-22 06:03:30 +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 05:47:10 +00:00
|
|
|
|
2021-01-22 06:28:06 +00:00
|
|
|
package grpcquerynode
|
2021-01-15 07:28:54 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2021-02-26 09:44:24 +00:00
|
|
|
"fmt"
|
2021-01-15 07:28:54 +00:00
|
|
|
"net"
|
2021-02-23 03:40:30 +00:00
|
|
|
"strconv"
|
2021-02-02 01:52:42 +00:00
|
|
|
"sync"
|
2021-02-23 03:40:30 +00:00
|
|
|
"time"
|
|
|
|
|
2022-08-23 02:44:52 +00:00
|
|
|
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
|
2022-04-02 06:15:31 +00:00
|
|
|
clientv3 "go.etcd.io/etcd/client/v3"
|
2023-01-12 08:09:39 +00:00
|
|
|
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
2023-08-20 13:24:19 +00:00
|
|
|
"go.uber.org/atomic"
|
2022-04-02 06:15:31 +00:00
|
|
|
"go.uber.org/zap"
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
"google.golang.org/grpc/keepalive"
|
|
|
|
|
2023-06-08 17:28:37 +00:00
|
|
|
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
|
|
|
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
|
2023-09-26 02:15:25 +00:00
|
|
|
"github.com/milvus-io/milvus/internal/distributed/utils"
|
2021-04-22 06:45:57 +00:00
|
|
|
"github.com/milvus-io/milvus/internal/proto/internalpb"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/querypb"
|
2023-03-26 16:42:00 +00:00
|
|
|
qn "github.com/milvus-io/milvus/internal/querynodev2"
|
2021-12-17 02:23:15 +00:00
|
|
|
"github.com/milvus-io/milvus/internal/types"
|
2023-09-21 01:45:27 +00:00
|
|
|
"github.com/milvus-io/milvus/internal/util/dependency"
|
2023-10-24 14:14:14 +00:00
|
|
|
_ "github.com/milvus-io/milvus/internal/util/grpcclient"
|
2023-04-06 11:14:32 +00:00
|
|
|
"github.com/milvus-io/milvus/pkg/log"
|
2023-09-21 01:45:27 +00:00
|
|
|
"github.com/milvus-io/milvus/pkg/tracer"
|
2023-04-06 11:14:32 +00:00
|
|
|
"github.com/milvus-io/milvus/pkg/util/etcd"
|
|
|
|
"github.com/milvus-io/milvus/pkg/util/funcutil"
|
2023-09-21 01:45:27 +00:00
|
|
|
"github.com/milvus-io/milvus/pkg/util/interceptor"
|
2023-04-06 11:14:32 +00:00
|
|
|
"github.com/milvus-io/milvus/pkg/util/logutil"
|
|
|
|
"github.com/milvus-io/milvus/pkg/util/paramtable"
|
|
|
|
"github.com/milvus-io/milvus/pkg/util/retry"
|
|
|
|
"github.com/milvus-io/milvus/pkg/util/typeutil"
|
2021-01-15 07:28:54 +00:00
|
|
|
)
|
|
|
|
|
2021-10-12 11:29:22 +00:00
|
|
|
// UniqueID is an alias for type typeutil.UniqueID, used as a unique identifier for the request.
|
2021-02-23 03:40:30 +00:00
|
|
|
type UniqueID = typeutil.UniqueID
|
|
|
|
|
2021-10-12 11:21:08 +00:00
|
|
|
// Server is the grpc server of QueryNode.
|
2021-01-15 07:28:54 +00:00
|
|
|
type Server struct {
|
2021-10-11 09:16:30 +00:00
|
|
|
querynode types.QueryNodeComponent
|
2021-02-23 03:40:30 +00:00
|
|
|
wg sync.WaitGroup
|
|
|
|
ctx context.Context
|
|
|
|
cancel context.CancelFunc
|
|
|
|
grpcErrChan chan error
|
2021-02-02 01:52:42 +00:00
|
|
|
|
2023-08-20 13:24:19 +00:00
|
|
|
serverID atomic.Int64
|
|
|
|
|
2021-01-15 07:28:54 +00:00
|
|
|
grpcServer *grpc.Server
|
|
|
|
|
2022-02-08 13:57:46 +00:00
|
|
|
etcdCli *clientv3.Client
|
2021-02-02 01:52:42 +00:00
|
|
|
}
|
2021-01-27 01:50:52 +00:00
|
|
|
|
2022-07-18 01:58:28 +00:00
|
|
|
func (s *Server) GetStatistics(ctx context.Context, request *querypb.GetStatisticsRequest) (*internalpb.GetStatisticsResponse, error) {
|
|
|
|
return s.querynode.GetStatistics(ctx, request)
|
|
|
|
}
|
|
|
|
|
2021-10-12 11:21:08 +00:00
|
|
|
// NewServer create a new QueryNode grpc server.
|
2022-04-07 14:05:32 +00:00
|
|
|
func NewServer(ctx context.Context, factory dependency.Factory) (*Server, error) {
|
2021-02-23 03:40:30 +00:00
|
|
|
ctx1, cancel := context.WithCancel(ctx)
|
|
|
|
|
2021-02-02 01:52:42 +00:00
|
|
|
s := &Server{
|
2021-02-23 03:40:30 +00:00
|
|
|
ctx: ctx1,
|
|
|
|
cancel: cancel,
|
2021-07-13 06:16:00 +00:00
|
|
|
querynode: qn.NewQueryNode(ctx, factory),
|
2021-02-23 03:40:30 +00:00
|
|
|
grpcErrChan: make(chan error),
|
2021-01-27 06:41:56 +00:00
|
|
|
}
|
2021-02-23 03:40:30 +00:00
|
|
|
return s, nil
|
|
|
|
}
|
2021-01-27 06:41:56 +00:00
|
|
|
|
2021-10-12 11:27:30 +00:00
|
|
|
// init initializes QueryNode's grpc service.
|
2021-02-23 03:40:30 +00:00
|
|
|
func (s *Server) init() error {
|
2022-12-16 07:59:23 +00:00
|
|
|
etcdConfig := ¶mtable.Get().EtcdCfg
|
|
|
|
Params := ¶mtable.Get().QueryNodeGrpcServerCfg
|
2021-02-23 03:40:30 +00:00
|
|
|
|
2022-12-16 07:59:23 +00:00
|
|
|
if !funcutil.CheckPortAvailable(Params.Port.GetAsInt()) {
|
|
|
|
paramtable.Get().Save(Params.Port.Key, fmt.Sprintf("%d", funcutil.GetAvailablePort()))
|
|
|
|
log.Warn("QueryNode get available port when init", zap.Int("Port", Params.Port.GetAsInt()))
|
2022-01-14 13:17:34 +00:00
|
|
|
}
|
|
|
|
|
2022-12-16 07:59:23 +00:00
|
|
|
log.Debug("QueryNode", zap.Int("port", Params.Port.GetAsInt()))
|
2021-12-29 06:35:21 +00:00
|
|
|
|
2024-01-24 03:35:00 +00:00
|
|
|
etcdCli, err := etcd.CreateEtcdClient(
|
2022-12-16 07:59:23 +00:00
|
|
|
etcdConfig.UseEmbedEtcd.GetAsBool(),
|
2024-01-24 03:35:00 +00:00
|
|
|
etcdConfig.EtcdEnableAuth.GetAsBool(),
|
|
|
|
etcdConfig.EtcdAuthUserName.GetValue(),
|
|
|
|
etcdConfig.EtcdAuthPassword.GetValue(),
|
2022-12-16 07:59:23 +00:00
|
|
|
etcdConfig.EtcdUseSSL.GetAsBool(),
|
|
|
|
etcdConfig.Endpoints.GetAsStrings(),
|
|
|
|
etcdConfig.EtcdTLSCert.GetValue(),
|
|
|
|
etcdConfig.EtcdTLSKey.GetValue(),
|
|
|
|
etcdConfig.EtcdTLSCACert.GetValue(),
|
|
|
|
etcdConfig.EtcdTLSMinVersion.GetValue())
|
2021-12-29 06:35:21 +00:00
|
|
|
if err != nil {
|
|
|
|
log.Debug("QueryNode connect to etcd failed", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
s.etcdCli = etcdCli
|
|
|
|
s.SetEtcdClient(etcdCli)
|
2022-12-16 07:59:23 +00:00
|
|
|
s.querynode.SetAddress(Params.GetAddress())
|
2021-12-29 06:35:21 +00:00
|
|
|
log.Debug("QueryNode connect to etcd successfully")
|
2021-02-23 03:40:30 +00:00
|
|
|
s.wg.Add(1)
|
2022-12-16 07:59:23 +00:00
|
|
|
go s.startGrpcLoop(Params.Port.GetAsInt())
|
2021-02-23 03:40:30 +00:00
|
|
|
// wait for grpc server loop start
|
2021-12-29 06:35:21 +00:00
|
|
|
err = <-s.grpcErrChan
|
2021-01-27 06:41:56 +00:00
|
|
|
if err != nil {
|
2021-02-23 03:40:30 +00:00
|
|
|
return err
|
|
|
|
}
|
2021-06-19 03:45:09 +00:00
|
|
|
|
2022-10-10 07:55:22 +00:00
|
|
|
s.querynode.UpdateStateCode(commonpb.StateCode_Initializing)
|
|
|
|
log.Debug("QueryNode", zap.Any("State", commonpb.StateCode_Initializing))
|
2021-03-12 06:22:09 +00:00
|
|
|
if err := s.querynode.Init(); err != nil {
|
2021-06-04 08:29:35 +00:00
|
|
|
log.Error("QueryNode init error: ", zap.Error(err))
|
2021-02-23 03:40:30 +00:00
|
|
|
return err
|
|
|
|
}
|
2024-02-21 03:54:53 +00:00
|
|
|
s.serverID.Store(s.querynode.GetNodeID())
|
2021-07-13 06:16:00 +00:00
|
|
|
|
2021-02-23 03:40:30 +00:00
|
|
|
return nil
|
2021-01-15 07:28:54 +00:00
|
|
|
}
|
|
|
|
|
2021-10-12 11:27:30 +00:00
|
|
|
// start starts QueryNode's grpc service.
|
2021-02-23 03:40:30 +00:00
|
|
|
func (s *Server) start() error {
|
2021-12-15 03:47:10 +00:00
|
|
|
if err := s.querynode.Start(); err != nil {
|
|
|
|
log.Error("QueryNode start failed", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if err := s.querynode.Register(); err != nil {
|
|
|
|
log.Error("QueryNode register service failed", zap.Error(err))
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
2021-01-22 03:17:18 +00:00
|
|
|
}
|
|
|
|
|
2021-10-12 11:27:30 +00:00
|
|
|
// startGrpcLoop starts the grpc loop of QueryNode component.
|
2021-02-23 03:40:30 +00:00
|
|
|
func (s *Server) startGrpcLoop(grpcPort int) {
|
|
|
|
defer s.wg.Done()
|
2022-12-16 07:59:23 +00:00
|
|
|
Params := ¶mtable.Get().QueryNodeGrpcServerCfg
|
2023-09-21 01:45:27 +00:00
|
|
|
kaep := keepalive.EnforcementPolicy{
|
2021-11-29 06:25:17 +00:00
|
|
|
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
|
|
|
|
}
|
2021-02-23 03:40:30 +00:00
|
|
|
|
2023-09-21 01:45:27 +00:00
|
|
|
kasp := keepalive.ServerParameters{
|
2021-11-29 06:25:17 +00:00
|
|
|
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-03-10 07:49:23 +00:00
|
|
|
var lis net.Listener
|
|
|
|
var err error
|
2021-06-23 01:24:10 +00:00
|
|
|
err = retry.Do(s.ctx, func() error {
|
2021-03-10 07:49:23 +00:00
|
|
|
addr := ":" + strconv.Itoa(grpcPort)
|
|
|
|
lis, err = net.Listen("tcp", addr)
|
|
|
|
if err == nil {
|
2022-11-04 06:25:38 +00:00
|
|
|
s.querynode.SetAddress(fmt.Sprintf("%s:%d", Params.IP, lis.Addr().(*net.TCPAddr).Port))
|
2021-03-10 07:49:23 +00:00
|
|
|
} else {
|
|
|
|
// set port=0 to get next available port
|
|
|
|
grpcPort = 0
|
|
|
|
}
|
|
|
|
return err
|
2021-06-23 01:24:10 +00:00
|
|
|
}, retry.Attempts(10))
|
2021-02-23 03:40:30 +00:00
|
|
|
if err != nil {
|
2021-03-05 01:21:35 +00:00
|
|
|
log.Error("QueryNode GrpcServer:failed to listen", zap.Error(err))
|
2021-02-23 03:40:30 +00:00
|
|
|
s.grpcErrChan <- err
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-01-12 08:09:39 +00:00
|
|
|
opts := tracer.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),
|
2022-12-16 07:59:23 +00:00
|
|
|
grpc.MaxRecvMsgSize(Params.ServerMaxRecvSize.GetAsInt()),
|
|
|
|
grpc.MaxSendMsgSize(Params.ServerMaxSendSize.GetAsInt()),
|
2022-08-23 02:44:52 +00:00
|
|
|
grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(
|
2023-01-12 08:09:39 +00:00
|
|
|
otelgrpc.UnaryServerInterceptor(opts...),
|
2023-06-21 03:36:46 +00:00
|
|
|
logutil.UnaryTraceLoggerInterceptor,
|
|
|
|
interceptor.ClusterValidationUnaryServerInterceptor(),
|
2023-08-20 13:24:19 +00:00
|
|
|
interceptor.ServerIDValidationUnaryServerInterceptor(func() int64 {
|
|
|
|
if s.serverID.Load() == 0 {
|
|
|
|
s.serverID.Store(paramtable.GetNodeID())
|
|
|
|
}
|
|
|
|
return s.serverID.Load()
|
|
|
|
}),
|
2023-06-21 03:36:46 +00:00
|
|
|
)),
|
2022-08-23 02:44:52 +00:00
|
|
|
grpc.StreamInterceptor(grpc_middleware.ChainStreamServer(
|
2023-01-12 08:09:39 +00:00
|
|
|
otelgrpc.StreamServerInterceptor(opts...),
|
2023-06-21 03:36:46 +00:00
|
|
|
logutil.StreamTraceLoggerInterceptor,
|
|
|
|
interceptor.ClusterValidationStreamServerInterceptor(),
|
2023-08-20 13:24:19 +00:00
|
|
|
interceptor.ServerIDValidationStreamServerInterceptor(func() int64 {
|
|
|
|
if s.serverID.Load() == 0 {
|
|
|
|
s.serverID.Store(paramtable.GetNodeID())
|
|
|
|
}
|
|
|
|
return s.serverID.Load()
|
|
|
|
}),
|
2023-06-21 03:36:46 +00:00
|
|
|
)))
|
2021-02-23 03:40:30 +00:00
|
|
|
querypb.RegisterQueryNodeServer(s.grpcServer, s)
|
|
|
|
|
|
|
|
ctx, cancel := context.WithCancel(s.ctx)
|
|
|
|
defer cancel()
|
|
|
|
|
|
|
|
go funcutil.CheckGrpcReady(ctx, s.grpcErrChan)
|
|
|
|
if err := s.grpcServer.Serve(lis); err != nil {
|
2021-03-05 01:21:35 +00:00
|
|
|
log.Debug("QueryNode Start Grpc Failed!!!!")
|
2021-02-23 03:40:30 +00:00
|
|
|
s.grpcErrChan <- err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-13 11:30:34 +00:00
|
|
|
// Run initializes and starts QueryNode'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-03-05 01:21:35 +00:00
|
|
|
log.Debug("QueryNode init done ...")
|
2021-02-23 03:40:30 +00:00
|
|
|
|
|
|
|
if err := s.start(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-03-05 01:21:35 +00:00
|
|
|
log.Debug("QueryNode start done ...")
|
2021-02-23 03:40:30 +00:00
|
|
|
return nil
|
2021-01-22 03:17:18 +00:00
|
|
|
}
|
|
|
|
|
2021-10-13 11:24:41 +00:00
|
|
|
// Stop stops QueryNode's grpc service.
|
2021-01-22 03:17:18 +00:00
|
|
|
func (s *Server) Stop() error {
|
2022-12-16 07:59:23 +00:00
|
|
|
Params := ¶mtable.Get().QueryNodeGrpcServerCfg
|
2021-12-17 02:23:15 +00:00
|
|
|
log.Debug("QueryNode stop", zap.String("Address", Params.GetAddress()))
|
2022-12-06 14:59:19 +00:00
|
|
|
err := s.querynode.Stop()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2021-12-29 06:35:21 +00:00
|
|
|
if s.etcdCli != nil {
|
|
|
|
defer s.etcdCli.Close()
|
|
|
|
}
|
2021-02-26 09:44:24 +00:00
|
|
|
|
2021-02-02 01:52:42 +00:00
|
|
|
s.cancel()
|
2021-02-23 03:40:30 +00:00
|
|
|
if s.grpcServer != nil {
|
2023-09-26 02:15:25 +00:00
|
|
|
utils.GracefulStopGRPCServer(s.grpcServer)
|
2021-02-23 03:40:30 +00:00
|
|
|
}
|
|
|
|
s.wg.Wait()
|
|
|
|
return nil
|
2021-02-02 01:52:42 +00:00
|
|
|
}
|
|
|
|
|
2021-12-29 06:35:21 +00:00
|
|
|
// SetEtcdClient sets the etcd client for QueryNode component.
|
|
|
|
func (s *Server) SetEtcdClient(etcdCli *clientv3.Client) {
|
|
|
|
s.querynode.SetEtcdClient(etcdCli)
|
|
|
|
}
|
|
|
|
|
2021-10-14 11:36:41 +00:00
|
|
|
// GetTimeTickChannel gets the time tick channel of QueryNode.
|
2021-03-12 06:22:09 +00:00
|
|
|
func (s *Server) GetTimeTickChannel(ctx context.Context, req *internalpb.GetTimeTickChannelRequest) (*milvuspb.StringResponse, error) {
|
2023-09-26 01:57:25 +00:00
|
|
|
return s.querynode.GetTimeTickChannel(ctx, req)
|
2021-01-22 03:17:18 +00:00
|
|
|
}
|
|
|
|
|
2021-10-14 11:38:36 +00:00
|
|
|
// GetStatisticsChannel gets the statistics channel of QueryNode.
|
2021-03-12 06:22:09 +00:00
|
|
|
func (s *Server) GetStatisticsChannel(ctx context.Context, req *internalpb.GetStatisticsChannelRequest) (*milvuspb.StringResponse, error) {
|
2023-09-26 01:57:25 +00:00
|
|
|
return s.querynode.GetStatisticsChannel(ctx, req)
|
2021-01-22 03:17:18 +00:00
|
|
|
}
|
|
|
|
|
2021-10-15 09:57:07 +00:00
|
|
|
// GetComponentStates gets the component states of QueryNode.
|
2022-10-10 07:55:22 +00:00
|
|
|
func (s *Server) GetComponentStates(ctx context.Context, req *milvuspb.GetComponentStatesRequest) (*milvuspb.ComponentStates, error) {
|
2021-01-22 03:17:18 +00:00
|
|
|
// ignore ctx and in
|
2023-09-26 01:57:25 +00:00
|
|
|
return s.querynode.GetComponentStates(ctx, req)
|
2021-01-15 07:28:54 +00:00
|
|
|
}
|
|
|
|
|
2021-10-16 09:14:51 +00:00
|
|
|
// WatchDmChannels watches the channels about data manipulation.
|
2021-03-12 06:22:09 +00:00
|
|
|
func (s *Server) WatchDmChannels(ctx context.Context, req *querypb.WatchDmChannelsRequest) (*commonpb.Status, error) {
|
2021-01-16 07:04:32 +00:00
|
|
|
// ignore ctx
|
2021-03-12 06:22:09 +00:00
|
|
|
return s.querynode.WatchDmChannels(ctx, req)
|
2021-01-15 07:28:54 +00:00
|
|
|
}
|
|
|
|
|
2022-09-15 10:48:32 +00:00
|
|
|
func (s *Server) UnsubDmChannel(ctx context.Context, req *querypb.UnsubDmChannelRequest) (*commonpb.Status, error) {
|
|
|
|
return s.querynode.UnsubDmChannel(ctx, req)
|
|
|
|
}
|
|
|
|
|
2021-10-16 09:16:45 +00:00
|
|
|
// LoadSegments loads the segments to search.
|
2021-03-12 06:22:09 +00:00
|
|
|
func (s *Server) LoadSegments(ctx context.Context, req *querypb.LoadSegmentsRequest) (*commonpb.Status, error) {
|
2021-01-16 07:04:32 +00:00
|
|
|
// ignore ctx
|
2021-03-12 06:22:09 +00:00
|
|
|
return s.querynode.LoadSegments(ctx, req)
|
2021-01-15 07:28:54 +00:00
|
|
|
}
|
|
|
|
|
2021-10-16 09:12:46 +00:00
|
|
|
// ReleaseCollection releases the data of the specified collection in QueryNode.
|
2021-03-12 06:22:09 +00:00
|
|
|
func (s *Server) ReleaseCollection(ctx context.Context, req *querypb.ReleaseCollectionRequest) (*commonpb.Status, error) {
|
2021-02-24 09:24:51 +00:00
|
|
|
// ignore ctx
|
2021-03-12 06:22:09 +00:00
|
|
|
return s.querynode.ReleaseCollection(ctx, req)
|
2021-02-24 09:24:51 +00:00
|
|
|
}
|
|
|
|
|
2023-03-20 06:55:57 +00:00
|
|
|
// LoadPartitions updates partitions meta info in QueryNode.
|
|
|
|
func (s *Server) LoadPartitions(ctx context.Context, req *querypb.LoadPartitionsRequest) (*commonpb.Status, error) {
|
|
|
|
return s.querynode.LoadPartitions(ctx, req)
|
|
|
|
}
|
|
|
|
|
2021-10-18 12:19:01 +00:00
|
|
|
// ReleasePartitions releases the data of the specified partitions in QueryNode.
|
2021-03-12 06:22:09 +00:00
|
|
|
func (s *Server) ReleasePartitions(ctx context.Context, req *querypb.ReleasePartitionsRequest) (*commonpb.Status, error) {
|
2021-02-24 09:24:51 +00:00
|
|
|
// ignore ctx
|
2021-03-12 06:22:09 +00:00
|
|
|
return s.querynode.ReleasePartitions(ctx, req)
|
2021-02-24 09:24:51 +00:00
|
|
|
}
|
|
|
|
|
2021-10-18 12:20:53 +00:00
|
|
|
// ReleaseSegments releases the data of the specified segments in QueryNode.
|
2021-03-12 06:22:09 +00:00
|
|
|
func (s *Server) ReleaseSegments(ctx context.Context, req *querypb.ReleaseSegmentsRequest) (*commonpb.Status, error) {
|
2021-01-16 07:04:32 +00:00
|
|
|
// ignore ctx
|
2021-03-12 06:22:09 +00:00
|
|
|
return s.querynode.ReleaseSegments(ctx, req)
|
2021-01-15 07:28:54 +00:00
|
|
|
}
|
2021-02-04 03:40:14 +00:00
|
|
|
|
2021-10-18 12:17:03 +00:00
|
|
|
// GetSegmentInfo gets the information of the specified segments in QueryNode.
|
2021-03-12 06:22:09 +00:00
|
|
|
func (s *Server) GetSegmentInfo(ctx context.Context, req *querypb.GetSegmentInfoRequest) (*querypb.GetSegmentInfoResponse, error) {
|
|
|
|
return s.querynode.GetSegmentInfo(ctx, req)
|
2021-02-04 03:40:14 +00:00
|
|
|
}
|
2021-08-17 02:06:11 +00:00
|
|
|
|
2022-03-30 04:03:27 +00:00
|
|
|
// Search performs search of streaming/historical replica on QueryNode.
|
2022-04-02 06:15:31 +00:00
|
|
|
func (s *Server) Search(ctx context.Context, req *querypb.SearchRequest) (*internalpb.SearchResults, error) {
|
2022-03-30 04:03:27 +00:00
|
|
|
return s.querynode.Search(ctx, req)
|
|
|
|
}
|
|
|
|
|
2023-05-23 08:01:26 +00:00
|
|
|
func (s *Server) SearchSegments(ctx context.Context, req *querypb.SearchRequest) (*internalpb.SearchResults, error) {
|
|
|
|
return s.querynode.SearchSegments(ctx, req)
|
|
|
|
}
|
|
|
|
|
2022-03-30 04:03:27 +00:00
|
|
|
// Query performs query of streaming/historical replica on QueryNode.
|
2022-04-02 06:15:31 +00:00
|
|
|
func (s *Server) Query(ctx context.Context, req *querypb.QueryRequest) (*internalpb.RetrieveResults, error) {
|
2022-03-30 04:03:27 +00:00
|
|
|
return s.querynode.Query(ctx, req)
|
|
|
|
}
|
|
|
|
|
2023-09-12 02:19:17 +00:00
|
|
|
func (s *Server) QueryStream(req *querypb.QueryRequest, srv querypb.QueryNode_QueryStreamServer) error {
|
2023-09-26 01:57:25 +00:00
|
|
|
return s.querynode.QueryStream(req, srv)
|
2023-09-12 02:19:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) QueryStreamSegments(req *querypb.QueryRequest, srv querypb.QueryNode_QueryStreamSegmentsServer) error {
|
2023-09-26 01:57:25 +00:00
|
|
|
return s.querynode.QueryStreamSegments(req, srv)
|
2023-09-12 02:19:17 +00:00
|
|
|
}
|
|
|
|
|
2023-05-23 08:01:26 +00:00
|
|
|
func (s *Server) QuerySegments(ctx context.Context, req *querypb.QueryRequest) (*internalpb.RetrieveResults, error) {
|
|
|
|
return s.querynode.QuerySegments(ctx, req)
|
|
|
|
}
|
|
|
|
|
2022-04-27 02:41:46 +00:00
|
|
|
// SyncReplicaSegments syncs replica segment information to shard leader
|
|
|
|
func (s *Server) SyncReplicaSegments(ctx context.Context, req *querypb.SyncReplicaSegmentsRequest) (*commonpb.Status, error) {
|
|
|
|
return s.querynode.SyncReplicaSegments(ctx, req)
|
|
|
|
}
|
|
|
|
|
2022-08-02 17:12:33 +00:00
|
|
|
// ShowConfigurations gets specified configurations para of QueryNode
|
|
|
|
func (s *Server) ShowConfigurations(ctx context.Context, req *internalpb.ShowConfigurationsRequest) (*internalpb.ShowConfigurationsResponse, error) {
|
|
|
|
return s.querynode.ShowConfigurations(ctx, req)
|
|
|
|
}
|
|
|
|
|
2021-10-19 12:38:47 +00:00
|
|
|
// GetMetrics gets the metrics information of QueryNode.
|
2021-08-17 02:06:11 +00:00
|
|
|
func (s *Server) GetMetrics(ctx context.Context, req *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error) {
|
|
|
|
return s.querynode.GetMetrics(ctx, req)
|
|
|
|
}
|
2022-09-15 10:48:32 +00:00
|
|
|
|
|
|
|
// GetDataDistribution gets the distribution information of QueryNode.
|
|
|
|
func (s *Server) GetDataDistribution(ctx context.Context, req *querypb.GetDataDistributionRequest) (*querypb.GetDataDistributionResponse, error) {
|
|
|
|
return s.querynode.GetDataDistribution(ctx, req)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Server) SyncDistribution(ctx context.Context, req *querypb.SyncDistributionRequest) (*commonpb.Status, error) {
|
|
|
|
return s.querynode.SyncDistribution(ctx, req)
|
|
|
|
}
|
2023-03-26 16:42:00 +00:00
|
|
|
|
|
|
|
// Delete is used to forward delete message between delegator and workers.
|
|
|
|
func (s *Server) Delete(ctx context.Context, req *querypb.DeleteRequest) (*commonpb.Status, error) {
|
|
|
|
return s.querynode.Delete(ctx, req)
|
|
|
|
}
|
2024-02-01 08:03:03 +00:00
|
|
|
|
|
|
|
// HybridSearch performs hybrid search of streaming/historical replica on QueryNode.
|
|
|
|
func (s *Server) HybridSearch(ctx context.Context, req *querypb.HybridSearchRequest) (*querypb.HybridSearchResult, error) {
|
|
|
|
return s.querynode.HybridSearch(ctx, req)
|
|
|
|
}
|