Skip to content

Commit

Permalink
fix: Fix large growing segment (#37388) (#37540)
Browse files Browse the repository at this point in the history
Consider the `sealProportion` factor during segment allocation.

issue: #37387

pr: #37388

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
  • Loading branch information
bigsheeper authored Nov 8, 2024
1 parent 5c166a2 commit fd1ca73
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion internal/datacoord/segment_allocation_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,18 @@ func AllocatePolicyL1(segments []*SegmentInfo, count int64,
for _, allocation := range segment.allocations {
allocSize += allocation.NumOfRows
}
free := segment.GetMaxRowNum() - segment.GetNumOfRows() - allocSize

// When inserts are too fast, hardTimeTick may lag, causing segment to be unable to seal in time.
// To prevent allocating large segment, introducing the sealProportion factor here.
// The condition `free < 0` ensures that the allocation exceeds the minimum sealable size,
// preventing segments from remaining unsealable indefinitely.
maxRowsWithSealProportion := int64(float64(segment.GetMaxRowNum()) * paramtable.Get().DataCoordCfg.SegmentSealProportion.GetAsFloat())
free := maxRowsWithSealProportion - segment.GetNumOfRows() - allocSize
if free < 0 {
continue
}

free = segment.GetMaxRowNum() - segment.GetNumOfRows() - allocSize
if free < count {
continue
}
Expand Down

0 comments on commit fd1ca73

Please sign in to comment.