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

Commit

Permalink
fix(bulk-load): update cleanup download task (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
hycdong authored Jul 27, 2020
1 parent 113e7e6 commit 8a56c95
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/replica/bulk_load/replica_bulk_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,9 +593,14 @@ error_code replica_bulk_loader::remove_local_bulk_load_dir(const std::string &bu
void replica_bulk_loader::cleanup_download_task()
{
for (auto &kv : _download_task) {
CLEANUP_TASK_ALWAYS(kv.second)
if (kv.second != nullptr) {
bool finished = false;
kv.second->cancel(false, &finished);
if (finished) {
kv.second = nullptr;
}
}
}
_download_task.clear();
}

// ThreadPool: THREAD_POOL_REPLICATION
Expand All @@ -606,6 +611,7 @@ void replica_bulk_loader::clear_bulk_load_states()
}

cleanup_download_task();
_download_task.clear();
_metadata.files.clear();
_metadata.file_total_size = 0;
_cur_downloaded_size.store(0);
Expand Down

0 comments on commit 8a56c95

Please sign in to comment.