Skip to content

Commit

Permalink
fix: Fix index memory estimation (#35225)
Browse files Browse the repository at this point in the history
issue: #35229

Signed-off-by: sunby <[email protected]>
  • Loading branch information
sunby authored Aug 2, 2024
1 parent db06b86 commit 3641ae6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/querynodev2/segments/segment_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,7 @@ func (loader *segmentLoader) checkSegmentSize(ctx context.Context, segmentLoadIn
// getResourceUsageEstimateOfSegment estimates the resource usage of the segment
func getResourceUsageEstimateOfSegment(schema *schemapb.CollectionSchema, loadInfo *querypb.SegmentLoadInfo, multiplyFactor resourceEstimateFactor) (usage *ResourceUsage, err error) {
var segmentMemorySize, segmentDiskSize uint64
var indexMemorySize uint64
var mmapFieldCount int

vecFieldID2IndexInfo := make(map[int64]*querypb.FieldIndexInfo)
Expand All @@ -1216,7 +1217,7 @@ func getResourceUsageEstimateOfSegment(schema *schemapb.CollectionSchema, loadIn
loadInfo.GetSegmentID(),
fieldIndexInfo.GetBuildID())
}
segmentMemorySize += neededMemSize
indexMemorySize += neededMemSize
if mmapEnabled {
segmentDiskSize += neededMemSize + neededDiskSize
} else {
Expand Down Expand Up @@ -1253,7 +1254,7 @@ func getResourceUsageEstimateOfSegment(schema *schemapb.CollectionSchema, loadIn
segmentMemorySize += uint64(float64(getBinlogDataMemorySize(fieldBinlog)) * multiplyFactor.deltaDataExpansionFactor)
}
return &ResourceUsage{
MemorySize: segmentMemorySize,
MemorySize: segmentMemorySize + indexMemorySize,
DiskSize: segmentDiskSize,
MmapFieldCount: mmapFieldCount,
}, nil
Expand Down

0 comments on commit 3641ae6

Please sign in to comment.