fix: [10kcp] Fix concurrent scheule (#38974)

supplement to pr: https://github.com/milvus-io/milvus/pull/38566

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
10kcp
yihao.dai 2025-01-03 12:59:12 +08:00 committed by GitHub
parent f5f4fed889
commit 584b054981
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -172,6 +172,7 @@ type taskScheduler struct {
cluster session.Cluster
nodeMgr *session.NodeManager
scheduleMu sync.Mutex // guards schedule()
collKeyLock *lock.KeyLock[int64] // guards Add()
tasks *ConcurrentMap[UniqueID, struct{}]
segmentTasks *ConcurrentMap[replicaSegmentIndex, Task]
@ -502,6 +503,8 @@ func (scheduler *taskScheduler) Dispatch(node int64) {
log.Info("scheduler stopped")
default:
scheduler.scheduleMu.Lock()
defer scheduler.scheduleMu.Unlock()
scheduler.schedule(node)
}
}