mirror of https://github.com/milvus-io/milvus.git
Fix data race caused by no clone while updating index (#21772)
Signed-off-by: yah01 <yang.cen@zilliz.com>pull/21776/head
parent
ad6cbc990f
commit
78fd1987eb
|
@ -109,10 +109,12 @@ func (s *SegmentsInfo) SetSegmentIndex(segmentID UniqueID, segIndex *model.Segme
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
segment = segment.Clone()
|
||||||
if segment.segmentIndexes == nil {
|
if segment.segmentIndexes == nil {
|
||||||
segment.segmentIndexes = make(map[UniqueID]*model.SegmentIndex)
|
segment.segmentIndexes = make(map[UniqueID]*model.SegmentIndex)
|
||||||
}
|
}
|
||||||
segment.segmentIndexes[segIndex.IndexID] = segIndex
|
segment.segmentIndexes[segIndex.IndexID] = segIndex
|
||||||
|
s.segments[segmentID] = segment
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SegmentsInfo) DropSegmentIndex(segmentID UniqueID, indexID UniqueID) {
|
func (s *SegmentsInfo) DropSegmentIndex(segmentID UniqueID, indexID UniqueID) {
|
||||||
|
|
Loading…
Reference in New Issue