mirror of https://github.com/milvus-io/milvus.git
Improve the panic code about the milvus component (#24783)
Signed-off-by: SimFG <bang.fu@zilliz.com>pull/24830/head
parent
5ef794e8db
commit
52a9b1701f
|
@ -21,11 +21,11 @@ import (
|
|||
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
|
||||
grpcdatacoordclient "github.com/milvus-io/milvus/internal/distributed/datacoord"
|
||||
"github.com/milvus-io/milvus/internal/log"
|
||||
"github.com/milvus-io/milvus/internal/util/dependency"
|
||||
"github.com/milvus-io/milvus/internal/util/typeutil"
|
||||
|
||||
grpcdatacoordclient "github.com/milvus-io/milvus/internal/distributed/datacoord"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// DataCoord implements grpc server of DataCoord server
|
||||
|
@ -47,6 +47,7 @@ func NewDataCoord(ctx context.Context, factory dependency.Factory) (*DataCoord,
|
|||
// Run starts service
|
||||
func (s *DataCoord) Run() error {
|
||||
if err := s.svr.Run(); err != nil {
|
||||
log.Error("DataCoord starts error", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
log.Debug("DataCoord successfully started")
|
||||
|
|
|
@ -25,6 +25,7 @@ import (
|
|||
"github.com/milvus-io/milvus/internal/log"
|
||||
"github.com/milvus-io/milvus/internal/util/dependency"
|
||||
"github.com/milvus-io/milvus/internal/util/typeutil"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// DataNode implements DataNode grpc server
|
||||
|
@ -49,7 +50,8 @@ func NewDataNode(ctx context.Context, factory dependency.Factory) (*DataNode, er
|
|||
// Run starts service
|
||||
func (d *DataNode) Run() error {
|
||||
if err := d.svr.Run(); err != nil {
|
||||
panic(err)
|
||||
log.Error("DataNode starts error", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
log.Debug("Datanode successfully started")
|
||||
return nil
|
||||
|
|
|
@ -21,11 +21,11 @@ import (
|
|||
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
|
||||
|
||||
grpcindexcoord "github.com/milvus-io/milvus/internal/distributed/indexcoord"
|
||||
"github.com/milvus-io/milvus/internal/log"
|
||||
"github.com/milvus-io/milvus/internal/util/dependency"
|
||||
"github.com/milvus-io/milvus/internal/util/typeutil"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// IndexCoord implements IndexCoord grpc server
|
||||
|
@ -49,6 +49,7 @@ func NewIndexCoord(ctx context.Context, factory dependency.Factory) (*IndexCoord
|
|||
// Run starts service
|
||||
func (s *IndexCoord) Run() error {
|
||||
if err := s.svr.Run(); err != nil {
|
||||
log.Error("IndexCoord starts error", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
log.Debug("IndexCoord successfully started")
|
||||
|
|
|
@ -21,12 +21,11 @@ import (
|
|||
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
|
||||
|
||||
grpcindexnode "github.com/milvus-io/milvus/internal/distributed/indexnode"
|
||||
"github.com/milvus-io/milvus/internal/log"
|
||||
"github.com/milvus-io/milvus/internal/util/dependency"
|
||||
"github.com/milvus-io/milvus/internal/util/typeutil"
|
||||
|
||||
grpcindexnode "github.com/milvus-io/milvus/internal/distributed/indexnode"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// IndexNode implements IndexNode grpc server
|
||||
|
@ -50,6 +49,7 @@ func NewIndexNode(ctx context.Context, factory dependency.Factory) (*IndexNode,
|
|||
// Run starts service
|
||||
func (n *IndexNode) Run() error {
|
||||
if err := n.svr.Run(); err != nil {
|
||||
log.Error("IndexNode starts error", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
log.Debug("IndexNode successfully started")
|
||||
|
|
|
@ -21,12 +21,10 @@ import (
|
|||
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
|
||||
|
||||
grpcproxy "github.com/milvus-io/milvus/internal/distributed/proxy"
|
||||
"github.com/milvus-io/milvus/internal/log"
|
||||
"github.com/milvus-io/milvus/internal/util/dependency"
|
||||
"github.com/milvus-io/milvus/internal/util/typeutil"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
|
@ -51,7 +49,7 @@ 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))
|
||||
log.Error("Proxy starts error", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
log.Info("Proxy successfully started")
|
||||
|
|
|
@ -21,12 +21,11 @@ import (
|
|||
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
|
||||
|
||||
grpcquerycoord "github.com/milvus-io/milvus/internal/distributed/querycoord"
|
||||
"github.com/milvus-io/milvus/internal/log"
|
||||
"github.com/milvus-io/milvus/internal/util/dependency"
|
||||
"github.com/milvus-io/milvus/internal/util/typeutil"
|
||||
|
||||
grpcquerycoord "github.com/milvus-io/milvus/internal/distributed/querycoord"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// QueryCoord implements QueryCoord grpc server
|
||||
|
@ -39,7 +38,7 @@ type QueryCoord struct {
|
|||
func NewQueryCoord(ctx context.Context, factory dependency.Factory) (*QueryCoord, error) {
|
||||
svr, err := grpcquerycoord.NewServer(ctx, factory)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &QueryCoord{
|
||||
|
@ -51,7 +50,8 @@ func NewQueryCoord(ctx context.Context, factory dependency.Factory) (*QueryCoord
|
|||
// Run starts service
|
||||
func (qs *QueryCoord) Run() error {
|
||||
if err := qs.svr.Run(); err != nil {
|
||||
panic(err)
|
||||
log.Error("QueryCoord starts error", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
log.Debug("QueryCoord successfully started")
|
||||
return nil
|
||||
|
|
|
@ -21,12 +21,11 @@ import (
|
|||
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
|
||||
|
||||
grpcquerynode "github.com/milvus-io/milvus/internal/distributed/querynode"
|
||||
"github.com/milvus-io/milvus/internal/log"
|
||||
"github.com/milvus-io/milvus/internal/util/dependency"
|
||||
"github.com/milvus-io/milvus/internal/util/typeutil"
|
||||
|
||||
grpcquerynode "github.com/milvus-io/milvus/internal/distributed/querynode"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// QueryNode implements QueryNode grpc server
|
||||
|
@ -52,7 +51,8 @@ func NewQueryNode(ctx context.Context, factory dependency.Factory) (*QueryNode,
|
|||
// Run starts service
|
||||
func (q *QueryNode) Run() error {
|
||||
if err := q.svr.Run(); err != nil {
|
||||
panic(err)
|
||||
log.Error("QueryNode starts error", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
log.Debug("QueryNode successfully started")
|
||||
return nil
|
||||
|
|
|
@ -26,7 +26,6 @@ import (
|
|||
"github.com/milvus-io/milvus/internal/log"
|
||||
"github.com/milvus-io/milvus/internal/util/dependency"
|
||||
"github.com/milvus-io/milvus/internal/util/typeutil"
|
||||
|
||||
"github.com/opentracing/opentracing-go"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
|
|
@ -238,13 +238,8 @@ func (mr *MilvusRoles) Run(local bool, alias string) {
|
|||
}
|
||||
Params.Init()
|
||||
|
||||
if Params.RocksmqEnable() {
|
||||
path, err := Params.Load("rocksmq.path")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err = rocksmqimpl.InitRocksMQ(path); err != nil {
|
||||
if rocksPath := Params.RocksmqPath(); rocksPath != "" {
|
||||
if err := rocksmqimpl.InitRocksMQ(rocksPath); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer stopRocksmq()
|
||||
|
|
|
@ -64,12 +64,8 @@ func (f *DefaultFactory) Init(params *paramtable.ComponentParam) {
|
|||
}
|
||||
|
||||
func (f *DefaultFactory) initMQLocalService(params *paramtable.ComponentParam) msgstream.Factory {
|
||||
if params.RocksmqEnable() {
|
||||
path, err := params.Load("rocksmq.path")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return msgstream.NewRmsFactory(path)
|
||||
if rocksPath := params.RocksmqPath(); rocksPath != "" {
|
||||
return msgstream.NewRmsFactory(rocksPath)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -106,8 +106,13 @@ func (p *ComponentParam) SetLogConfig(role string) {
|
|||
p.BaseTable.SetLogConfig()
|
||||
}
|
||||
|
||||
func (p *ComponentParam) RocksmqEnable() bool {
|
||||
return p.RocksmqCfg.Path != ""
|
||||
func (p *ComponentParam) RocksmqPath() string {
|
||||
mqPath, err := p.Load("rocksmq.path")
|
||||
if err != nil {
|
||||
log.Warn("failed to load rocksmq.path", zap.Error(err))
|
||||
return ""
|
||||
}
|
||||
return mqPath
|
||||
}
|
||||
|
||||
func (p *ComponentParam) PulsarEnable() bool {
|
||||
|
|
Loading…
Reference in New Issue