Skip to content

Commit

Permalink
fix: nil part stats without l2 compaction(milvus-io#34923) (milvus-io…
Browse files Browse the repository at this point in the history
…#34992)

related: milvus-io#34923

Signed-off-by: MrPresent-Han <[email protected]>
Co-authored-by: MrPresent-Han <[email protected]>
Signed-off-by: Sumit Dubey <[email protected]>
  • Loading branch information
2 people authored and sumitd2 committed Aug 6, 2024
1 parent e6c207c commit a90ebaa
Show file tree
Hide file tree
Showing 2 changed files with 248 additions and 53 deletions.
21 changes: 14 additions & 7 deletions internal/querynodev2/delegator/segment_pruner.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ func PruneSegments(ctx context.Context,
) {
_, span := otel.Tracer(typeutil.QueryNodeRole).Start(ctx, "segmentPrune")
defer span.End()
if partitionStats == nil {
return
}
// 1. select collection, partitions and expr
clusteringKeyField := clustering.GetClusteringKeyField(schema)
if clusteringKeyField == nil {
Expand Down Expand Up @@ -113,17 +116,21 @@ func PruneSegments(ctx context.Context,
targetSegmentIDs := make([]int64, 0, 32)
if len(partitionIDs) > 0 {
for _, partID := range partitionIDs {
partStats := partitionStats[partID]
for segID, segStat := range partStats.SegmentStats {
targetSegmentIDs = append(targetSegmentIDs, segID)
targetSegmentStats = append(targetSegmentStats, segStat)
partStats, exist := partitionStats[partID]
if exist && partStats != nil {
for segID, segStat := range partStats.SegmentStats {
targetSegmentIDs = append(targetSegmentIDs, segID)
targetSegmentStats = append(targetSegmentStats, segStat)
}
}
}
} else {
for _, partStats := range partitionStats {
for segID, segStat := range partStats.SegmentStats {
targetSegmentIDs = append(targetSegmentIDs, segID)
targetSegmentStats = append(targetSegmentStats, segStat)
if partStats != nil {
for segID, segStat := range partStats.SegmentStats {
targetSegmentIDs = append(targetSegmentIDs, segID)
targetSegmentStats = append(targetSegmentStats, segStat)
}
}
}
}
Expand Down
Loading

0 comments on commit a90ebaa

Please sign in to comment.