Skip to content

Commit

Permalink
Add config to control whether to download in batch
Browse files Browse the repository at this point in the history
  • Loading branch information
w41ter committed Dec 9, 2024
1 parent c4c37cf commit c9d5081
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ DEFINE_mInt32(max_download_speed_kbps, "50000");
DEFINE_mInt32(download_low_speed_limit_kbps, "50");
// download low speed time(seconds)
DEFINE_mInt32(download_low_speed_time, "300");
// whether to download small files in batch
DEFINE_mBool(enable_batch_download, "false");

DEFINE_String(sys_log_dir, "");
DEFINE_String(user_function_dir, "${DORIS_HOME}/lib/udf");
Expand Down
2 changes: 2 additions & 0 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ DECLARE_mInt32(max_download_speed_kbps);
DECLARE_mInt32(download_low_speed_limit_kbps);
// download low speed time(seconds)
DECLARE_mInt32(download_low_speed_time);
// whether to download small files in batch.
DECLARE_mBool(enable_batch_download);

// deprecated, use env var LOG_DIR in be.conf
DECLARE_String(sys_log_dir);
Expand Down
14 changes: 10 additions & 4 deletions be/src/olap/task/engine_clone_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ Status EngineCloneTask::_make_and_download_snapshots(DataDir& data_dir,
}

std::string address = get_host_port(src.host, src.http_port);
if (is_support_batch_download(address).ok()) {
if (config::enable_batch_download && is_support_batch_download(address).ok()) {
// download files via batch api.
LOG_INFO("remote BE supports batch download, use batch file download")
.tag("address", address)
Expand All @@ -429,9 +429,15 @@ Status EngineCloneTask::_make_and_download_snapshots(DataDir& data_dir,
continue; // Try another BE
}
} else {
LOG_INFO("remote BE does not support batch download, use single file download")
.tag("address", address)
.tag("remote_dir", remote_dir);
if (config::enable_batch_download) {
LOG_INFO("remote BE does not support batch download, use single file download")
.tag("address", address)
.tag("remote_dir", remote_dir);
} else {
LOG_INFO("batch download is disabled, use single file download")
.tag("address", address)
.tag("remote_dir", remote_dir);
}

std::string remote_url_prefix;
{
Expand Down

0 comments on commit c9d5081

Please sign in to comment.