Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hycdong committed May 25, 2020
1 parent 345ec06 commit 78fcca1
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/dist/replication/lib/replica_file_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,19 @@ error_code replica::do_download(const std::string &remote_dir,
if (utils::filesystem::file_exists(local_file_name)) {
std::string current_md5;
error_code e = utils::filesystem::md5sum(local_file_name, current_md5);
if (e != ERR_OK) {
dwarn_replica("calculate file({}) md5 failed, should remove and redownload it",
local_file_name);
if (!utils::filesystem::remove_path(local_file_name)) {
derror_replica("failed to remove file({})", local_file_name);
download_err = e;
return;
if (e != ERR_OK || current_md5 != bf->get_md5sum()) {
if (e != ERR_OK) {
dwarn_replica("calculate file({}) md5 failed, should remove and redownload it",
local_file_name);
} else {
dwarn_replica(
"local file({}) is different from remote file({}), md5: local({}) VS "
"remote({}), should remove and redownload it",
local_file_name,
bf->file_name(),
current_md5,
bf->get_md5sum());
}
} else if (current_md5 != bf->get_md5sum()) {
dwarn_replica("local file({}) is not same with remote file({}), md5: local({}) VS "
"remote({}), should remove and redownload it",
local_file_name,
bf->file_name(),
current_md5,
bf->get_md5sum());
if (!utils::filesystem::remove_path(local_file_name)) {
derror_replica("failed to remove file({})", local_file_name);
download_err = e;
Expand Down

0 comments on commit 78fcca1

Please sign in to comment.