You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by kx...@apache.org on 2023/11/29 13:00:54 UTC

(doris) branch branch-2.0 updated: [refactor](http) disable snapshot and get_log_file api (#27724) (#27770)

This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 72aaca24c99 [refactor](http) disable snapshot and get_log_file api (#27724) (#27770)
72aaca24c99 is described below

commit 72aaca24c9935d0bfd7116cce9d284b01ba65d6a
Author: Mingyu Chen <mo...@163.com>
AuthorDate: Wed Nov 29 21:00:46 2023 +0800

    [refactor](http) disable snapshot and get_log_file api (#27724) (#27770)
---
 be/src/common/config.cpp                                              | 2 ++
 be/src/common/config.h                                                | 3 +++
 be/src/http/action/snapshot_action.cpp                                | 4 ++++
 fe/fe-common/src/main/java/org/apache/doris/common/Config.java        | 4 ++++
 .../src/main/java/org/apache/doris/httpv2/rest/GetLogFileAction.java  | 3 +++
 5 files changed, 16 insertions(+)

diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp
index c6ff22c6264..b83794795e8 100644
--- a/be/src/common/config.cpp
+++ b/be/src/common/config.cpp
@@ -1103,6 +1103,8 @@ DEFINE_Int32(ingest_binlog_work_pool_size, "-1");
 // Download binlog rate limit, unit is KB/s, 0 means no limit
 DEFINE_Int32(download_binlog_rate_limit_kbs, "0");
 
+DEFINE_Bool(enable_snapshot_action, "false");
+
 // clang-format off
 #ifdef BE_TEST
 // test s3
diff --git a/be/src/common/config.h b/be/src/common/config.h
index f621b442568..602fdff53f0 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -1159,6 +1159,9 @@ DECLARE_Int32(ingest_binlog_work_pool_size);
 // Download binlog rate limit, unit is KB/s
 DECLARE_Int32(download_binlog_rate_limit_kbs);
 
+// whether to enable /api/snapshot api
+DECLARE_Bool(enable_snapshot_action);
+
 #ifdef BE_TEST
 // test s3
 DECLARE_String(test_s3_resource);
diff --git a/be/src/http/action/snapshot_action.cpp b/be/src/http/action/snapshot_action.cpp
index c705d3c9bac..c93220ac0f8 100644
--- a/be/src/http/action/snapshot_action.cpp
+++ b/be/src/http/action/snapshot_action.cpp
@@ -41,6 +41,10 @@ SnapshotAction::SnapshotAction(ExecEnv* exec_env, TPrivilegeHier::type hier,
         : HttpHandlerWithAuth(exec_env, hier, type) {}
 
 void SnapshotAction::handle(HttpRequest* req) {
+    if (!config::enable_snapshot_action) {
+        HttpChannel::send_reply(req, HttpStatus::BAD_REQUEST, "feature disabled");
+        return;
+    }
     LOG(INFO) << "accept one request " << req->debug_string();
     // Get tablet id
     const std::string& tablet_id_str = req->param(TABLET_ID);
diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
index 92fa8130757..d02ea3a8e07 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
@@ -2227,4 +2227,8 @@ public class Config extends ConfigBase {
             "the max package size fe thrift server can receive,avoid accepting error"
             + "or too large package causing OOM,default 20000000(20M),set -1 for unlimited. "})
     public static int fe_thrift_max_pkg_bytes = 20000000;
+
+    @ConfField(description = {"是否开启通过http接口获取log文件的功能",
+            "Whether to enable the function of getting log files through http interface"})
+    public static boolean enable_get_log_file_api = false;
 }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/GetLogFileAction.java b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/GetLogFileAction.java
index c96e19971b1..475ee5ace1e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/GetLogFileAction.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/GetLogFileAction.java
@@ -55,6 +55,9 @@ public class GetLogFileAction extends RestBaseController {
 
     @RequestMapping(path = "/api/get_log_file", method = {RequestMethod.GET, RequestMethod.HEAD})
     public Object execute(HttpServletRequest request, HttpServletResponse response) {
+        if (!Config.enable_get_log_file_api) {
+            return ResponseEntityBuilder.badRequest("feature disabled");
+        }
         executeCheckPassword(request, response);
         checkGlobalAuth(ConnectContext.get().getCurrentUserIdentity(), PrivPredicate.ADMIN);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org