Reduce the timer time of assigning index task scheduler (#18319)

Signed-off-by: Cai.Zhang <cai.zhang@zilliz.com>
pull/18326/head
cai.zhang 2022-07-19 14:24:29 +08:00 committed by GitHub
parent 70246f82fd
commit 315df1ff15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -56,7 +56,7 @@ func newIndexBuilder(ctx context.Context, ic *IndexCoord, metaTable *metaTable,
ic: ic,
tasks: make(map[int64]indexTaskState, 1024),
notify: make(chan struct{}, 1024),
scheduleDuration: time.Second * 10,
scheduleDuration: time.Second * 1,
}
ib.reloadFromKV(aliveNodes)
return ib
@ -143,9 +143,10 @@ func (ib *indexBuilder) schedule() {
}
ib.taskMutex.Unlock()
}
// !ok means indexBuild is closed.
// !ok means indexBuilder is closed.
case <-ticker.C:
ib.taskMutex.Lock()
log.Info("index builder task schedule", zap.Int("task num", len(ib.tasks)))
for buildID := range ib.tasks {
ib.process(buildID)
}

View File

@ -102,8 +102,8 @@ func (nm *NodeManager) AddNode(nodeID UniqueID, address string) error {
// PeekClient peeks the client with the least load.
func (nm *NodeManager) PeekClient(meta *Meta) (UniqueID, types.IndexNode) {
log.Info("IndexCoord peek client")
allClients := nm.GetAllClients()
if len(allClients) == 0 {
log.Error("there is no IndexNode online")
return -1, nil
@ -149,9 +149,11 @@ func (nm *NodeManager) PeekClient(meta *Meta) (UniqueID, types.IndexNode) {
wg.Wait()
cancel()
if peekNodeID != 0 {
log.Info("IndexCoord peek client success", zap.Int64("nodeID", peekNodeID))
return peekNodeID, allClients[peekNodeID]
}
log.Warn("IndexCoord peek client fail")
return 0, nil
}