mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-02-02 01:06:41 +08:00
enhance:add some log when create client and get component states (#28160)
/kind improvement Signed-off-by: lixinguo <xinguo.li@zilliz.com> Co-authored-by: lixinguo <xinguo.li@zilliz.com>
This commit is contained in:
parent
2fc743992a
commit
73f2bab454
@ -619,6 +619,7 @@ func (s *Server) GetStateCode() commonpb.StateCode {
|
||||
// GetComponentStates returns DataCoord's current state
|
||||
func (s *Server) GetComponentStates(ctx context.Context, req *milvuspb.GetComponentStatesRequest) (*milvuspb.ComponentStates, error) {
|
||||
code := s.GetStateCode()
|
||||
log.Debug("DataCoord current state", zap.String("StateCode", code.String()))
|
||||
nodeID := common.NotRegisteredID
|
||||
if s.session != nil && s.session.Registered() {
|
||||
nodeID = s.session.GetServerID() // or Params.NodeID
|
||||
|
||||
@ -67,8 +67,9 @@ func (node *DataNode) WatchDmChannels(ctx context.Context, in *datapb.WatchDmCha
|
||||
|
||||
// GetComponentStates will return current state of DataNode
|
||||
func (node *DataNode) GetComponentStates(ctx context.Context, req *milvuspb.GetComponentStatesRequest) (*milvuspb.ComponentStates, error) {
|
||||
log.Debug("DataNode current state", zap.Any("State", node.stateCode.Load()))
|
||||
nodeID := common.NotRegisteredID
|
||||
state := node.stateCode.Load().(commonpb.StateCode)
|
||||
log.Debug("DataNode current state", zap.String("State", state.String()))
|
||||
if node.GetSession() != nil && node.session.Registered() {
|
||||
nodeID = node.GetSession().ServerID
|
||||
}
|
||||
|
||||
@ -87,7 +87,10 @@ func (c *Client) getDataCoordAddr() (string, error) {
|
||||
log.Debug("DataCoordClient, not existed in msess ", zap.Any("key", key), zap.Any("len of msess", len(msess)))
|
||||
return "", fmt.Errorf("find no available datacoord, check datacoord state")
|
||||
}
|
||||
|
||||
log.Debug("DataCoordClient GetSessions success",
|
||||
zap.String("address", ms.Address),
|
||||
zap.Int64("serverID", ms.ServerID),
|
||||
)
|
||||
c.grpcClient.SetNodeID(ms.ServerID)
|
||||
return ms.Address, nil
|
||||
}
|
||||
|
||||
@ -77,6 +77,11 @@ func (c *Client) getQueryCoordAddr() (string, error) {
|
||||
log.Debug("QueryCoordClient msess key not existed", zap.Any("key", key))
|
||||
return "", fmt.Errorf("find no available querycoord, check querycoord state")
|
||||
}
|
||||
|
||||
log.Debug("QueryCoordClient GetSessions success",
|
||||
zap.String("address", ms.Address),
|
||||
zap.Int64("serverID", ms.ServerID),
|
||||
)
|
||||
c.grpcClient.SetNodeID(ms.ServerID)
|
||||
return ms.Address, nil
|
||||
}
|
||||
|
||||
@ -69,6 +69,7 @@ func (node *Proxy) GetComponentStates(ctx context.Context, req *milvuspb.GetComp
|
||||
Status: merr.Success(),
|
||||
}
|
||||
code := node.GetStateCode()
|
||||
log.Debug("Proxy current state", zap.String("StateCode", code.String()))
|
||||
nodeID := common.NotRegisteredID
|
||||
if node.session != nil && node.session.Registered() {
|
||||
nodeID = node.session.ServerID
|
||||
|
||||
@ -531,6 +531,7 @@ func (s *Server) State() commonpb.StateCode {
|
||||
}
|
||||
|
||||
func (s *Server) GetComponentStates(ctx context.Context, req *milvuspb.GetComponentStatesRequest) (*milvuspb.ComponentStates, error) {
|
||||
log.Debug("QueryCoord current state", zap.String("StateCode", s.State().String()))
|
||||
nodeID := common.NotRegisteredID
|
||||
if s.session != nil && s.session.Registered() {
|
||||
nodeID = s.session.GetServerID()
|
||||
|
||||
@ -64,6 +64,8 @@ func (node *QueryNode) GetComponentStates(ctx context.Context, req *milvuspb.Get
|
||||
code := node.lifetime.GetState()
|
||||
nodeID := common.NotRegisteredID
|
||||
|
||||
log.Debug("QueryNode current state", zap.Int64("NodeID", nodeID), zap.String("StateCode", code.String()))
|
||||
|
||||
if node.session != nil && node.session.Registered() {
|
||||
nodeID = paramtable.GetNodeID()
|
||||
}
|
||||
|
||||
@ -759,6 +759,7 @@ func (c *Core) Stop() error {
|
||||
// GetComponentStates get states of components
|
||||
func (c *Core) GetComponentStates(ctx context.Context, req *milvuspb.GetComponentStatesRequest) (*milvuspb.ComponentStates, error) {
|
||||
code := c.GetStateCode()
|
||||
log.Debug("RootCoord current state", zap.String("StateCode", code.String()))
|
||||
|
||||
nodeID := common.NotRegisteredID
|
||||
if c.session != nil && c.session.Registered() {
|
||||
|
||||
@ -21,10 +21,12 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
||||
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
|
||||
"github.com/milvus-io/milvus/pkg/log"
|
||||
"github.com/milvus-io/milvus/pkg/util/merr"
|
||||
"github.com/milvus-io/milvus/pkg/util/retry"
|
||||
)
|
||||
@ -56,6 +58,7 @@ func WaitForComponentStates[T interface {
|
||||
serviceName,
|
||||
resp.State.StateCode.String())
|
||||
}
|
||||
log.Info("WaitForComponentStates success", zap.String("current state", resp.State.StateCode.String()))
|
||||
return nil
|
||||
}
|
||||
return retry.Do(ctx, checkFunc, retry.Attempts(attempts), retry.Sleep(sleep))
|
||||
|
||||
@ -46,7 +46,7 @@ func CloseEtcdClient() {
|
||||
func getEtcdAndPath() (*clientv3.Client, string) {
|
||||
clientCreator.mu.Lock()
|
||||
defer clientCreator.mu.Unlock()
|
||||
// If client/path doesnt exist, create a new one
|
||||
// If client/path doesn’t exist, create a new one
|
||||
if clientCreator.client == nil {
|
||||
var err error
|
||||
clientCreator.client, err = createEtcdClient()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user