mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
fix: fix mmap enabled check in resource estimation (#31536)
issue: https://github.com/milvus-io/milvus/issues/31569 Signed-off-by: sunby <sunbingyi1992@gmail.com>
This commit is contained in:
parent
9a13b9822f
commit
0c868b654d
@ -70,19 +70,24 @@ func deleteLoadIndexInfo(info *LoadIndexInfo) {
|
||||
}).Await()
|
||||
}
|
||||
|
||||
func isIndexMmapEnable(indexInfo *querypb.FieldIndexInfo) bool {
|
||||
enableMmap := common.IsMmapEnabled(indexInfo.IndexParams...)
|
||||
if !enableMmap {
|
||||
_, ok := funcutil.KeyValuePair2Map(indexInfo.IndexParams)[common.MmapEnabledKey]
|
||||
indexType := datacoord.GetIndexType(indexInfo.IndexParams)
|
||||
indexSupportMmap := indexparamcheck.IsMmapSupported(indexType)
|
||||
enableMmap = !ok && params.Params.QueryNodeCfg.MmapEnabled.GetAsBool() && indexSupportMmap
|
||||
}
|
||||
return enableMmap
|
||||
}
|
||||
|
||||
func (li *LoadIndexInfo) appendLoadIndexInfo(ctx context.Context, indexInfo *querypb.FieldIndexInfo, collectionID int64, partitionID int64, segmentID int64, fieldType schemapb.DataType) error {
|
||||
fieldID := indexInfo.FieldID
|
||||
indexPaths := indexInfo.IndexFilePaths
|
||||
|
||||
indexParams := funcutil.KeyValuePair2Map(indexInfo.IndexParams)
|
||||
|
||||
enableMmap := common.IsMmapEnabled(indexInfo.IndexParams...)
|
||||
if !enableMmap {
|
||||
_, ok := indexParams[common.MmapEnabledKey]
|
||||
indexType := datacoord.GetIndexType(indexInfo.IndexParams)
|
||||
indexSupportMmap := indexparamcheck.IsMmapSupported(indexType)
|
||||
enableMmap = !ok && params.Params.QueryNodeCfg.MmapEnabled.GetAsBool() && indexSupportMmap
|
||||
}
|
||||
enableMmap := isIndexMmapEnable(indexInfo)
|
||||
// as Knowhere reports error if encounter a unknown param, we need to delete it
|
||||
delete(indexParams, common.MmapEnabledKey)
|
||||
|
||||
|
||||
@ -1457,8 +1457,9 @@ func getResourceUsageEstimateOfSegment(schema *schemapb.CollectionSchema, loadIn
|
||||
|
||||
for _, fieldBinlog := range loadInfo.BinlogPaths {
|
||||
fieldID := fieldBinlog.FieldID
|
||||
mmapEnabled := common.IsFieldMmapEnabled(schema, fieldID)
|
||||
var mmapEnabled bool
|
||||
if fieldIndexInfo, ok := vecFieldID2IndexInfo[fieldID]; ok {
|
||||
mmapEnabled = isIndexMmapEnable(fieldIndexInfo)
|
||||
neededMemSize, neededDiskSize, err := getIndexAttrCache().GetIndexResourceUsage(fieldIndexInfo, multiplyFactor.memoryIndexUsageFactor)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to get index size collection %d, segment %d, indexBuildID %d",
|
||||
@ -1473,6 +1474,8 @@ func getResourceUsageEstimateOfSegment(schema *schemapb.CollectionSchema, loadIn
|
||||
segmentDiskSize += neededDiskSize
|
||||
}
|
||||
} else {
|
||||
mmapEnabled = common.IsFieldMmapEnabled(schema, fieldID) ||
|
||||
(!common.FieldHasMmapKey(schema, fieldID) && params.Params.QueryNodeCfg.MmapEnabled.GetAsBool())
|
||||
binlogSize := uint64(getBinlogDataSize(fieldBinlog))
|
||||
if mmapEnabled {
|
||||
segmentDiskSize += binlogSize
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user