diff --git a/internal/datacoord/meta.go b/internal/datacoord/meta.go index 536d800680509..ba6f8bafe152b 100644 --- a/internal/datacoord/meta.go +++ b/internal/datacoord/meta.go @@ -339,33 +339,34 @@ func (m *meta) GetClonedCollectionInfo(collectionID UniqueID) *collectionInfo { func (m *meta) GetSegmentsChanPart(selector SegmentInfoSelector) []*chanPartSegments { m.RLock() defer m.RUnlock() - mDimEntry := make(map[string]*chanPartSegments) + type dim struct { + partitionID int64 + channelName string + } + + mDimEntry := make(map[dim]*chanPartSegments) - log.Debug("GetSegmentsChanPart segment number", zap.Int("length", len(m.segments.GetSegments()))) - for _, segmentInfo := range m.segments.segments { - if !selector(segmentInfo) { + for _, si := range m.segments.segments { + if !selector(si) { continue } - - cloned := segmentInfo.Clone() - - dim := fmt.Sprintf("%d-%s", cloned.PartitionID, cloned.InsertChannel) - entry, ok := mDimEntry[dim] + d := dim{si.PartitionID, si.InsertChannel} + entry, ok := mDimEntry[d] if !ok { entry = &chanPartSegments{ - collectionID: cloned.CollectionID, - partitionID: cloned.PartitionID, - channelName: cloned.InsertChannel, + collectionID: si.CollectionID, + partitionID: si.PartitionID, + channelName: si.InsertChannel, } - mDimEntry[dim] = entry + mDimEntry[d] = entry } - entry.segments = append(entry.segments, cloned) + entry.segments = append(entry.segments, si) } - result := make([]*chanPartSegments, 0, len(mDimEntry)) for _, entry := range mDimEntry { result = append(result, entry) } + log.Debug("GetSegmentsChanPart", zap.Int("length", len(result))) return result }