From 3c0070e6fd11b07ffa336a570008b9841b5ba3c8 Mon Sep 17 00:00:00 2001 From: yangxuan Date: Fri, 6 Sep 2024 10:49:21 +0800 Subject: [PATCH] fix: [cp]Change deltalog memory estimation fator to one See also: #36031 pr: #36033 Signed-off-by: yangxuan --- internal/querynodev2/segments/segment_loader.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/querynodev2/segments/segment_loader.go b/internal/querynodev2/segments/segment_loader.go index 0a682577fbe8c..8fb49dfd32d92 100644 --- a/internal/querynodev2/segments/segment_loader.go +++ b/internal/querynodev2/segments/segment_loader.go @@ -1662,7 +1662,18 @@ func getResourceUsageEstimateOfSegment(schema *schemapb.CollectionSchema, loadIn // get size of delete data for _, fieldBinlog := range loadInfo.Deltalogs { - segmentMemorySize += uint64(float64(getBinlogDataMemorySize(fieldBinlog)) * multiplyFactor.deltaDataExpansionFactor) + // MemorySize of filedBinlog is the actual size in memory, so the expansionFactor + // should be 1, in most cases. + expansionFactor := float64(1) + memSize := getBinlogDataMemorySize(fieldBinlog) + + // Note: If MemorySize == DiskSize, it means the segment comes from Milvus 2.3, + // MemorySize is actually compressed DiskSize of deltalog, so we'll fallback to use + // deltaExpansionFactor to compromise the compression ratio. + if memSize == getBinlogDataDiskSize(fieldBinlog) { + expansionFactor = multiplyFactor.deltaDataExpansionFactor + } + segmentMemorySize += uint64(float64(memSize) * expansionFactor) } return &ResourceUsage{ MemorySize: segmentMemorySize + indexMemorySize,