Skip to content
Merged
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
7 changes: 7 additions & 0 deletions be/src/util/async_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "io/fs/file_system.h"
#include "olap/olap_define.h"
#include "runtime/thread_context.h"
#include "util/cpu_info.h"
#include "work_thread_pool.hpp"

Expand Down Expand Up @@ -79,6 +80,12 @@ class AsyncIO {
PriorityThreadPool::Task task;
task.priority = nice;
task.work_function = [&] {
// The AsyncIO worker is a plain infra pthread that is not bound to any task,
// so it has no ThreadContext. fn() (e.g. a FILESYSTEM_M dispatched upload/read)
// may touch thread_context() (memory tracking, LIMIT_*_SCAN_IO, ...), which would
// FatalError without a context. Initialize an (unattached) ThreadContext here,
// same pattern as StorageEngine background threads.
SCOPED_INIT_THREAD_CONTEXT();
Comment thread
liaoxin01 marked this conversation as resolved.
fn();
std::unique_lock l(mutex);
cv.notify_one();
Expand Down
Loading