From 315df1ff15d9ed1222c56d9ca870b34a18b4a219 Mon Sep 17 00:00:00 2001 From: "cai.zhang" Date: Tue, 19 Jul 2022 14:24:29 +0800 Subject: [PATCH] Reduce the timer time of assigning index task scheduler (#18319) Signed-off-by: Cai.Zhang --- internal/indexcoord/index_builder.go | 5 +++-- internal/indexcoord/node_manager.go | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/indexcoord/index_builder.go b/internal/indexcoord/index_builder.go index eb24f0efcf..6293b6a19c 100644 --- a/internal/indexcoord/index_builder.go +++ b/internal/indexcoord/index_builder.go @@ -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) } diff --git a/internal/indexcoord/node_manager.go b/internal/indexcoord/node_manager.go index 8fb71d2013..45cf3402da 100644 --- a/internal/indexcoord/node_manager.go +++ b/internal/indexcoord/node_manager.go @@ -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 }