diff --git a/CHANGELOG.md b/CHANGELOG.md index fb47555edf7ef651a4660eec5a8cf15a6316f139..3a5f5d5c26c2d70a8db4662298ed678215722d17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ Please mark all change in change log and use the issue from GitHub - \#2373 Build index for small segment waste time on waiting background index thread finish - \#2394 Drop collection timeout if too many partitions created on collection - \#2549 Launch server fail using demo config +- \#2564 cache.cache_size range check error ## Feature - \#2363 Update branch version diff --git a/core/src/config/Config.cpp b/core/src/config/Config.cpp index 87a1762d49ec89e9ae842f39f6e47a918e1e12be..b93e4a8181fff8c0073e342029eda9ca6005fcee 100644 --- a/core/src/config/Config.cpp +++ b/core/src/config/Config.cpp @@ -1189,7 +1189,7 @@ Config::CheckCacheConfigCpuCacheCapacity(const std::string& value) { std::string str = GetConfigStr(CONFIG_CACHE, CONFIG_CACHE_INSERT_BUFFER_SIZE, "0"); - int64_t insert_buffer_size = parse_bytes(value, err); + int64_t insert_buffer_size = parse_bytes(str, err); fiu_do_on("Config.CheckCacheConfigCpuCacheCapacity.large_insert_buffer", insert_buffer_size = total_mem + 1); if (insert_buffer_size + cache_size >= total_mem) { std::string msg = "Invalid cpu cache size: " + value + diff --git a/core/unittest/server/test_config.cpp b/core/unittest/server/test_config.cpp index 3e3c5e17fd3eff09764fdf3c18dd49bed4d5f4e9..da41b875ccddea8085a238809a4cce6f44b85b1f 100644 --- a/core/unittest/server/test_config.cpp +++ b/core/unittest/server/test_config.cpp @@ -256,6 +256,30 @@ TEST_F(ConfigTest, SERVER_CONFIG_VALID_TEST) { ASSERT_TRUE(config.GetCacheConfigCacheInsertData(bool_val).ok()); ASSERT_TRUE(bool_val == cache_insert_data); + { + // #2564 + int64_t total_mem = 0, free_mem = 0; + milvus::server::CommonUtil::GetSystemMemInfo(total_mem, free_mem); + ASSERT_TRUE(config.SetCacheConfigInsertBufferSize("1GB").ok()); + int64_t cache_cpu_cache_size = total_mem / 2; + float cache_cpu_cache_threshold = 0.7; + ASSERT_TRUE(config.SetCacheConfigCpuCacheThreshold(std::to_string(cache_cpu_cache_threshold)).ok()); + ASSERT_TRUE(config.SetCacheConfigCpuCacheCapacity(std::to_string(cache_cpu_cache_size)).ok()); + ASSERT_TRUE(config.GetCacheConfigCpuCacheCapacity(int64_val).ok()); + ASSERT_TRUE(int64_val == cache_cpu_cache_size); + } + + { + int64_t total_mem = 0, free_mem = 0; + milvus::server::CommonUtil::GetSystemMemInfo(total_mem, free_mem); + ASSERT_TRUE(config.SetCacheConfigInsertBufferSize("1GB").ok()); + int64_t cache_cpu_cache_size = total_mem - 1073741824 - 1; // total_size - 1GB - 1 + ASSERT_TRUE(config.SetCacheConfigCpuCacheCapacity(std::to_string(cache_cpu_cache_size)).ok()); + ASSERT_TRUE(config.GetCacheConfigCpuCacheCapacity(int64_val).ok()); + ASSERT_TRUE(int64_val == cache_cpu_cache_size); + } + + /* engine config */ int64_t engine_use_blas_threshold = 50; ASSERT_TRUE(config.SetEngineConfigUseBlasThreshold(std::to_string(engine_use_blas_threshold)).ok());