diff --git a/internal/util/initcore/init_core.go b/internal/util/initcore/init_core.go index 86d7071613..700660816e 100644 --- a/internal/util/initcore/init_core.go +++ b/internal/util/initcore/init_core.go @@ -173,13 +173,6 @@ func InitRemoteChunkManager(params *paramtable.ComponentParam) error { func InitMmapManager(params *paramtable.ComponentParam) error { mmapDirPath := params.QueryNodeCfg.MmapDirPath.GetValue() - if len(mmapDirPath) == 0 { - paramtable.Get().Save( - paramtable.Get().QueryNodeCfg.MmapDirPath.Key, - path.Join(paramtable.Get().LocalStorageCfg.Path.GetValue(), "mmap"), - ) - mmapDirPath = paramtable.Get().QueryNodeCfg.MmapDirPath.GetValue() - } cMmapChunkManagerDir := C.CString(path.Join(mmapDirPath, "/mmap_chunk_manager/")) cCacheReadAheadPolicy := C.CString(params.QueryNodeCfg.ReadAheadPolicy.GetValue()) defer C.free(unsafe.Pointer(cMmapChunkManagerDir)) diff --git a/pkg/util/paramtable/component_param.go b/pkg/util/paramtable/component_param.go index 8a5d735a50..9eb1a82fa2 100644 --- a/pkg/util/paramtable/component_param.go +++ b/pkg/util/paramtable/component_param.go @@ -14,6 +14,7 @@ package paramtable import ( "fmt" "os" + "path" "strconv" "strings" "sync" @@ -2477,6 +2478,12 @@ func (p *queryNodeConfig) init(base *BaseTable) { DefaultValue: "", FallbackKeys: []string{"queryNode.mmapDirPath"}, Doc: "The folder that storing data files for mmap, setting to a path will enable Milvus to load data with mmap", + Formatter: func(v string) string { + if len(v) == 0 { + return path.Join(base.Get("localStorage.path"), "mmap") + } + return v + }, } p.MmapDirPath.Init(base.mgr) diff --git a/pkg/util/paramtable/component_param_test.go b/pkg/util/paramtable/component_param_test.go index 967f530135..e8d6b864dc 100644 --- a/pkg/util/paramtable/component_param_test.go +++ b/pkg/util/paramtable/component_param_test.go @@ -441,6 +441,7 @@ func TestComponentParam(t *testing.T) { assert.Equal(t, 3*time.Second, Params.LazyLoadRequestResourceRetryInterval.GetAsDuration(time.Millisecond)) assert.Equal(t, 4, Params.BloomFilterApplyParallelFactor.GetAsInt()) + assert.Equal(t, "/var/lib/milvus/data/mmap", Params.MmapDirPath.GetValue()) }) t.Run("test dataCoordConfig", func(t *testing.T) {