未验证 提交 5f3c0052 编写于 作者: W Wang XiangYu 提交者: GitHub

fix cache.cache_size range check error (#2565)

* fix cache.cache_size range check error
Signed-off-by: Nwxyu <xy.wang@zilliz.com>

* update ci
Signed-off-by: Nwxyu <xy.wang@zilliz.com>
上级 d1311a71
...@@ -9,6 +9,7 @@ Please mark all change in change log and use the issue from GitHub ...@@ -9,6 +9,7 @@ Please mark all change in change log and use the issue from GitHub
- \#2368 Make read node detect delete behavior - \#2368 Make read node detect delete behavior
- \#2394 Drop collection timeout if too many partitions created on collection - \#2394 Drop collection timeout if too many partitions created on collection
- \#2549 Launch server fail using demo config - \#2549 Launch server fail using demo config
- \#2564 cache.cache_size range check error
## Feature ## Feature
- \#2363 Update branch version - \#2363 Update branch version
......
#!/usr/bin/env groovy #!/usr/bin/env groovy
String cron_timezone = "TZ=Asia/Shanghai" String cron_timezone = "TZ=Asia/Shanghai"
String cron_string = BRANCH_NAME == "master" ? "38 0 * * * " : "" String cron_string = BRANCH_NAME == "0.10.0" ? "50 22 * * * " : ""
pipeline { pipeline {
agent none agent none
......
...@@ -1327,7 +1327,7 @@ Config::CheckCacheConfigCpuCacheCapacity(const std::string& value) { ...@@ -1327,7 +1327,7 @@ Config::CheckCacheConfigCpuCacheCapacity(const std::string& value) {
std::string str = GetConfigStr(CONFIG_CACHE, CONFIG_CACHE_INSERT_BUFFER_SIZE, "0"); 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); fiu_do_on("Config.CheckCacheConfigCpuCacheCapacity.large_insert_buffer", insert_buffer_size = total_mem + 1);
if (insert_buffer_size + cache_size >= total_mem) { if (insert_buffer_size + cache_size >= total_mem) {
std::string msg = "Invalid cpu cache size: " + value + std::string msg = "Invalid cpu cache size: " + value +
......
...@@ -256,6 +256,30 @@ TEST_F(ConfigTest, SERVER_CONFIG_VALID_TEST) { ...@@ -256,6 +256,30 @@ TEST_F(ConfigTest, SERVER_CONFIG_VALID_TEST) {
ASSERT_TRUE(config.GetCacheConfigCacheInsertData(bool_val).ok()); ASSERT_TRUE(config.GetCacheConfigCacheInsertData(bool_val).ok());
ASSERT_TRUE(bool_val == cache_insert_data); 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 */ /* engine config */
int64_t engine_use_blas_threshold = 50; int64_t engine_use_blas_threshold = 50;
ASSERT_TRUE(config.SetEngineConfigUseBlasThreshold(std::to_string(engine_use_blas_threshold)).ok()); ASSERT_TRUE(config.SetEngineConfigUseBlasThreshold(std::to_string(engine_use_blas_threshold)).ok());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册