From 0bcedbd2bf2b49e37ca869ea241cda4e8a7822c3 Mon Sep 17 00:00:00 2001 From: wayblink Date: Wed, 28 Dec 2022 10:49:29 +0800 Subject: [PATCH] quick fix queryCoordV2 active-standby (#21395) Signed-off-by: wayblink --- internal/querycoordv2/server.go | 36 +++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/internal/querycoordv2/server.go b/internal/querycoordv2/server.go index 218a266f04..1722ed27b6 100644 --- a/internal/querycoordv2/server.go +++ b/internal/querycoordv2/server.go @@ -325,6 +325,25 @@ func (s *Server) Start() error { return err } + if s.enableActiveStandBy { + s.activateFunc = func() { + log.Info("querycoord switch from standby to active, activating") + s.startServerLoop() + s.UpdateStateCode(commonpb.StateCode_Healthy) + } + s.UpdateStateCode(commonpb.StateCode_StandBy) + } else { + s.startServerLoop() + s.UpdateStateCode(commonpb.StateCode_Healthy) + } + log.Info("QueryCoord started") + + s.afterStart() + + return nil +} + +func (s *Server) startServerLoop() { log.Info("start cluster...") s.cluster.Start(s.ctx) @@ -341,23 +360,6 @@ func (s *Server) Start() error { s.collectionObserver.Start(s.ctx) s.leaderObserver.Start(s.ctx) s.targetObserver.Start(s.ctx) - - if s.enableActiveStandBy { - s.activateFunc = func() { - // todo to complete - log.Info("querycoord switch from standby to active, activating") - s.initMeta() - s.UpdateStateCode(commonpb.StateCode_Healthy) - } - s.UpdateStateCode(commonpb.StateCode_StandBy) - } else { - s.UpdateStateCode(commonpb.StateCode_Healthy) - } - log.Info("QueryCoord started") - - s.afterStart() - - return nil } func (s *Server) Stop() error {