mirror of https://github.com/milvus-io/milvus.git
enhance: [10kcp] Reducing the granularity of locks in the target manager (#38956)
pr: https://github.com/milvus-io/milvus/pull/38566 Just for test, I'll remove the global mutex latter. Signed-off-by: bigsheeper <yihao.dai@zilliz.com>pull/38968/head
parent
7934c211c6
commit
663ec6f822
|
@ -152,8 +152,6 @@ func (mgr *TargetManager) UpdateCollectionNextTarget(collectionID int64) error {
|
|||
return err
|
||||
}
|
||||
|
||||
mgr.rwMutex.Lock()
|
||||
defer mgr.rwMutex.Unlock()
|
||||
partitions := mgr.meta.GetPartitionsByCollection(collectionID)
|
||||
partitionIDs := lo.Map(partitions, func(partition *Partition, i int) int64 {
|
||||
return partition.PartitionID
|
||||
|
@ -183,7 +181,7 @@ func (mgr *TargetManager) UpdateCollectionNextTarget(collectionID int64) error {
|
|||
}
|
||||
|
||||
for _, infos := range channelInfos {
|
||||
merged := mgr.mergeDmChannelInfo(infos)
|
||||
merged := mergeDmChannelInfo(infos)
|
||||
dmChannels[merged.GetChannelName()] = merged
|
||||
}
|
||||
|
||||
|
@ -193,7 +191,11 @@ func (mgr *TargetManager) UpdateCollectionNextTarget(collectionID int64) error {
|
|||
}
|
||||
|
||||
allocatedTarget := NewCollectionTarget(segments, dmChannels, partitionIDs)
|
||||
|
||||
mgr.rwMutex.Lock()
|
||||
mgr.next.updateCollectionTarget(collectionID, allocatedTarget)
|
||||
mgr.rwMutex.Unlock()
|
||||
|
||||
log.Debug("finish to update next targets for collection",
|
||||
zap.Int64("collectionID", collectionID),
|
||||
zap.Int64s("PartitionIDs", partitionIDs))
|
||||
|
@ -201,7 +203,7 @@ func (mgr *TargetManager) UpdateCollectionNextTarget(collectionID int64) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (mgr *TargetManager) mergeDmChannelInfo(infos []*datapb.VchannelInfo) *DmChannel {
|
||||
func mergeDmChannelInfo(infos []*datapb.VchannelInfo) *DmChannel {
|
||||
var dmChannel *DmChannel
|
||||
|
||||
for _, info := range infos {
|
||||
|
|
Loading…
Reference in New Issue