Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions be/src/http/action/snapshot_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down