This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 012620c7d4f [Fix](ms) Fix ci-uncaught ut coredump due to dynamic rate
limit setting (#44362)
012620c7d4f is described below
commit 012620c7d4faf75ed4b1c6833d1227867dea4c95
Author: Siyang Tang <[email protected]>
AuthorDate: Thu Nov 21 11:24:01 2024 +0800
[Fix](ms) Fix ci-uncaught ut coredump due to dynamic rate limit setting
(#44362)
UT failed with coredump in PR #42413 but was not detected by CI. Fix the
problem.
---
cloud/script/run_all_tests.sh | 2 ++
cloud/src/meta-service/meta_service_http.cpp | 14 +++++++-------
run-cloud-ut.sh | 1 +
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/cloud/script/run_all_tests.sh b/cloud/script/run_all_tests.sh
index eaddd4ff78f..330fb004493 100644
--- a/cloud/script/run_all_tests.sh
+++ b/cloud/script/run_all_tests.sh
@@ -143,11 +143,13 @@ for i in *_test; do
patchelf --set-rpath "$(pwd)" "${i}"
fi
+ set -euo pipefail
if [[ "${filter}" == "" ]]; then
LLVM_PROFILE_FILE="./report/${i}.profraw" "./${i}"
--gtest_print_time=true --gtest_output="xml:${i}.xml"
else
LLVM_PROFILE_FILE="./report/${i}.profraw" "./${i}"
--gtest_print_time=true --gtest_output="xml:${i}.xml" --gtest_filter="${filter}"
fi
+ set +euo pipefail
unittest_files[${#unittest_files[*]}]="${i}"
echo "--------------------------"
fi
diff --git a/cloud/src/meta-service/meta_service_http.cpp
b/cloud/src/meta-service/meta_service_http.cpp
index 2f7536e9989..e919c6f365e 100644
--- a/cloud/src/meta-service/meta_service_http.cpp
+++ b/cloud/src/meta-service/meta_service_http.cpp
@@ -411,8 +411,8 @@ static HttpResponse
process_adjust_rate_limit(MetaServiceImpl* service, brpc::Co
processors[0b101] = std::move(set_instance_qps_limit);
processors[0b111] = std::move(set_instance_rpc_qps_limit);
- uint8_t level = (0x01 & qps_limit_str.empty()) | ((0x01 &
rpc_name.empty()) << 1) |
- ((0x01 & instance_id.empty()) << 2);
+ uint8_t level = (0x01 & !qps_limit_str.empty()) | ((0x01 &
!rpc_name.empty()) << 1) |
+ ((0x01 & !instance_id.empty()) << 2);
DCHECK_LT(level, 8);
@@ -422,10 +422,13 @@ static HttpResponse
process_adjust_rate_limit(MetaServiceImpl* service, brpc::Co
static HttpResponse process_query_rate_limit(MetaServiceImpl* service,
brpc::Controller* cntl) {
auto rate_limiter = service->rate_limiter();
rapidjson::Document d;
+ d.SetObject();
auto get_qps_limit = [&d](std::string_view rpc_name,
std::shared_ptr<RpcRateLimiter> rpc_limiter) {
rapidjson::Document node;
+ node.SetObject();
rapidjson::Document sub;
+ sub.SetObject();
auto get_qps_token_limit = [&](std::string_view instance_id,
std::shared_ptr<RpcRateLimiter::QpsToken> qps_token) {
sub.AddMember(rapidjson::StringRef(instance_id.data(),
instance_id.size()),
@@ -433,10 +436,7 @@ static HttpResponse
process_query_rate_limit(MetaServiceImpl* service, brpc::Con
};
rpc_limiter->for_each_qps_token(std::move(get_qps_token_limit));
- auto max_qps_limit = std::to_string(rpc_limiter->max_qps_limit());
- node.AddMember("RPC qps limit",
- rapidjson::StringRef(max_qps_limit.data(),
max_qps_limit.size()),
- d.GetAllocator());
+ node.AddMember("RPC qps limit", rpc_limiter->max_qps_limit(),
d.GetAllocator());
node.AddMember("instance specific qps limit", sub, d.GetAllocator());
d.AddMember(rapidjson::StringRef(rpc_name.data(), rpc_name.size()),
node, d.GetAllocator());
};
@@ -445,7 +445,7 @@ static HttpResponse
process_query_rate_limit(MetaServiceImpl* service, brpc::Con
rapidjson::StringBuffer sb;
rapidjson::PrettyWriter<rapidjson::StringBuffer> writer(sb);
d.Accept(writer);
- return http_json_reply(MetaServiceCode::OK, sb.GetString());
+ return http_json_reply(MetaServiceCode::OK, "", sb.GetString());
}
static HttpResponse process_decode_key(MetaServiceImpl*, brpc::Controller*
ctrl) {
diff --git a/run-cloud-ut.sh b/run-cloud-ut.sh
index 16473b1a2a8..c74eee7b5f3 100755
--- a/run-cloud-ut.sh
+++ b/run-cloud-ut.sh
@@ -228,6 +228,7 @@ cd test
# FILTER: binary_name:gtest_filter
# FILTER: meta_service_test:DetachSchemaKVTest.*
# ./run_all_tests.sh --test "\"$(echo "${FILTER}" | awk -F: '{print $1}')\""
--filter "\"$(echo "${FILTER}" | awk -F: '{print $2}')\"" --fdb "\"${FDB}\""
+set -euo pipefail
if [[ "_${ENABLE_CLANG_COVERAGE}" == "_ON" ]]; then
bash -x ./run_all_tests.sh --coverage --test "$(echo "${FILTER}" | awk -F:
'{print $1}')" --filter "$(echo "${FILTER}" | awk -F: '{print $2}')" --fdb
"${FDB}"
else
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]