Skip to content

Commit

Permalink
Fix modify segment without clone
Browse files Browse the repository at this point in the history
issue: #10430
Signed-off-by: sunby <bingyi.sun@zilliz.com>
  • Loading branch information
sunby committed Oct 23, 2021
1 parent 43ef5d5 commit 5d4bbac
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions internal/datacoord/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,21 @@ func (m *meta) UpdateFlushSegmentsInfo(segmentID UniqueID, flushed bool,

modSegments[segmentID] = clonedSegment

var getClonedSegment = func(segmentID UniqueID) *SegmentInfo {
if s, ok := modSegments[segmentID]; ok {
return s
}
if s := m.segments.GetSegment(segmentID); s != nil {
return s.Clone()
}
return nil
}

for _, pos := range startPositions {
if len(pos.GetStartPosition().GetMsgID()) == 0 {
continue
}
s := modSegments[pos.GetSegmentID()]
if s == nil {
s = m.segments.GetSegment(pos.GetSegmentID())
}
s := getClonedSegment(pos.GetSegmentID())
if s == nil {
continue
}
Expand All @@ -227,10 +234,7 @@ func (m *meta) UpdateFlushSegmentsInfo(segmentID UniqueID, flushed bool,
}

for _, cp := range checkpoints {
s := modSegments[cp.GetSegmentID()]
if s == nil {
s = m.segments.GetSegment(cp.GetSegmentID())
}
s := getClonedSegment(cp.GetSegmentID())
if s == nil {
continue
}
Expand Down

0 comments on commit 5d4bbac

Please sign in to comment.