Skip to content
Open
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
4 changes: 2 additions & 2 deletions be/src/pipeline/dependency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void Dependency::set_ready() {
if (_ready) {
return;
}
_watcher.stop();
stop_watcher(lc);
_ready = true;
local_block_task.swap(_blocked_task);
}
Expand All @@ -95,7 +95,7 @@ Dependency* Dependency::is_blocked_by(std::shared_ptr<PipelineTask> task) {
auto ready = _ready.load();
if (!ready && task) {
_add_block_task(task);
start_watcher();
start_watcher(lc);
THROW_IF_ERROR(task->blocked(this, lc));
}
return ready ? nullptr : this;
Expand Down
5 changes: 4 additions & 1 deletion be/src/pipeline/dependency.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ class Dependency : public std::enable_shared_from_this<Dependency> {
bool ready() const { return _ready; }

// Start the watcher. We use it to count how long this dependency block the current pipeline task.
void start_watcher() { _watcher.start(); }
void start_watcher(const std::unique_lock<std::mutex>&) { _watcher.start(); }

// Stop the watcher. make sure to call it in lock of _task_lock.
void stop_watcher(const std::unique_lock<std::mutex>&) { _watcher.stop(); }
[[nodiscard]] int64_t watcher_elapse_time() { return _watcher.elapsed_time(); }

// Which dependency current pipeline task is blocked by. `nullptr` if this dependency is ready.
Expand Down