diff --git a/be/src/storage/replication_utils.cpp b/be/src/storage/replication_utils.cpp index 95fe92d7fbaea..011ac8d0e8c77 100644 --- a/be/src/storage/replication_utils.cpp +++ b/be/src/storage/replication_utils.cpp @@ -30,6 +30,7 @@ #include "http/http_client.h" #include "runtime/client_cache.h" #include "service/backend_options.h" +#include "util/network_util.h" #include "util/string_parser.hpp" #include "util/thrift_rpc_helper.h" @@ -247,9 +248,9 @@ Status ReplicationUtils::download_remote_snapshot( return Status::OK(); #else - std::string remote_url_prefix = - strings::Substitute("http://$0:$1$2?token=$3&type=V2&file=$4/$5/$6/", host, http_port, HTTP_REQUEST_PREFIX, - remote_token, remote_snapshot_path, remote_tablet_id, remote_schema_hash); + std::string remote_url_prefix = strings::Substitute( + "http://$0$1?token=$2&type=V2&file=$3/$4/$5/", get_host_port(host, http_port), HTTP_REQUEST_PREFIX, + remote_token, remote_snapshot_path, remote_tablet_id, remote_schema_hash); std::vector file_name_list; std::vector file_size_list; @@ -286,7 +287,7 @@ Status ReplicationUtils::download_remote_snapshot( estimate_timeout_sec = config::replication_min_speed_time_seconds; } - VLOG(2) << "Downloading " << remote_file_url << ", bytes: " << file_size + VLOG(2) << "Downloading " << remote_file_name << ", bytes: " << file_size << ", timeout: " << estimate_timeout_sec << "s"; RETURN_IF_ERROR(download_remote_file(remote_file_url, estimate_timeout_sec, @@ -322,8 +323,8 @@ StatusOr ReplicationUtils::download_remote_snapshot_file( #else std::string remote_file_url = strings::Substitute( - "http://$0:$1$2?token=$3&type=V2&file=$4/$5/$6/$7", host, http_port, HTTP_REQUEST_PREFIX, remote_token, - remote_snapshot_path, remote_tablet_id, remote_schema_hash, file_name); + "http://$0$1?token=$2&type=V2&file=$3/$4/$5/$6", get_host_port(host, http_port), HTTP_REQUEST_PREFIX, + remote_token, remote_snapshot_path, remote_tablet_id, remote_schema_hash, file_name); std::string file_content; file_content.reserve(4 * 1024 * 1024); diff --git a/be/src/storage/task/engine_clone_task.cpp b/be/src/storage/task/engine_clone_task.cpp index 3c7166b64bb2d..d37bdd676e3af 100644 --- a/be/src/storage/task/engine_clone_task.cpp +++ b/be/src/storage/task/engine_clone_task.cpp @@ -413,8 +413,9 @@ Status EngineCloneTask::_clone_copy(DataDir& data_dir, const string& local_data_ st = _download_files(&data_dir, download_url, local_path); (void)_release_snapshot(src.host, src.be_port, snapshot_path); if (!st.ok()) { - LOG(WARNING) << "Fail to download snapshot from " << download_url << ": " << st.to_string() - << " tablet:" << _clone_req.tablet_id; + LOG(WARNING) << "Fail to download snapshot " << snapshot_path << " from " + << get_host_port(src.host, src.http_port) << ", status: " << st + << ", tablet_id:" << _clone_req.tablet_id << ", schema_hash:" << _clone_req.schema_hash; error_msgs->push_back("download snapshot failed. backend_ip: " + src.host); continue; } @@ -433,7 +434,8 @@ Status EngineCloneTask::_clone_copy(DataDir& data_dir, const string& local_data_ error_msgs->push_back("convert rowset id failed. backend_ip: " + src.host); continue; } - LOG(INFO) << "Cloned snapshot from " << download_url << " to " << local_data_path; + LOG(INFO) << "Cloned snapshot " << snapshot_path << " from " << get_host_port(src.host, src.http_port) << " to " + << local_data_path; break; } return st; @@ -616,7 +618,7 @@ Status EngineCloneTask::_download_files(DataDir* data_dir, const std::string& re std::string local_file_path = local_path + file_name; - VLOG(2) << "Downloading " << remote_file_url << " to " << local_path << ". bytes=" << file_size + VLOG(2) << "Downloading " << file_name << " to " << local_path << ". bytes=" << file_size << " timeout=" << estimate_timeout; auto download_cb = [&remote_file_url, estimate_timeout, &local_file_path, file_size](HttpClient* client) { @@ -627,8 +629,8 @@ Status EngineCloneTask::_download_files(DataDir* data_dir, const std::string& re // Check file length uint64_t local_file_size = std::filesystem::file_size(local_file_path); if (local_file_size != file_size) { - LOG(WARNING) << "Fail to download " << remote_file_url << ". file_size=" << local_file_size << "/" - << file_size; + LOG(WARNING) << "Mismatched file size, downloaded file: " << local_file_path + << ", file_size: " << local_file_size << "/" << file_size; return Status::InternalError("mismatched file size"); } chmod(local_file_path.c_str(), S_IRUSR | S_IWUSR);