Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions be/src/cloud/cloud_warm_up_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ void CloudWarmUpManager::handle_jobs() {
#ifndef BE_TEST
constexpr int WAIT_TIME_SECONDS = 600;
while (true) {
JobMeta cur_job;
std::shared_ptr<JobMeta> cur_job = nullptr;
{
std::unique_lock lock(_mtx);
_cond.wait(lock, [this]() { return _closed || !_pending_job_metas.empty(); });
if (_closed) break;
cur_job = std::move(_pending_job_metas.front());
cur_job = _pending_job_metas.front();
}
for (int64_t tablet_id : cur_job.tablet_ids) {
for (int64_t tablet_id : cur_job->tablet_ids) {
if (_cur_job_id == 0) { // The job is canceled
break;
}
Expand Down Expand Up @@ -173,7 +173,7 @@ void CloudWarmUpManager::handle_jobs() {
}
{
std::unique_lock lock(_mtx);
_finish_job.push_back(std::move(cur_job));
_finish_job.push_back(cur_job);
_pending_job_metas.pop_front();
}
}
Expand Down Expand Up @@ -230,8 +230,9 @@ Status CloudWarmUpManager::check_and_set_batch_id(int64_t job_id, int64_t batch_
void CloudWarmUpManager::add_job(const std::vector<TJobMeta>& job_metas) {
{
std::lock_guard lock(_mtx);
std::for_each(job_metas.begin(), job_metas.end(),
[this](const TJobMeta& meta) { _pending_job_metas.emplace_back(meta); });
std::for_each(job_metas.begin(), job_metas.end(), [this](const TJobMeta& meta) {
_pending_job_metas.emplace_back(std::make_shared<JobMeta>(meta));
});
}
_cond.notify_all();
}
Expand Down
4 changes: 2 additions & 2 deletions be/src/cloud/cloud_warm_up_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class CloudWarmUpManager {
std::condition_variable _cond;
int64_t _cur_job_id {0};
int64_t _cur_batch_id {-1};
std::deque<JobMeta> _pending_job_metas;
std::vector<JobMeta> _finish_job;
std::deque<std::shared_ptr<JobMeta>> _pending_job_metas;
std::vector<std::shared_ptr<JobMeta>> _finish_job;
std::thread _download_thread;
bool _closed {false};
// the attribute for compile in ut
Expand Down