This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.1 by this push:
new 5b1e21449d1 branch-4.1: [chore](cloud) process_unknown add warning log
and improve msg #61695 (#62011)
5b1e21449d1 is described below
commit 5b1e21449d1562d09ec63efdeafc71ee8dd7ac2e
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Apr 3 22:19:02 2026 +0800
branch-4.1: [chore](cloud) process_unknown add warning log and improve msg
#61695 (#62011)
Cherry-picked from #61695
Co-authored-by: walter <[email protected]>
---
cloud/src/meta-service/meta_service_http.cpp | 14 +++++++++++---
cloud/test/meta_service_http_test.cpp | 2 +-
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/cloud/src/meta-service/meta_service_http.cpp
b/cloud/src/meta-service/meta_service_http.cpp
index 888a5b7a731..78c608a6dc4 100644
--- a/cloud/src/meta-service/meta_service_http.cpp
+++ b/cloud/src/meta-service/meta_service_http.cpp
@@ -134,7 +134,7 @@ HttpResponse http_json_reply(MetaServiceCode code, const
std::string& msg,
d.SetObject();
if (code == MetaServiceCode::OK) {
d.AddMember("code", "OK", d.GetAllocator());
- d.AddMember("msg", "", d.GetAllocator());
+ d.AddMember("msg", rapidjson::StringRef(msg.data(), msg.size()),
d.GetAllocator());
} else {
d.AddMember("code", rapidjson::StringRef(status_msg.data(),
status_msg.size()),
d.GetAllocator());
@@ -721,9 +721,17 @@ static HttpResponse
process_txn_lazy_commit(MetaServiceImpl* service, brpc::Cont
return http_json_reply(code, msg);
}
-static HttpResponse process_unknown(MetaServiceImpl*, brpc::Controller*) {
+static HttpResponse process_unknown(MetaServiceImpl*, brpc::Controller* cntl) {
// ATTN: To be compatible with cloud manager versions higher than this MS
- return http_json_reply(MetaServiceCode::OK, "");
+ const auto& uri = cntl->http_request().uri();
+ std::string query_params;
+ for (auto it = uri.QueryBegin(); it != uri.QueryEnd(); ++it) {
+ if (!query_params.empty()) query_params += "&";
+ query_params += it->first + "=" + it->second;
+ }
+ LOG(WARNING) << "unknown http request path=" << uri.path() << "
query_params=[" << query_params
+ << "]";
+ return http_json_reply(MetaServiceCode::OK, "no handler found for path: "
+ uri.path());
}
static HttpResponse process_list_snapshot(MetaServiceImpl* service,
brpc::Controller* ctrl) {
diff --git a/cloud/test/meta_service_http_test.cpp
b/cloud/test/meta_service_http_test.cpp
index abf791649de..52fc38921f3 100644
--- a/cloud/test/meta_service_http_test.cpp
+++ b/cloud/test/meta_service_http_test.cpp
@@ -1398,7 +1398,7 @@ TEST(MetaServiceHttpTest, ToUnknownUrlTest) {
HttpContext ctx;
auto [status_code, content] =
ctx.query<std::string>("unkown_resource_xxxxxx", "");
ASSERT_EQ(status_code, 200);
- ASSERT_EQ(content, "{\n \"code\": \"OK\",\n \"msg\": \"\"\n}\n");
+ ASSERT_NE(content.find("\"code\": \"OK\""), std::string::npos);
}
TEST(MetaServiceHttpTest, UnknownFields) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]