Start once for indexcoord (#8026)

Signed-off-by: cai.zhang <cai.zhang@zilliz.com>
pull/7738/head
cai.zhang 2021-09-17 20:17:53 +08:00 committed by GitHub
parent ccd6ec5ed4
commit 57e46c5f2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 15 deletions

View File

@ -69,6 +69,8 @@ type IndexCoord struct {
nodeLock sync.RWMutex
once sync.Once
reqTimeoutInterval time.Duration
durationInterval time.Duration
assignTaskInterval time.Duration
@ -203,31 +205,36 @@ func (i *IndexCoord) Init() error {
}
func (i *IndexCoord) Start() error {
i.loopWg.Add(1)
go i.tsLoop()
var startErr error = nil
i.once.Do(func() {
i.loopWg.Add(1)
go i.tsLoop()
i.loopWg.Add(1)
go i.recycleUnusedIndexFiles()
i.loopWg.Add(1)
go i.recycleUnusedIndexFiles()
i.loopWg.Add(1)
go i.assignTaskLoop()
i.loopWg.Add(1)
go i.assignTaskLoop()
i.loopWg.Add(1)
go i.watchNodeLoop()
i.loopWg.Add(1)
go i.watchNodeLoop()
i.loopWg.Add(1)
go i.watchMetaLoop()
i.loopWg.Add(1)
go i.watchMetaLoop()
i.sched.Start()
startErr = i.sched.Start()
i.UpdateStateCode(internalpb.StateCode_Healthy)
})
// Start callbacks
for _, cb := range i.startCallbacks {
cb()
}
i.UpdateStateCode(internalpb.StateCode_Healthy)
log.Debug("IndexCoord", zap.Any("State", i.stateCode.Load()))
log.Debug("IndexCoord start successfully")
return nil
log.Debug("IndexCoord", zap.Any("State", i.stateCode.Load()))
log.Debug("IndexCoord start successfully", zap.Error(startErr))
return startErr
}
func (i *IndexCoord) Stop() error {