Skip to content

Commit

Permalink
fix(bulkload) fix unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
lupengfan1 committed Sep 24, 2024
1 parent 020b105 commit 46d15af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions src/replica/bulk_load/replica_bulk_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,8 @@ void replica_bulk_loader::download_files(const std::string &provider_name,
}
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]() mutable {
this->download_sst_file(remote_dir, local_dir, download_file_metas, fs);
LPC_BACKGROUND_BULK_LOAD, tracker(), [=, file_metas = download_file_metas]() mutable {
this->download_sst_file(remote_dir, local_dir, std::move(file_metas), fs);
});
}
}
Expand All @@ -542,7 +540,7 @@ void replica_bulk_loader::download_files(const std::string &provider_name,
void replica_bulk_loader::download_sst_file(
const std::string &remote_dir,
const std::string &local_dir,
std::vector<::dsn::replication::file_meta> &download_file_metas,
std::vector<::dsn::replication::file_meta> &&download_file_metas,
dist::block_service::block_filesystem *fs)
{
if (_status != bulk_load_status::BLS_DOWNLOADING) {
Expand Down Expand Up @@ -609,10 +607,8 @@ 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]() mutable {
this->download_sst_file(remote_dir, local_dir, download_file_metas, fs);
LPC_BACKGROUND_BULK_LOAD, tracker(), [=, file_metas = download_file_metas]() mutable {
this->download_sst_file(remote_dir, local_dir, std::move(file_metas), fs);
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/replica/bulk_load/replica_bulk_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class replica_bulk_loader : replica_base
// download sst files from remote provider
void download_sst_file(const std::string &remote_dir,
const std::string &local_dir,
std::vector<::dsn::replication::file_meta> &download_file_metas,
std::vector<::dsn::replication::file_meta> &&download_file_metas,
dist::block_service::block_filesystem *fs);

// \return ERR_PATH_NOT_FOUND: file not exist
Expand Down

0 comments on commit 46d15af

Please sign in to comment.