Skip to content

Commit

Permalink
fix: TestBlock case use different segment id in testcase (milvus-io#3…
Browse files Browse the repository at this point in the history
…1173)

Resolves: milvus-io#31172

Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia authored Mar 11, 2024
1 parent 5c0bb40 commit 937f244
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions internal/datanode/syncmgr/sync_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ func (s *SyncManagerSuite) TestBlock() {
counter := atomic.NewInt32(0)
s.broker.EXPECT().SaveBinlogPaths(mock.Anything, mock.Anything).Return(nil)
bfs := metacache.NewBloomFilterSet()
seg := metacache.NewSegmentInfo(&datapb.SegmentInfo{}, bfs)
seg := metacache.NewSegmentInfo(&datapb.SegmentInfo{
ID: s.segmentID,
}, bfs)
metacache.UpdateNumOfRows(1000)(seg)
s.metacache.EXPECT().GetSegmentByID(s.segmentID).Return(seg, true)
s.metacache.EXPECT().GetSegmentsBy(mock.Anything).
Expand All @@ -233,22 +235,20 @@ func (s *SyncManagerSuite) TestBlock() {
// block
manager.Block(s.segmentID)

go func() {
task := s.getSuiteSyncTask()
task.WithMetaWriter(BrokerMetaWriter(s.broker, 1))
task.WithTimeRange(50, 100)
task.WithCheckpoint(&msgpb.MsgPosition{
ChannelName: s.channelName,
MsgID: []byte{1, 2, 3, 4},
Timestamp: 100,
})
manager.SyncData(context.Background(), task)
}()
task := s.getSuiteSyncTask()
task.WithMetaWriter(BrokerMetaWriter(s.broker, 1))
task.WithTimeRange(50, 100)
task.WithCheckpoint(&msgpb.MsgPosition{
ChannelName: s.channelName,
MsgID: []byte{1, 2, 3, 4},
Timestamp: 100,
})
manager.SyncData(context.Background(), task)

select {
case <-sig:
s.FailNow("sync task done during block")
default:
case <-time.After(time.Second):
}

manager.Unblock(s.segmentID)
Expand Down

0 comments on commit 937f244

Please sign in to comment.