Skip to content

Commit

Permalink
fix: [2.4]Fix the bug that retrieved from wrong field for L0 segments (
Browse files Browse the repository at this point in the history
…#37599)

issue: #37574 

master pr: #37598

Signed-off-by: Cai Zhang <[email protected]>
  • Loading branch information
xiaocai2333 authored Nov 12, 2024
1 parent 074f8ee commit 3456e24
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion internal/querynodev2/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import (
func loadL0Segments(ctx context.Context, delegator delegator.ShardDelegator, req *querypb.WatchDmChannelsRequest) error {
l0Segments := make([]*querypb.SegmentLoadInfo, 0)
for _, channel := range req.GetInfos() {
for _, segmentID := range channel.GetFlushedSegmentIds() {
for _, segmentID := range channel.GetLevelZeroSegmentIds() {
segmentInfo, ok := req.GetSegmentInfos()[segmentID]
if !ok ||
segmentInfo.GetLevel() != datapb.SegmentLevel_L0 {
Expand Down
25 changes: 14 additions & 11 deletions internal/querynodev2/services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ type ServiceSuite struct {
schema *schemapb.CollectionSchema
partitionIDs []int64
// Test segments
validSegmentIDs []int64
flushedSegmentIDs []int64
droppedSegmentIDs []int64
validSegmentIDs []int64
flushedSegmentIDs []int64
droppedSegmentIDs []int64
levelZeroSegmentIDs []int64
// Test channel
vchannel string
pchannel string
Expand Down Expand Up @@ -101,8 +102,9 @@ func (suite *ServiceSuite) SetupSuite() {
suite.collectionName = "test-collection"
suite.partitionIDs = []int64{222}
suite.validSegmentIDs = []int64{1, 2, 3}
suite.flushedSegmentIDs = []int64{4, 5, 6}
suite.flushedSegmentIDs = []int64{5, 6}
suite.droppedSegmentIDs = []int64{7, 8, 9}
suite.levelZeroSegmentIDs = []int64{4}

var err error
suite.mapper = metautil.NewDynChannelMapper()
Expand Down Expand Up @@ -277,16 +279,17 @@ func (suite *ServiceSuite) TestWatchDmChannelsInt64() {
PartitionIDs: suite.partitionIDs,
Infos: []*datapb.VchannelInfo{
{
CollectionID: suite.collectionID,
ChannelName: suite.vchannel,
SeekPosition: suite.position,
FlushedSegmentIds: suite.flushedSegmentIDs,
DroppedSegmentIds: suite.droppedSegmentIDs,
CollectionID: suite.collectionID,
ChannelName: suite.vchannel,
SeekPosition: suite.position,
FlushedSegmentIds: suite.flushedSegmentIDs,
DroppedSegmentIds: suite.droppedSegmentIDs,
LevelZeroSegmentIds: suite.levelZeroSegmentIDs,
},
},
SegmentInfos: map[int64]*datapb.SegmentInfo{
suite.flushedSegmentIDs[0]: {
ID: suite.flushedSegmentIDs[0],
suite.levelZeroSegmentIDs[0]: {
ID: suite.levelZeroSegmentIDs[0],
CollectionID: suite.collectionID,
PartitionID: suite.partitionIDs[0],
InsertChannel: suite.vchannel,
Expand Down

0 comments on commit 3456e24

Please sign in to comment.