Fix not all segment state is drop after DropVirtualChannel (#12702)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/12726/head
congqixia 2021-12-03 18:55:34 +08:00 committed by GitHub
parent 877bfdac58
commit 22fddc537c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View File

@ -351,6 +351,19 @@ func (m *meta) UpdateDropChannelSegmentInfo(channel string, segments []*SegmentI
modSegments[seg2Drop.GetID()] = segment
}
}
// set all channels of channel to dropped
for _, seg := range m.segments.segments {
if seg.InsertChannel != channel {
continue
}
_, ok := modSegments[seg.ID]
// seg inf mod segments are all in dropped state
if !ok {
clonedSeg := seg.Clone()
clonedSeg.State = commonpb.SegmentState_Dropped
modSegments[seg.ID] = clonedSeg
}
}
return m.batchSaveDropSegments(channel, modSegments)
}

View File

@ -960,6 +960,16 @@ func TestDropVirtualChannel(t *testing.T) {
err := svr.meta.AddSegment(NewSegmentInfo(s))
assert.Nil(t, err)
}
// add non matched segments
os := &datapb.SegmentInfo{
ID: maxOperationsPerTxn + 100,
CollectionID: 0,
InsertChannel: "ch2",
State: commonpb.SegmentState_Growing,
}
svr.meta.AddSegment(NewSegmentInfo(os))
err := svr.channelManager.AddNode(0)
require.Nil(t, err)