xiaokang commented on code in PR #29537:
URL: https://github.com/apache/doris/pull/29537#discussion_r1443600889
##########
be/src/olap/options.cpp:
##########
@@ -235,7 +238,38 @@ Status parse_conf_cache_paths(const std::string&
config_path, std::vector<CacheP
return Status::InvalidArgument(
"total_size or query_limit should not less than or equal
to zero");
}
- paths.emplace_back(std::move(path), total_size, query_limit_bytes);
+
+ // percent
+ auto get_percent_value = [&](const std::string& key, size_t& percent) {
+ auto& value = map.FindMember(key.c_str())->value;
+ if (value.IsUint()) {
+ percent = value.GetUint();
+ } else {
+ return Status::InvalidArgument("percent should be uint");
+ }
+ return Status::OK();
+ };
+
+ size_t normal_percent = 85;
+ size_t disposable_percent = 10;
+ size_t index_percent = 5;
+ bool has_normal_percent = map.HasMember(CACHE_NORMAL_PERCENT.c_str());
+ bool has_disposable_percent =
map.HasMember(CACHE_DISPOSABLE_PERCENT.c_str());
+ bool has_index_percent = map.HasMember(CACHE_INDEX_PERCENT.c_str());
+ if (has_normal_percent && has_disposable_percent && has_index_percent)
{
+ RETURN_IF_ERROR(get_percent_value(CACHE_NORMAL_PERCENT,
normal_percent));
+ RETURN_IF_ERROR(get_percent_value(CACHE_DISPOSABLE_PERCENT,
disposable_percent));
+ RETURN_IF_ERROR(get_percent_value(CACHE_INDEX_PERCENT,
index_percent));
+ } else if (has_normal_percent || has_disposable_percent ||
has_index_percent) {
+ return Status::InvalidArgument(
+ "percent configurations must either be all set or all
unset.");
+ }
+ if ((normal_percent + disposable_percent + index_percent) != 100) {
+ return Status::InvalidArgument("the sum is not equal to 100.");
Review Comment:
sum of cache percent config
##########
be/src/olap/options.cpp:
##########
@@ -235,7 +238,38 @@ Status parse_conf_cache_paths(const std::string&
config_path, std::vector<CacheP
return Status::InvalidArgument(
"total_size or query_limit should not less than or equal
to zero");
}
- paths.emplace_back(std::move(path), total_size, query_limit_bytes);
+
+ // percent
+ auto get_percent_value = [&](const std::string& key, size_t& percent) {
+ auto& value = map.FindMember(key.c_str())->value;
+ if (value.IsUint()) {
+ percent = value.GetUint();
+ } else {
+ return Status::InvalidArgument("percent should be uint");
+ }
+ return Status::OK();
+ };
+
+ size_t normal_percent = 85;
+ size_t disposable_percent = 10;
+ size_t index_percent = 5;
+ bool has_normal_percent = map.HasMember(CACHE_NORMAL_PERCENT.c_str());
+ bool has_disposable_percent =
map.HasMember(CACHE_DISPOSABLE_PERCENT.c_str());
+ bool has_index_percent = map.HasMember(CACHE_INDEX_PERCENT.c_str());
+ if (has_normal_percent && has_disposable_percent && has_index_percent)
{
+ RETURN_IF_ERROR(get_percent_value(CACHE_NORMAL_PERCENT,
normal_percent));
+ RETURN_IF_ERROR(get_percent_value(CACHE_DISPOSABLE_PERCENT,
disposable_percent));
+ RETURN_IF_ERROR(get_percent_value(CACHE_INDEX_PERCENT,
index_percent));
+ } else if (has_normal_percent || has_disposable_percent ||
has_index_percent) {
+ return Status::InvalidArgument(
+ "percent configurations must either be all set or all
unset.");
Review Comment:
cache percent config
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]