This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 935d0eb1101 [cherry-pick](branch-2.1) [Bug](http-api) fix core dump on
API check_rpc_channel coz exec_env not initialized #39519 (#39692)
935d0eb1101 is described below
commit 935d0eb1101b16a8dbaced93e7e809f377563b28
Author: Vallish Pai <[email protected]>
AuthorDate: Wed Aug 21 22:12:12 2024 +0530
[cherry-pick](branch-2.1) [Bug](http-api) fix core dump on API
check_rpc_channel coz exec_env not initialized #39519 (#39692)
…rpc_channel coz exec_env not initialized #39519
## Proposed changes
Issue Number: close #xxx
backport #39519 #39520
---
be/src/http/action/check_rpc_channel_action.cpp | 1 +
be/src/http/action/check_rpc_channel_action.h | 3 ---
be/src/http/action/reset_rpc_channel_action.cpp | 3 ++-
be/src/http/action/reset_rpc_channel_action.h | 3 ---
be/src/http/http_handler_with_auth.h | 4 ++-
.../org/apache/doris/regression/suite/Suite.groovy | 13 +++++++++
.../check_rpc_channel/check_rpc_channel.groovy | 31 ++++++++--------------
7 files changed, 30 insertions(+), 28 deletions(-)
diff --git a/be/src/http/action/check_rpc_channel_action.cpp
b/be/src/http/action/check_rpc_channel_action.cpp
index 4949b21b8f5..7b98db510e5 100644
--- a/be/src/http/action/check_rpc_channel_action.cpp
+++ b/be/src/http/action/check_rpc_channel_action.cpp
@@ -39,6 +39,7 @@ namespace doris {
CheckRPCChannelAction::CheckRPCChannelAction(ExecEnv* exec_env,
TPrivilegeHier::type hier,
TPrivilegeType::type type)
: HttpHandlerWithAuth(exec_env, hier, type) {}
+
void CheckRPCChannelAction::handle(HttpRequest* req) {
std::string req_ip = req->param("ip");
std::string req_port = req->param("port");
diff --git a/be/src/http/action/check_rpc_channel_action.h
b/be/src/http/action/check_rpc_channel_action.h
index 883180f02df..07969c80f08 100644
--- a/be/src/http/action/check_rpc_channel_action.h
+++ b/be/src/http/action/check_rpc_channel_action.h
@@ -31,8 +31,5 @@ public:
~CheckRPCChannelAction() override = default;
void handle(HttpRequest* req) override;
-
-private:
- ExecEnv* _exec_env;
};
} // namespace doris
diff --git a/be/src/http/action/reset_rpc_channel_action.cpp
b/be/src/http/action/reset_rpc_channel_action.cpp
index b14c0f65e7f..a9aa6ec950e 100644
--- a/be/src/http/action/reset_rpc_channel_action.cpp
+++ b/be/src/http/action/reset_rpc_channel_action.cpp
@@ -34,7 +34,8 @@
namespace doris {
ResetRPCChannelAction::ResetRPCChannelAction(ExecEnv* exec_env,
TPrivilegeHier::type hier,
TPrivilegeType::type type)
- : HttpHandlerWithAuth(exec_env, hier, type), _exec_env(exec_env) {}
+ : HttpHandlerWithAuth(exec_env, hier, type) {}
+
void ResetRPCChannelAction::handle(HttpRequest* req) {
std::string endpoints = req->param("endpoints");
if (iequal(endpoints, "all")) {
diff --git a/be/src/http/action/reset_rpc_channel_action.h
b/be/src/http/action/reset_rpc_channel_action.h
index 16efecfee26..ba13c6be7c6 100644
--- a/be/src/http/action/reset_rpc_channel_action.h
+++ b/be/src/http/action/reset_rpc_channel_action.h
@@ -31,8 +31,5 @@ public:
~ResetRPCChannelAction() override = default;
void handle(HttpRequest* req) override;
-
-private:
- ExecEnv* _exec_env;
};
} // namespace doris
diff --git a/be/src/http/http_handler_with_auth.h
b/be/src/http/http_handler_with_auth.h
index 178971560c0..894a3a81e50 100644
--- a/be/src/http/http_handler_with_auth.h
+++ b/be/src/http/http_handler_with_auth.h
@@ -51,8 +51,10 @@ public:
return true;
}
-private:
+protected:
ExecEnv* _exec_env;
+
+private:
TPrivilegeHier::type _hier;
TPrivilegeType::type _type;
};
diff --git
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
index edf6564fbba..40ac53f9357 100644
---
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
+++
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
@@ -836,6 +836,19 @@ class Suite implements GroovyInterceptable {
return;
}
+ void getBackendIpHttpAndBrpcPort(Map<String, String>
backendId_to_backendIP,
+ Map<String, String> backendId_to_backendHttpPort, Map<String, String>
backendId_to_backendBrpcPort) {
+
+ List<List<Object>> backends = sql("show backends");
+ for (List<Object> backend : backends) {
+ backendId_to_backendIP.put(String.valueOf(backend[0]),
String.valueOf(backend[1]));
+ backendId_to_backendHttpPort.put(String.valueOf(backend[0]),
String.valueOf(backend[4]));
+ backendId_to_backendBrpcPort.put(String.valueOf(backend[0]),
String.valueOf(backend[5]));
+ }
+ return;
+ }
+
+
int getTotalLine(String filePath) {
def file = new File(filePath)
int lines = 0;
diff --git a/be/src/http/action/check_rpc_channel_action.h
b/regression-test/suites/http_p0/check_rpc_channel/check_rpc_channel.groovy
similarity index 55%
copy from be/src/http/action/check_rpc_channel_action.h
copy to
regression-test/suites/http_p0/check_rpc_channel/check_rpc_channel.groovy
index 883180f02df..d79f71dac5c 100644
--- a/be/src/http/action/check_rpc_channel_action.h
+++ b/regression-test/suites/http_p0/check_rpc_channel/check_rpc_channel.groovy
@@ -1,3 +1,4 @@
+
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
@@ -15,24 +16,14 @@
// specific language governing permissions and limitations
// under the License.
-#pragma once
-
-#include "http/http_handler_with_auth.h"
-
-namespace doris {
-class ExecEnv;
-class HttpRequest;
-
-class CheckRPCChannelAction : public HttpHandlerWithAuth {
-public:
- explicit CheckRPCChannelAction(ExecEnv* exec_env, TPrivilegeHier::type
hier,
- TPrivilegeType::type type);
-
- ~CheckRPCChannelAction() override = default;
-
- void handle(HttpRequest* req) override;
+suite('check_rpc_channel') {
+ def backendId_to_backendIP = [:]
+ def backendId_to_backendHttpPort = [:]
+ def backendId_to_backendBrpcPort = [:]
-private:
- ExecEnv* _exec_env;
-};
-} // namespace doris
+ getBackendIpHttpAndBrpcPort(backendId_to_backendIP,
backendId_to_backendHttpPort, backendId_to_backendBrpcPort);
+ for (int i=0;i<backendId_to_backendIP.size();i++){
+ def beHttpAddress
=backendId_to_backendIP.entrySet()[i].getValue()+":"+backendId_to_backendHttpPort.entrySet()[i].getValue()
+
curl("POST",beHttpAddress+"/api/check_rpc_channel/"+backendId_to_backendIP.entrySet()[i].getValue()+"/"+backendId_to_backendBrpcPort.entrySet()[i].getValue()+"/1024000")
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]