Skip to content

Commit

Permalink
Fix compaction panic (milvus-io#17840)
Browse files Browse the repository at this point in the history
See also: milvus-io#17823

Signed-off-by: yangxuan <xuan.yang@zilliz.com>
  • Loading branch information
XuanYang-cn authored Jun 29, 2022
1 parent 24b3ad2 commit ff3c4ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/datacoord/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,8 @@ func buildSegment(collectionID UniqueID, partitionID UniqueID, segmentID UniqueI
}

func isSegmentHealthy(segment *SegmentInfo) bool {
return segment.GetState() != commonpb.SegmentState_SegmentStateNone &&
return segment != nil &&
segment.GetState() != commonpb.SegmentState_SegmentStateNone &&
segment.GetState() != commonpb.SegmentState_NotExist &&
segment.GetState() != commonpb.SegmentState_Dropped
}
Expand Down
6 changes: 6 additions & 0 deletions internal/datacoord/meta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,3 +755,9 @@ func TestMeta_GetAllSegments(t *testing.T) {
assert.Nil(t, seg2)
assert.NotNil(t, seg2All)
}

func TestMeta_isSegmentHealthy_issue17823_panic(t *testing.T) {
var seg *SegmentInfo

assert.False(t, isSegmentHealthy(seg))
}

0 comments on commit ff3c4ab

Please sign in to comment.