Skip to content

Commit 46d15af

Browse files
author
lupengfan1
committed
fix(bulkload) fix unit test.
1 parent 020b105 commit 46d15af

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/replica/bulk_load/replica_bulk_loader.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -530,10 +530,8 @@ void replica_bulk_loader::download_files(const std::string &provider_name,
530530
}
531531
if (!download_file_metas.empty()) {
532532
_download_files_task[download_file_metas.back().name] = tasking::enqueue(
533-
LPC_BACKGROUND_BULK_LOAD,
534-
tracker(),
535-
[this, remote_dir, local_dir, download_file_metas, fs]() mutable {
536-
this->download_sst_file(remote_dir, local_dir, download_file_metas, fs);
533+
LPC_BACKGROUND_BULK_LOAD, tracker(), [=, file_metas = download_file_metas]() mutable {
534+
this->download_sst_file(remote_dir, local_dir, std::move(file_metas), fs);
537535
});
538536
}
539537
}
@@ -542,7 +540,7 @@ void replica_bulk_loader::download_files(const std::string &provider_name,
542540
void replica_bulk_loader::download_sst_file(
543541
const std::string &remote_dir,
544542
const std::string &local_dir,
545-
std::vector<::dsn::replication::file_meta> &download_file_metas,
543+
std::vector<::dsn::replication::file_meta> &&download_file_metas,
546544
dist::block_service::block_filesystem *fs)
547545
{
548546
if (_status != bulk_load_status::BLS_DOWNLOADING) {
@@ -609,10 +607,8 @@ void replica_bulk_loader::download_sst_file(
609607
// download next file
610608
if (!download_file_metas.empty()) {
611609
_download_files_task[download_file_metas.back().name] = tasking::enqueue(
612-
LPC_BACKGROUND_BULK_LOAD,
613-
tracker(),
614-
[this, remote_dir, local_dir, download_file_metas, fs]() mutable {
615-
this->download_sst_file(remote_dir, local_dir, download_file_metas, fs);
610+
LPC_BACKGROUND_BULK_LOAD, tracker(), [=, file_metas = download_file_metas]() mutable {
611+
this->download_sst_file(remote_dir, local_dir, std::move(file_metas), fs);
616612
});
617613
}
618614
}

src/replica/bulk_load/replica_bulk_loader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class replica_bulk_loader : replica_base
9090
// download sst files from remote provider
9191
void download_sst_file(const std::string &remote_dir,
9292
const std::string &local_dir,
93-
std::vector<::dsn::replication::file_meta> &download_file_metas,
93+
std::vector<::dsn::replication::file_meta> &&download_file_metas,
9494
dist::block_service::block_filesystem *fs);
9595

9696
// \return ERR_PATH_NOT_FOUND: file not exist

0 commit comments

Comments
 (0)