enhance: [10kcp] remove unnecessary clone in meta cache (#38398)

issue: https://github.com/milvus-io/milvus/issues/36627,
https://github.com/milvus-io/milvus/issues/37630

pr: https://github.com/milvus-io/milvus/pull/36628

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
Co-authored-by: Ted Xu <ted.xu@zilliz.com>
pull/38433/head
yihao.dai 2024-12-12 16:33:38 +08:00 committed by GitHub
parent 5521091dcd
commit 11118db7d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 9 deletions

View File

@ -346,26 +346,24 @@ func GetSegmentsChanPart(m *meta, filters ...SegmentFilter) []*chanPartSegments
mDimEntry := make(map[dim]*chanPartSegments)
candidates := m.SelectSegments(filters...)
for _, segmentInfo := range candidates {
cloned := segmentInfo.Clone()
d := dim{cloned.PartitionID, cloned.InsertChannel}
for _, si := range candidates {
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[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
}