mirror of https://github.com/milvus-io/milvus.git
Fix UpdateFlushSegmentsInfo bug (#11407)
issue: #7313 Signed-off-by: sunby <sunbingyi1992@gmail.com>pull/11421/head
parent
a5e6b31cea
commit
db6ecd58f2
|
@ -308,15 +308,13 @@ func (m *meta) UpdateFlushSegmentsInfo(segmentID UniqueID, flushed bool,
|
|||
modSegments[cp.GetSegmentID()] = s
|
||||
}
|
||||
|
||||
for id := range modSegments {
|
||||
if segment := m.segments.GetSegment(id); segment != nil {
|
||||
segBytes, err := proto.Marshal(segment.SegmentInfo)
|
||||
if err != nil {
|
||||
return fmt.Errorf("DataCoord UpdateFlushSegmentsInfo segmentID:%d, marshal failed:%w", segment.GetID(), err)
|
||||
}
|
||||
key := buildSegmentPath(segment.GetCollectionID(), segment.GetPartitionID(), segment.GetID())
|
||||
kv[key] = string(segBytes)
|
||||
for _, segment := range modSegments {
|
||||
segBytes, err := proto.Marshal(segment.SegmentInfo)
|
||||
if err != nil {
|
||||
return fmt.Errorf("DataCoord UpdateFlushSegmentsInfo segmentID:%d, marshal failed:%w", segment.GetID(), err)
|
||||
}
|
||||
key := buildSegmentPath(segment.GetCollectionID(), segment.GetPartitionID(), segment.GetID())
|
||||
kv[key] = string(segBytes)
|
||||
}
|
||||
|
||||
if len(kv) == 0 {
|
||||
|
|
|
@ -255,7 +255,7 @@ func TestUpdateFlushSegmentsInfo(t *testing.T) {
|
|||
Statslogs: []*datapb.FieldBinlog{{FieldID: 1, Binlogs: []string{"statslog0", "statslog1"}}},
|
||||
Deltalogs: []*datapb.DeltaLogInfo{{RecordEntries: 1, TimestampFrom: 100, TimestampTo: 200, DeltaLogSize: 1000}},
|
||||
}}
|
||||
assert.EqualValues(t, expected, updated)
|
||||
assert.True(t, proto.Equal(expected, updated))
|
||||
})
|
||||
|
||||
t.Run("update non-existed segment", func(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue