mirror of https://github.com/milvus-io/milvus.git
Fix a bug where RPC calls before proxy finishes initialization crashes Milvus (#16474)
/kind bug issue: #16473 Signed-off-by: Yuchen Gao <yuchen.gao@zilliz.com>pull/16498/head
parent
e76a8c5ec2
commit
cf9b9aba79
|
@ -22,6 +22,7 @@ import (
|
|||
"github.com/milvus-io/milvus/internal/log"
|
||||
"github.com/milvus-io/milvus/internal/proto/internalpb"
|
||||
"github.com/milvus-io/milvus/internal/util/dependency"
|
||||
"go.uber.org/zap"
|
||||
|
||||
grpcproxy "github.com/milvus-io/milvus/internal/distributed/proxy"
|
||||
)
|
||||
|
@ -47,9 +48,10 @@ func NewProxy(ctx context.Context, factory dependency.Factory) (*Proxy, error) {
|
|||
// Run starts service
|
||||
func (n *Proxy) Run() error {
|
||||
if err := n.svr.Run(); err != nil {
|
||||
log.Warn("failed to start Proxy", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
log.Debug("Proxy successfully started")
|
||||
log.Info("Proxy successfully started")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -346,6 +346,7 @@ func (mr *MilvusRoles) runIndexNode(ctx context.Context, localMsg bool, alias st
|
|||
|
||||
// Run Milvus components.
|
||||
func (mr *MilvusRoles) Run(local bool, alias string) {
|
||||
log.Info("starting running Milvus components")
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
// only standalone enable localMsg
|
||||
|
|
|
@ -62,6 +62,9 @@ func AuthenticationInterceptor(ctx context.Context) (context.Context, error) {
|
|||
if !ok {
|
||||
return nil, ErrMissingMetadata()
|
||||
}
|
||||
if globalMetaCache == nil {
|
||||
return nil, ErrGlobalMetaCacheUninitialized()
|
||||
}
|
||||
// check:
|
||||
// 1. if rpc call from a member (like index/query/data component)
|
||||
// 2. if rpc call from sdk
|
||||
|
|
|
@ -79,3 +79,7 @@ func ErrMissingMetadata() error {
|
|||
func ErrUnauthenticated() error {
|
||||
return fmt.Errorf("unauthenticated: invalid credential")
|
||||
}
|
||||
|
||||
func ErrGlobalMetaCacheUninitialized() error {
|
||||
return fmt.Errorf("internal: globalMetaCache not initialized")
|
||||
}
|
||||
|
|
|
@ -152,12 +152,12 @@ func (node *Proxy) initSession() error {
|
|||
|
||||
// Init initialize proxy.
|
||||
func (node *Proxy) Init() error {
|
||||
log.Debug("init session for Proxy")
|
||||
log.Info("init session for Proxy")
|
||||
if err := node.initSession(); err != nil {
|
||||
log.Warn("failed to init Proxy's session", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
log.Debug("init session for Proxy done")
|
||||
log.Info("init session for Proxy done")
|
||||
|
||||
if node.queryCoord != nil {
|
||||
log.Debug("create query channel for Proxy")
|
||||
|
|
Loading…
Reference in New Issue