Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [2.5] Fix standby mixcoord start failed #39240

Open
wants to merge 1 commit into
base: 2.5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions internal/datacoord/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ func (s *Server) initSession() error {

// Init change server state to Initializing
func (s *Server) Init() error {
s.UpdateStateCode(commonpb.StateCode_Initializing)

log := log.Ctx(s.ctx)
var err error
s.registerMetricsRequest()
Expand All @@ -318,17 +320,22 @@ func (s *Server) Init() error {
log.Info("DataCoord startup success")
return nil
}
s.stateCode.Store(commonpb.StateCode_StandBy)
s.UpdateStateCode(commonpb.StateCode_StandBy)
log.Info("DataCoord enter standby mode successfully")
return nil
}

return s.initDataCoord()
}

// UpdateStateCode updates the status of the coord, including healthy, unhealthy
func (s *Server) UpdateStateCode(code commonpb.StateCode) {
s.stateCode.Store(code)
log.Info("update datacoord state", zap.String("state", code.String()))
}

func (s *Server) initDataCoord() error {
log := log.Ctx(s.ctx)
s.stateCode.Store(commonpb.StateCode_Initializing)
var err error
if err = s.initRootCoordClient(); err != nil {
return err
Expand Down Expand Up @@ -463,7 +470,7 @@ func (s *Server) startDataCoord() {
// })

s.afterStart()
s.stateCode.Store(commonpb.StateCode_Healthy)
s.UpdateStateCode(commonpb.StateCode_Healthy)
sessionutil.SaveServerInfo(typeutil.DataCoordRole, s.session.GetServerID())
}

Expand Down
4 changes: 3 additions & 1 deletion internal/querycoordv2/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ func (s *Server) registerMetricsRequest() {
}

func (s *Server) Init() error {
s.UpdateStateCode(commonpb.StateCode_Initializing)

log := log.Ctx(s.ctx)
log.Info("QueryCoord start init",
zap.String("meta-root-path", Params.EtcdCfg.MetaRootPath.GetValue()),
Expand Down Expand Up @@ -299,7 +301,6 @@ func (s *Server) initQueryCoord() error {
}
log.Info("QueryCoord report DataCoord ready")

s.UpdateStateCode(commonpb.StateCode_Initializing)
log.Info("start init querycoord", zap.Any("State", commonpb.StateCode_Initializing))
// Init KV and ID allocator
metaType := Params.MetaStoreCfg.MetaStoreType.GetValue()
Expand Down Expand Up @@ -671,6 +672,7 @@ func (s *Server) Stop() error {
// UpdateStateCode updates the status of the coord, including healthy, unhealthy
func (s *Server) UpdateStateCode(code commonpb.StateCode) {
s.status.Store(int32(code))
log.Info("update querycoord state", zap.String("state", code.String()))
}

func (s *Server) State() commonpb.StateCode {
Expand Down
4 changes: 2 additions & 2 deletions internal/rootcoord/root_coord.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,6 @@ func (c *Core) initInternal() error {
defer initSpan.End()
log := log.Ctx(initCtx)

c.UpdateStateCode(commonpb.StateCode_Initializing)

if err := c.initIDAllocator(initCtx); err != nil {
return err
}
Expand Down Expand Up @@ -525,6 +523,8 @@ func (c *Core) registerMetricsRequest() {

// Init initialize routine
func (c *Core) Init() error {
c.UpdateStateCode(commonpb.StateCode_Initializing)

log := log.Ctx(c.ctx)
var initError error
c.registerMetricsRequest()
Expand Down
Loading