Skip to content

Commit

Permalink
fix(Bulkload) follow clang-tidy advice
Browse files Browse the repository at this point in the history
  • Loading branch information
lupengfan1 committed Aug 21, 2024
1 parent d040484 commit 99100fd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
42 changes: 20 additions & 22 deletions src/replica/bulk_load/replica_bulk_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
// under the License.

#include <fmt/core.h>
#include <algorithm>
#include <functional>
#include <iterator>
#include <memory>
#include <string_view>
#include <unordered_map>
#include <utility>
#include <vector>

#include <string_view>
#include "block_service/block_service_manager.h"
#include "common/bulk_load_common.h"
#include "common/gpid.h"
Expand Down Expand Up @@ -474,12 +476,11 @@ error_code replica_bulk_loader::start_download(const std::string &remote_dir,

// start download
_is_downloading.store(true);
_download_task =
tasking::enqueue(LPC_BACKGROUND_BULK_LOAD,
tracker(),
[this, remote_dir, local_dir, download_file_metas, fs] {
download_sst_file(remote_dir, local_dir, download_file_metas, fs);
});
_download_task = tasking::enqueue(
LPC_BACKGROUND_BULK_LOAD,
tracker(),
std::bind(
&replica_bulk_loader::download_files, this, provider_name, remote_dir, local_dir));
return ERR_OK;
}

Expand Down Expand Up @@ -528,15 +529,12 @@ void replica_bulk_loader::download_files(const std::string &provider_name,
std::back_inserter(download_file_metas));
}
if (!download_file_metas.empty()) {
_download_files_task[download_file_metas.back().name] =
tasking::enqueue(LPC_BACKGROUND_BULK_LOAD,
tracker(),
std::bind(&replica_bulk_loader::download_sst_file,
this,
remote_dir,
local_dir,
download_file_metas,
fs));
_download_files_task[download_file_metas.back().name] = tasking::enqueue(
LPC_BACKGROUND_BULK_LOAD,
tracker(),
[this, remote_dir, local_dir, download_file_metas, fs]() mutable {
this->download_sst_file(remote_dir, local_dir, download_file_metas, fs);
});
}
}

Expand Down Expand Up @@ -610,12 +608,12 @@ void replica_bulk_loader::download_sst_file(

// download next file
if (!download_file_metas.empty()) {
_download_files_task[download_file_metas.back().name] =
tasking::enqueue(LPC_BACKGROUND_BULK_LOAD,
tracker(),
[this, remote_dir, local_dir, download_file_metas, fs] {
download_sst_file(remote_dir, local_dir, download_file_metas, fs);
});
_download_files_task[download_file_metas.back().name] = tasking::enqueue(
LPC_BACKGROUND_BULK_LOAD,
tracker(),
[this, remote_dir, local_dir, download_file_metas, fs]() mutable {
this->download_sst_file(remote_dir, local_dir, download_file_metas, fs);
});
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/replica/bulk_load/replica_bulk_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <map>
#include <ostream>
#include <string>
#include <vector>

#include "bulk_load_types.h"
#include "common/replication_other_types.h"
Expand All @@ -36,6 +37,7 @@

namespace dsn {
class task_tracker;

namespace dist {
namespace block_service {
class block_filesystem;
Expand Down

0 comments on commit 99100fd

Please sign in to comment.