mirror of https://github.com/milvus-io/milvus.git
issue: https://github.com/milvus-io/milvus/issues/31569 related pr: https://github.com/milvus-io/milvus/pull/31536 Signed-off-by: sunby <sunbingyi1992@gmail.com>pull/31641/head^2
parent
af7da00488
commit
875887244b
|
@ -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)
|
||||
|
||||
|
|
|
@ -1456,8 +1456,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",
|
||||
|
@ -1472,6 +1473,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…
Reference in New Issue