mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 01:28:27 +08:00
Fix datanode graceful stop panic (#25932)
See also: #25925 Signed-off-by: yangxuan <xuan.yang@zilliz.com>
This commit is contained in:
parent
833674c1cb
commit
84253f255e
@ -113,6 +113,7 @@ type DataNode struct {
|
||||
//call once
|
||||
initOnce sync.Once
|
||||
startOnce sync.Once
|
||||
stopOnce sync.Once
|
||||
wg sync.WaitGroup
|
||||
sessionMu sync.Mutex // to fix data race
|
||||
session *sessionutil.Session
|
||||
@ -583,13 +584,12 @@ func (node *DataNode) ReadyToFlush() error {
|
||||
|
||||
// Stop will release DataNode resources and shutdown datanode
|
||||
func (node *DataNode) Stop() error {
|
||||
node.stopOnce.Do(func() {
|
||||
node.cancel()
|
||||
// https://github.com/milvus-io/milvus/issues/12282
|
||||
node.UpdateStateCode(commonpb.StateCode_Abnormal)
|
||||
node.flowgraphManager.dropAll()
|
||||
node.flowgraphManager.stop()
|
||||
node.flowgraphManager.close()
|
||||
|
||||
node.cancel()
|
||||
node.wg.Wait()
|
||||
node.eventManagerMap.Range(func(_ string, m *channelEventManager) bool {
|
||||
m.Close()
|
||||
return true
|
||||
@ -601,16 +601,15 @@ func (node *DataNode) Stop() error {
|
||||
}
|
||||
|
||||
if node.closer != nil {
|
||||
err := node.closer.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
node.closer.Close()
|
||||
}
|
||||
|
||||
if node.session != nil {
|
||||
node.session.Stop()
|
||||
}
|
||||
|
||||
node.wg.Wait()
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@ -61,7 +61,8 @@ func (fm *flowgraphManager) start() {
|
||||
}
|
||||
}
|
||||
|
||||
func (fm *flowgraphManager) stop() {
|
||||
func (fm *flowgraphManager) close() {
|
||||
fm.dropAll()
|
||||
fm.closeOnce.Do(func() {
|
||||
close(fm.closeCh)
|
||||
})
|
||||
|
||||
@ -70,7 +70,7 @@ var rateCol *ratelimitutil.RateCollector
|
||||
// Proxy of milvus
|
||||
type Proxy struct {
|
||||
ctx context.Context
|
||||
cancel func()
|
||||
cancel context.CancelFunc
|
||||
wg sync.WaitGroup
|
||||
|
||||
initParams *internalpb.InitParams
|
||||
|
||||
@ -66,7 +66,9 @@ func (inNode *InputNode) Operate(in []Msg) []Msg {
|
||||
if !ok {
|
||||
log.Warn("input closed", zap.Any("input node", inNode.Name()))
|
||||
if inNode.lastMsg != nil {
|
||||
log.Info("trigger force sync", zap.Int64("collection", inNode.collectionID), zap.Any("position", inNode.lastMsg))
|
||||
log.Info("trigger force sync",
|
||||
zap.Int64("collection", inNode.collectionID),
|
||||
zap.Any("position", inNode.lastMsg.EndPositions))
|
||||
return []Msg{&MsgStreamMsg{
|
||||
BaseMsg: NewBaseMsg(true),
|
||||
tsMessages: []msgstream.TsMsg{},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user