Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Remove sensitive messages in be log (backport #54677) #54707

Merged
merged 1 commit into from
Jan 6, 2025
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
13 changes: 7 additions & 6 deletions be/src/storage/replication_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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<string> file_name_list;
std::vector<int64_t> file_size_list;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -322,8 +323,8 @@ StatusOr<std::string> 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);
Expand Down
14 changes: 8 additions & 6 deletions be/src/storage/task/engine_clone_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
Loading