mirror of https://github.com/milvus-io/milvus.git
fix: [2.5] Check collection released before target checks (#39843)
Cherry-pick from master pr: #39841 Related to #39840 The target could be updated async in previous code. This PR make remove collection from target observer block until all tasks related in dispatchers are removed preventing the metrics being updated after collection released. --------- Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>pull/39839/head
parent
f85bf59921
commit
9407a3c9b1
|
@ -219,7 +219,9 @@ func (ob *TargetObserver) schedule(ctx context.Context) {
|
|||
delete(ob.readyNotifiers, req.CollectionID)
|
||||
ob.mut.Unlock()
|
||||
|
||||
ob.keylocks.Lock(req.CollectionID)
|
||||
ob.targetMgr.RemoveCollection(ctx, req.CollectionID)
|
||||
ob.keylocks.Unlock(req.CollectionID)
|
||||
req.Notifier <- nil
|
||||
case ReleasePartition:
|
||||
ob.targetMgr.RemovePartition(ctx, req.CollectionID, req.PartitionIDs...)
|
||||
|
@ -250,6 +252,11 @@ func (ob *TargetObserver) check(ctx context.Context, collectionID int64) {
|
|||
ob.keylocks.Lock(collectionID)
|
||||
defer ob.keylocks.Unlock(collectionID)
|
||||
|
||||
// if collection release, skip check
|
||||
if ob.meta.CollectionManager.GetCollection(ctx, collectionID) == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if ob.shouldUpdateCurrentTarget(ctx, collectionID) {
|
||||
ob.updateCurrentTarget(ctx, collectionID)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue