mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
fix: Check whether index type support mmap even param enabled (#40614)
Related to #40537 Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
4dc7c11bbe
commit
e23f429299
@ -263,20 +263,21 @@ func getFieldSchema(schema *schemapb.CollectionSchema, fieldID int64) (*schemapb
|
||||
|
||||
func isIndexMmapEnable(fieldSchema *schemapb.FieldSchema, indexInfo *querypb.FieldIndexInfo) bool {
|
||||
enableMmap, exist := common.IsMmapIndexEnabled(indexInfo.IndexParams...)
|
||||
if exist {
|
||||
// fast path for returning disabled, need to perform index type check for enabled case
|
||||
if exist && !enableMmap {
|
||||
return enableMmap
|
||||
}
|
||||
indexType := common.GetIndexType(indexInfo.IndexParams)
|
||||
var indexSupportMmap bool
|
||||
var defaultEnableMmap bool
|
||||
// var defaultEnableMmap bool
|
||||
if typeutil.IsVectorType(fieldSchema.GetDataType()) {
|
||||
indexSupportMmap = vecindexmgr.GetVecIndexMgrInstance().IsMMapSupported(indexType)
|
||||
defaultEnableMmap = params.Params.QueryNodeCfg.MmapVectorIndex.GetAsBool()
|
||||
enableMmap = params.Params.QueryNodeCfg.MmapVectorIndex.GetAsBool() || enableMmap
|
||||
} else {
|
||||
indexSupportMmap = indexparamcheck.IsScalarMmapIndex(indexType)
|
||||
defaultEnableMmap = params.Params.QueryNodeCfg.MmapScalarIndex.GetAsBool()
|
||||
enableMmap = params.Params.QueryNodeCfg.MmapScalarIndex.GetAsBool() || enableMmap
|
||||
}
|
||||
return indexSupportMmap && defaultEnableMmap
|
||||
return indexSupportMmap && enableMmap
|
||||
}
|
||||
|
||||
func isDataMmapEnable(fieldSchema *schemapb.FieldSchema) bool {
|
||||
|
||||
@ -152,6 +152,23 @@ func TestIsIndexMmapEnable(t *testing.T) {
|
||||
})
|
||||
assert.True(t, enable)
|
||||
})
|
||||
|
||||
t.Run("mmap scalar index param not supported", func(t *testing.T) {
|
||||
paramtable.Get().Save(paramtable.Get().QueryNodeCfg.MmapScalarIndex.Key, "true")
|
||||
defer paramtable.Get().Reset(paramtable.Get().QueryNodeCfg.MmapScalarIndex.Key)
|
||||
enable := isIndexMmapEnable(&schemapb.FieldSchema{
|
||||
DataType: schemapb.DataType_String,
|
||||
}, &querypb.FieldIndexInfo{
|
||||
IndexParams: []*commonpb.KeyValuePair{
|
||||
{
|
||||
Key: common.IndexTypeKey,
|
||||
Value: "STL_SORT",
|
||||
},
|
||||
{Key: common.MmapEnabledKey, Value: "true"},
|
||||
},
|
||||
})
|
||||
assert.False(t, enable)
|
||||
})
|
||||
}
|
||||
|
||||
func TestIsDataMmmapEnable(t *testing.T) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user