Coverage Report

Created: 2024-11-21 23:27

/root/doris/be/src/runtime/thread_context.h
Line
Count
Source (jump to first uncovered line)
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#pragma once
19
20
#include <bthread/bthread.h>
21
#include <bthread/types.h>
22
#include <gen_cpp/Types_types.h>
23
#include <stdint.h>
24
25
#include <memory>
26
#include <ostream>
27
#include <string>
28
#include <thread>
29
30
#include "common/exception.h"
31
#include "common/logging.h"
32
#include "gutil/macros.h"
33
#include "runtime/exec_env.h"
34
#include "runtime/memory/mem_tracker_limiter.h"
35
#include "runtime/memory/thread_mem_tracker_mgr.h"
36
#include "util/defer_op.h" // IWYU pragma: keep
37
38
// Used to tracking query/load/compaction/e.g. execution thread memory usage.
39
// This series of methods saves some information to the thread local context of the current worker thread,
40
// including MemTracker, QueryID, etc. Use CONSUME_THREAD_MEM_TRACKER/RELEASE_THREAD_MEM_TRACKER in the code segment where
41
// the macro is located to record the memory into MemTracker.
42
// Not use it in rpc done.run(), because bthread_setspecific may have errors when UBSAN compiles.
43
#if defined(USE_MEM_TRACKER) && !defined(BE_TEST)
44
// Attach to query/load/compaction/e.g. when thread starts.
45
// This will save some info about a working thread in the thread context.
46
// Looking forward to tracking memory during thread execution into MemTrackerLimiter.
47
#define SCOPED_ATTACH_TASK(arg1) auto VARNAME_LINENUM(attach_task) = AttachTask(arg1)
48
49
// Switch MemTrackerLimiter for count memory during thread execution.
50
// Used after SCOPED_ATTACH_TASK, in order to count the memory into another
51
// MemTrackerLimiter instead of the MemTrackerLimiter added by the attach task.
52
#define SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(arg1) \
53
    auto VARNAME_LINENUM(switch_mem_tracker) = doris::SwitchThreadMemTrackerLimiter(arg1)
54
55
// Looking forward to tracking memory during thread execution into MemTracker.
56
// Usually used to record query more detailed memory, including ExecNode operators.
57
#define SCOPED_CONSUME_MEM_TRACKER(mem_tracker) \
58
    auto VARNAME_LINENUM(add_mem_consumer) = doris::AddThreadMemTrackerConsumer(mem_tracker)
59
60
#define DEFER_RELEASE_RESERVED() \
61
    Defer VARNAME_LINENUM(defer) {[&]() { doris::thread_context()->release_reserved_memory(); }};
62
63
#define ORPHAN_TRACKER_CHECK()                                                  \
64
    DCHECK(doris::k_doris_exit || !doris::config::enable_memory_orphan_check || \
65
           doris::thread_context()->thread_mem_tracker()->label() != "Orphan")  \
66
            << doris::memory_orphan_check_msg
67
68
#define MEMORY_ORPHAN_CHECK()                                                 \
69
    DCHECK(doris::k_doris_exit || !doris::config::enable_memory_orphan_check) \
70
            << doris::memory_orphan_check_msg;
71
#else
72
// thread context need to be initialized, required by Allocator and elsewhere.
73
#define SCOPED_ATTACH_TASK(arg1, ...) \
74
137
    auto VARNAME_LINENUM(scoped_tls_at) = doris::ScopedInitThreadContext()
75
#define SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(arg1) \
76
82.2k
    auto VARNAME_LINENUM(scoped_tls_stmtl) = doris::ScopedInitThreadContext()
77
#define SCOPED_CONSUME_MEM_TRACKER(mem_tracker) \
78
26
    auto VARNAME_LINENUM(scoped_tls_cmt) = doris::ScopedInitThreadContext()
79
#define DEFER_RELEASE_RESERVED() (void)0
80
#define ORPHAN_TRACKER_CHECK() (void)0
81
#define MEMORY_ORPHAN_CHECK() (void)0
82
#endif
83
84
#if defined(USE_MEM_TRACKER) && !defined(BE_TEST)
85
// Count a code segment memory
86
// Usage example:
87
//      int64_t peak_mem = 0;
88
//      {
89
//          SCOPED_PEAK_MEM(&peak_mem);
90
//          xxxx
91
//      }
92
//      LOG(INFO) << *peak_mem;
93
#define SCOPED_PEAK_MEM(peak_mem) \
94
    auto VARNAME_LINENUM(scope_peak_mem) = doris::ScopedPeakMem(peak_mem)
95
96
// Count a code segment memory (memory malloc - memory free) to MemTracker.
97
// Compared to count `scope_mem`, MemTracker is easier to observe from the outside and is thread-safe.
98
// Usage example: std::unique_ptr<MemTracker> tracker = std::make_unique<MemTracker>("first_tracker");
99
//                { SCOPED_CONSUME_MEM_TRACKER_BY_HOOK(_mem_tracker.get()); xxx; xxx; }
100
#define SCOPED_CONSUME_MEM_TRACKER_BY_HOOK(mem_tracker) \
101
    auto VARNAME_LINENUM(add_mem_consumer) = doris::AddThreadMemTrackerConsumerByHook(mem_tracker)
102
#else
103
#define SCOPED_PEAK_MEM() auto VARNAME_LINENUM(scoped_tls_pm) = doris::ScopedInitThreadContext()
104
#define SCOPED_CONSUME_MEM_TRACKER_BY_HOOK(mem_tracker) \
105
    auto VARNAME_LINENUM(scoped_tls_cmtbh) = doris::ScopedInitThreadContext()
106
#endif
107
108
#define SCOPED_SKIP_MEMORY_CHECK() \
109
46.5k
    auto VARNAME_LINENUM(scope_skip_memory_check) = doris::ScopeSkipMemoryCheck()
110
111
#define SKIP_LARGE_MEMORY_CHECK(...)                                       \
112
    do {                                                                   \
113
        doris::ThreadLocalHandle::create_thread_local_if_not_exits();      \
114
        doris::thread_context()->skip_large_memory_check++;                \
115
        DEFER({                                                            \
116
            doris::thread_context()->skip_large_memory_check--;            \
117
            doris::ThreadLocalHandle::del_thread_local_if_count_is_zero(); \
118
        });                                                                \
119
        __VA_ARGS__;                                                       \
120
    } while (0)
121
122
#define LIMIT_LOCAL_SCAN_IO(data_dir, bytes_read)                     \
123
35.9k
    std::shared_ptr<IOThrottle> iot = nullptr;                        \
124
35.9k
    auto* t_ctx = doris::thread_context(true);                        \
125
35.9k
    if (t_ctx) {                                                      \
126
35.9k
        iot = t_ctx->get_local_scan_io_throttle(data_dir);            \
127
35.9k
    }                                                                 \
128
35.9k
    if (iot) {                                                        \
129
0
        iot->acquire(-1);                                             \
130
0
    }                                                                 \
131
35.9k
    Defer defer {                                                     \
132
35.9k
        [&]() {                                                       \
133
35.9k
            if (iot) {                                                \
134
0
                iot->update_next_io_time(*bytes_read);                \
135
0
                t_ctx->update_total_local_scan_io_adder(*bytes_read); \
136
0
            }                                                         \
137
35.9k
        }                                                             \
138
35.9k
    }
139
140
#define LIMIT_REMOTE_SCAN_IO(bytes_read)               \
141
11
    std::shared_ptr<IOThrottle> iot = nullptr;         \
142
11
    if (auto* t_ctx = doris::thread_context(true)) {   \
143
11
        iot = t_ctx->get_remote_scan_io_throttle();    \
144
11
    }                                                  \
145
11
    if (iot) {                                         \
146
0
        iot->acquire(-1);                              \
147
0
    }                                                  \
148
11
    Defer defer {                                      \
149
11
        [&]() {                                        \
150
11
            if (iot) {                                 \
151
0
                iot->update_next_io_time(*bytes_read); \
152
0
            }                                          \
153
11
        }                                              \
buffered_reader.cpp:_ZZN5doris2io14PrefetchBuffer11read_bufferEmPKcmPmENK3$_1clEv
Line
Count
Source
149
11
        [&]() {                                        \
150
11
            if (iot) {                                 \
151
0
                iot->update_next_io_time(*bytes_read); \
152
0
            }                                          \
153
11
        }                                              \
Unexecuted instantiation: hdfs_file_reader.cpp:_ZZN5doris2io14HdfsFileReader12read_at_implEmNS_5SliceEPmPKNS0_9IOContextEENK3$_0clEv
Unexecuted instantiation: s3_file_reader.cpp:_ZZN5doris2io12S3FileReader12read_at_implEmNS_5SliceEPmPKNS0_9IOContextEENK3$_0clEv
154
11
    }
155
156
namespace doris {
157
158
class ThreadContext;
159
class MemTracker;
160
class RuntimeState;
161
class QueryThreadContext;
162
class WorkloadGroup;
163
164
extern bthread_key_t btls_key;
165
166
// Is true after ThreadContext construction.
167
inline thread_local bool pthread_context_ptr_init = false;
168
inline thread_local constinit ThreadContext* thread_context_ptr = nullptr;
169
// use mem hook to consume thread mem tracker.
170
inline thread_local bool use_mem_hook = false;
171
172
static std::string memory_orphan_check_msg =
173
        "If you crash here, it means that SCOPED_ATTACH_TASK and "
174
        "SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER are not used correctly. starting position of "
175
        "each thread is expected to use SCOPED_ATTACH_TASK to bind a MemTrackerLimiter belonging "
176
        "to Query/Load/Compaction/Other Tasks, otherwise memory alloc using Doris Allocator in the "
177
        "thread will crash. If you want to switch MemTrackerLimiter during thread execution, "
178
        "please use SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER, do not repeat Attach.";
179
180
// The thread context saves some info about a working thread.
181
// 2 required info:
182
//   1. thread_id:   Current thread id, Auto generated.
183
//   2. type(abolished):        The type is a enum value indicating which type of task current thread is running.
184
//                   For example: QUERY, LOAD, COMPACTION, ...
185
//   3. task id:     A unique id to identify this task. maybe query id, load job id, etc.
186
//   4. ThreadMemTrackerMgr
187
//
188
// There may be other optional info to be added later.
189
class ThreadContext {
190
public:
191
2.49k
    ThreadContext() { thread_mem_tracker_mgr = std::make_unique<ThreadMemTrackerMgr>(); }
192
193
2.44k
    ~ThreadContext() = default;
194
195
    void attach_task(const TUniqueId& task_id,
196
                     const std::shared_ptr<MemTrackerLimiter>& mem_tracker,
197
6
                     const std::weak_ptr<WorkloadGroup>& wg_wptr) {
198
        // will only attach_task at the beginning of the thread function, there should be no duplicate attach_task.
199
6
        DCHECK(mem_tracker);
200
        // Orphan is thread default tracker.
201
6
        DCHECK(thread_mem_tracker()->label() == "Orphan")
202
0
                << ", thread mem tracker label: " << thread_mem_tracker()->label()
203
0
                << ", attach mem tracker label: " << mem_tracker->label();
204
6
        _task_id = task_id;
205
6
        _wg_wptr = wg_wptr;
206
6
        thread_mem_tracker_mgr->attach_limiter_tracker(mem_tracker);
207
6
        thread_mem_tracker_mgr->set_query_id(_task_id);
208
6
        thread_mem_tracker_mgr->set_wg_wptr(_wg_wptr);
209
6
        thread_mem_tracker_mgr->enable_wait_gc();
210
6
        thread_mem_tracker_mgr->reset_query_cancelled_flag(false);
211
6
    }
212
213
6
    void detach_task() {
214
6
        _task_id = TUniqueId();
215
6
        _wg_wptr.reset();
216
6
        thread_mem_tracker_mgr->detach_limiter_tracker();
217
6
        thread_mem_tracker_mgr->set_query_id(TUniqueId());
218
6
        thread_mem_tracker_mgr->reset_wg_wptr();
219
6
        thread_mem_tracker_mgr->disable_wait_gc();
220
6
    }
221
222
0
    [[nodiscard]] const TUniqueId& task_id() const { return _task_id; }
223
224
0
    static std::string get_thread_id() {
225
0
        std::stringstream ss;
226
0
        ss << std::this_thread::get_id();
227
0
        return ss.str();
228
0
    }
229
    // Note that if set global Memory Hook, After thread_mem_tracker_mgr is initialized,
230
    // the current thread Hook starts to consume/release mem_tracker.
231
    // the use of shared_ptr will cause a crash. The guess is that there is an
232
    // intermediate state during the copy construction of shared_ptr. Shared_ptr is not equal
233
    // to nullptr, but the object it points to is not initialized. At this time, when the memory
234
    // is released somewhere, the hook is triggered to cause the crash.
235
    std::unique_ptr<ThreadMemTrackerMgr> thread_mem_tracker_mgr;
236
95
    [[nodiscard]] std::shared_ptr<MemTrackerLimiter> thread_mem_tracker() const {
237
95
        return thread_mem_tracker_mgr->limiter_mem_tracker();
238
95
    }
239
240
    QueryThreadContext query_thread_context();
241
242
78
    void consume_memory(const int64_t size) const {
243
78
#ifdef USE_MEM_TRACKER
244
78
        DCHECK(doris::k_doris_exit || !doris::config::enable_memory_orphan_check ||
245
0
               thread_mem_tracker()->label() != "Orphan")
246
0
                << doris::memory_orphan_check_msg;
247
78
#endif
248
78
        thread_mem_tracker_mgr->consume(size, skip_large_memory_check);
249
78
    }
250
251
9
    doris::Status try_reserve_memory(const int64_t size) const {
252
9
#ifdef USE_MEM_TRACKER
253
9
        DCHECK(doris::k_doris_exit || !doris::config::enable_memory_orphan_check ||
254
0
               thread_mem_tracker()->label() != "Orphan")
255
0
                << doris::memory_orphan_check_msg;
256
9
#endif
257
9
        return thread_mem_tracker_mgr->try_reserve(size);
258
9
    }
259
260
2
    void release_reserved_memory() const {
261
2
#ifdef USE_MEM_TRACKER
262
2
        DCHECK(doris::k_doris_exit || !doris::config::enable_memory_orphan_check ||
263
0
               thread_mem_tracker()->label() != "Orphan")
264
0
                << doris::memory_orphan_check_msg;
265
2
#endif
266
2
        thread_mem_tracker_mgr->release_reserved();
267
2
    }
268
269
12
    std::weak_ptr<WorkloadGroup> workload_group() { return _wg_wptr; }
270
271
35.9k
    std::shared_ptr<IOThrottle> get_local_scan_io_throttle(const std::string& data_dir) {
272
35.9k
        if (std::shared_ptr<WorkloadGroup> wg_ptr = _wg_wptr.lock()) {
273
0
            return wg_ptr->get_local_scan_io_throttle(data_dir);
274
0
        }
275
35.9k
        return nullptr;
276
35.9k
    }
277
278
11
    std::shared_ptr<IOThrottle> get_remote_scan_io_throttle() {
279
11
        if (std::shared_ptr<WorkloadGroup> wg_ptr = _wg_wptr.lock()) {
280
0
            return wg_ptr->get_remote_scan_io_throttle();
281
0
        }
282
11
        return nullptr;
283
11
    }
284
285
0
    void update_total_local_scan_io_adder(size_t bytes_read) {
286
0
        if (std::shared_ptr<WorkloadGroup> wg_ptr = _wg_wptr.lock()) {
287
0
            wg_ptr->update_total_local_scan_io_adder(bytes_read);
288
0
        }
289
0
    }
290
291
    int thread_local_handle_count = 0;
292
    int skip_memory_check = 0;
293
    int skip_large_memory_check = 0;
294
295
private:
296
    TUniqueId _task_id;
297
    std::weak_ptr<WorkloadGroup> _wg_wptr;
298
};
299
300
class ThreadLocalHandle {
301
public:
302
131k
    static void create_thread_local_if_not_exits() {
303
131k
        if (bthread_self() == 0) {
304
131k
            if (!pthread_context_ptr_init) {
305
2.44k
                thread_context_ptr = new ThreadContext();
306
2.44k
                pthread_context_ptr_init = true;
307
2.44k
            }
308
131k
            DCHECK(thread_context_ptr != nullptr);
309
131k
            thread_context_ptr->thread_local_handle_count++;
310
131k
        } else {
311
            // Avoid calling bthread_getspecific frequently to get bthread local.
312
            // Very frequent bthread_getspecific will slow, but create_thread_local_if_not_exits is not expected to be much.
313
            // Cache the pointer of bthread local in pthead local.
314
74
            auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
315
74
            if (bthread_context == nullptr) {
316
                // If bthread_context == nullptr:
317
                // 1. First call to bthread_getspecific (and before any bthread_setspecific) returns NULL
318
                // 2. There are not enough reusable btls in btls pool.
319
                // else if bthread_context != nullptr:
320
                // 1. A new bthread starts, but get a reuses btls.
321
40
                bthread_context = new ThreadContext;
322
                // The brpc server should respond as quickly as possible.
323
40
                bthread_context->thread_mem_tracker_mgr->disable_wait_gc();
324
                // set the data so that next time bthread_getspecific in the thread returns the data.
325
40
                CHECK(0 == bthread_setspecific(btls_key, bthread_context) || doris::k_doris_exit);
326
40
            }
327
74
            DCHECK(bthread_context != nullptr);
328
74
            bthread_context->thread_local_handle_count++;
329
74
        }
330
131k
    }
331
332
    // `create_thread_local_if_not_exits` and `del_thread_local_if_count_is_zero` should be used in pairs,
333
    // `del_thread_local_if_count_is_zero` should only be called if `create_thread_local_if_not_exits` returns true
334
131k
    static void del_thread_local_if_count_is_zero() {
335
131k
        if (pthread_context_ptr_init) {
336
            // in pthread
337
131k
            thread_context_ptr->thread_local_handle_count--;
338
131k
            if (thread_context_ptr->thread_local_handle_count == 0) {
339
2.43k
                pthread_context_ptr_init = false;
340
2.43k
                delete doris::thread_context_ptr;
341
2.43k
                thread_context_ptr = nullptr;
342
2.43k
            }
343
131k
        } else if (bthread_self() != 0) {
344
            // in bthread
345
75
            auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
346
75
            DCHECK(bthread_context != nullptr);
347
75
            bthread_context->thread_local_handle_count--;
348
75
        } else {
349
0
            LOG(FATAL) << "__builtin_unreachable";
350
0
            __builtin_unreachable();
351
0
        }
352
131k
    }
353
};
354
355
// must call create_thread_local_if_not_exits() before use thread_context().
356
155k
static ThreadContext* thread_context(bool allow_return_null = false) {
357
155k
    if (pthread_context_ptr_init) {
358
        // in pthread
359
155k
        DCHECK(bthread_self() == 0);
360
155k
        DCHECK(thread_context_ptr != nullptr);
361
155k
        return thread_context_ptr;
362
155k
    }
363
2
    if (bthread_self() != 0) {
364
        // in bthread
365
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
366
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
367
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
368
0
        return bthread_context;
369
0
    }
370
2
    if (allow_return_null) {
371
2
        return nullptr;
372
2
    }
373
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
374
0
    LOG(FATAL) << "__builtin_unreachable, " << doris::memory_orphan_check_msg;
375
0
    __builtin_unreachable();
376
2
}
Unexecuted instantiation: task_worker_pool_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_util_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: bitmapfilter_predicate_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: runtime_filter_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: message_body_sink_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: stream_load_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: multi_table_pipe_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: stream_sink_file_writer_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: base_compaction_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: bitmap_filter_column_predicate_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: block_column_predicate_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: compaction_delete_bitmap_calculator_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: compaction_score_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: compaction_task_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cumulative_compaction_policy_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cumulative_compaction_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cumulative_compaction_time_series_policy_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: date_bloom_filter_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: delete_bitmap_calculator_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: delete_handler_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: delta_writer_cluster_key_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: delta_writer_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: engine_storage_migration_task_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: lru_cache_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: memtable_flush_executor_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: memtable_memory_limiter_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: memtable_sort_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: ordered_data_compaction_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: page_cache_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: path_gc_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: primary_key_index_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: row_cursor_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: rowid_conversion_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: beta_rowset_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: rowset_meta_manager_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: rowset_meta_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: bitmap_index_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: bloom_filter_index_reader_writer_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: encoding_info_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: index_compaction_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: index_compaction_with_deleted_term.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: inverted_index_array_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: inverted_index_file_writer_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: inverted_index_searcher_cache_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: zone_map_index_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: segcompaction_mow_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: segcompaction_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: segment_cache_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: single_compaction_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: storage_engine_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: storage_resource_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: storage_types_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet_cooldown_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet_index_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet_meta_manager_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet_meta_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet_mgr_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet_schema_helper.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: timestamped_version_tracker_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: txn_manager_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: wal_manager_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: wal_reader_writer_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: external_scan_context_mgr_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: load_stream_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: thread_mem_tracker_mgr_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: snapshot_loader_test.cpp:_ZN5dorisL14thread_contextEb
run_all_tests.cpp:_ZN5dorisL14thread_contextEb
Line
Count
Source
356
2
static ThreadContext* thread_context(bool allow_return_null = false) {
357
2
    if (pthread_context_ptr_init) {
358
        // in pthread
359
2
        DCHECK(bthread_self() == 0);
360
2
        DCHECK(thread_context_ptr != nullptr);
361
2
        return thread_context_ptr;
362
2
    }
363
0
    if (bthread_self() != 0) {
364
        // in bthread
365
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
366
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
367
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
368
0
        return bthread_context;
369
0
    }
370
0
    if (allow_return_null) {
371
0
        return nullptr;
372
0
    }
373
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
374
0
    LOG(FATAL) << "__builtin_unreachable, " << doris::memory_orphan_check_msg;
375
0
    __builtin_unreachable();
376
0
}
byte_buffer2_test.cpp:_ZN5dorisL14thread_contextEb
Line
Count
Source
356
9
static ThreadContext* thread_context(bool allow_return_null = false) {
357
9
    if (pthread_context_ptr_init) {
358
        // in pthread
359
9
        DCHECK(bthread_self() == 0);
360
9
        DCHECK(thread_context_ptr != nullptr);
361
9
        return thread_context_ptr;
362
9
    }
363
0
    if (bthread_self() != 0) {
364
        // in bthread
365
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
366
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
367
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
368
0
        return bthread_context;
369
0
    }
370
0
    if (allow_return_null) {
371
0
        return nullptr;
372
0
    }
373
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
374
0
    LOG(FATAL) << "__builtin_unreachable, " << doris::memory_orphan_check_msg;
375
0
    __builtin_unreachable();
376
0
}
Unexecuted instantiation: key_util_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: agg_replace_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: column_string_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: datetime_round_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: from_string_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: data_type_serde_csv_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: data_type_serde_mysql_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: data_type_serde_text_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: data_type_to_string_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: delta_writer_v2_pool_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: load_stream_stub_map_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: parquet_reader_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: parquet_thrift_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vfile_scanner_exception_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vgeneric_iterators_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vwal_scanner_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vexpr_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_arithmetic_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_aggregation_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_element_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_index_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_size_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_arrays_overlap_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_bitmap_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_compressed_materialization_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_eq_for_null_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_geo_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_hash_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_ifnull_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_ip_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_json_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_jsonb_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_like_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_math_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_money_format_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_nullif_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_round_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_string_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_test_template.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_test_util.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_time_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_url_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: table_function_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: serialize_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: char_type_padding_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vertical_compaction_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vtablet_writer_v2_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: partition_transformers_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: arrow_column_to_doris_column_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: task_worker_pool.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet_info.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: runtime_filter.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_scanner_helper.cpp:_ZN5dorisL14thread_contextEb
buffered_reader.cpp:_ZN5dorisL14thread_contextEb
Line
Count
Source
356
11
static ThreadContext* thread_context(bool allow_return_null = false) {
357
11
    if (pthread_context_ptr_init) {
358
        // in pthread
359
11
        DCHECK(bthread_self() == 0);
360
11
        DCHECK(thread_context_ptr != nullptr);
361
11
        return thread_context_ptr;
362
11
    }
363
0
    if (bthread_self() != 0) {
364
        // in bthread
365
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
366
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
367
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
368
0
        return bthread_context;
369
0
    }
370
0
    if (allow_return_null) {
371
0
        return nullptr;
372
0
    }
373
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
374
0
    LOG(FATAL) << "__builtin_unreachable, " << doris::memory_orphan_check_msg;
375
0
    __builtin_unreachable();
376
0
}
Unexecuted instantiation: file_factory.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: hdfs_file_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: hdfs_file_system.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: local_file_system.cpp:_ZN5dorisL14thread_contextEb
local_file_reader.cpp:_ZN5dorisL14thread_contextEb
Line
Count
Source
356
35.9k
static ThreadContext* thread_context(bool allow_return_null = false) {
357
35.9k
    if (pthread_context_ptr_init) {
358
        // in pthread
359
35.9k
        DCHECK(bthread_self() == 0);
360
35.9k
        DCHECK(thread_context_ptr != nullptr);
361
35.9k
        return thread_context_ptr;
362
35.9k
    }
363
2
    if (bthread_self() != 0) {
364
        // in bthread
365
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
366
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
367
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
368
0
        return bthread_context;
369
0
    }
370
2
    if (allow_return_null) {
371
2
        return nullptr;
372
2
    }
373
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
374
0
    LOG(FATAL) << "__builtin_unreachable, " << doris::memory_orphan_check_msg;
375
0
    __builtin_unreachable();
376
2
}
Unexecuted instantiation: multi_table_pipe.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: s3_file_bufferpool.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: s3_file_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: stream_load_pipe.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: stream_sink_file_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: base_compaction.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: base_tablet.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: block_column_predicate.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: calc_delete_bitmap_executor.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: compaction.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cumulative_compaction.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cumulative_compaction_policy.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cumulative_compaction_time_series_policy.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: data_dir.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: delete_bitmap_calculator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: delete_handler.cpp:_ZN5dorisL14thread_contextEb
delta_writer.cpp:_ZN5dorisL14thread_contextEb
Line
Count
Source
356
12
static ThreadContext* thread_context(bool allow_return_null = false) {
357
12
    if (pthread_context_ptr_init) {
358
        // in pthread
359
12
        DCHECK(bthread_self() == 0);
360
12
        DCHECK(thread_context_ptr != nullptr);
361
12
        return thread_context_ptr;
362
12
    }
363
0
    if (bthread_self() != 0) {
364
        // in bthread
365
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
366
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
367
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
368
0
        return bthread_context;
369
0
    }
370
0
    if (allow_return_null) {
371
0
        return nullptr;
372
0
    }
373
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
374
0
    LOG(FATAL) << "__builtin_unreachable, " << doris::memory_orphan_check_msg;
375
0
    __builtin_unreachable();
376
0
}
Unexecuted instantiation: delta_writer_v2.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: match_predicate.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: memtable.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: memtable_memory_limiter.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: memtable_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: memtable_flush_executor.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: merger.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: null_predicate.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: olap_server.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cold_data_compaction.cpp:_ZN5dorisL14thread_contextEb
page_cache.cpp:_ZN5dorisL14thread_contextEb
Line
Count
Source
356
26.3k
static ThreadContext* thread_context(bool allow_return_null = false) {
357
26.3k
    if (pthread_context_ptr_init) {
358
        // in pthread
359
26.3k
        DCHECK(bthread_self() == 0);
360
26.3k
        DCHECK(thread_context_ptr != nullptr);
361
26.3k
        return thread_context_ptr;
362
26.3k
    }
363
0
    if (bthread_self() != 0) {
364
        // in bthread
365
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
366
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
367
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
368
0
        return bthread_context;
369
0
    }
370
0
    if (allow_return_null) {
371
0
        return nullptr;
372
0
    }
373
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
374
0
    LOG(FATAL) << "__builtin_unreachable, " << doris::memory_orphan_check_msg;
375
0
    __builtin_unreachable();
376
0
}
Unexecuted instantiation: partial_update_info.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: primary_key_index.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: row_cursor.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: beta_rowset.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: beta_rowset_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: beta_rowset_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: beta_rowset_writer_v2.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: rowset.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: rowset_factory.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: rowset_meta.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: rowset_meta_manager.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: segcompaction.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: segment_creator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: bitmap_index_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: bitmap_index_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: bloom_filter_index_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: bloom_filter_index_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: encoding_info.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: indexed_column_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: indexed_column_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: inverted_index_cache.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: inverted_index_compaction.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: inverted_index_compound_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: inverted_index_file_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: inverted_index_file_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: inverted_index_fs_directory.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: inverted_index_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: inverted_index_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: lazy_init_segment_iterator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: ordinal_page_index.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: page_io.cpp:_ZN5dorisL14thread_contextEb
segment.cpp:_ZN5dorisL14thread_contextEb
Line
Count
Source
356
93.1k
static ThreadContext* thread_context(bool allow_return_null = false) {
357
93.1k
    if (pthread_context_ptr_init) {
358
        // in pthread
359
93.1k
        DCHECK(bthread_self() == 0);
360
93.1k
        DCHECK(thread_context_ptr != nullptr);
361
93.1k
        return thread_context_ptr;
362
93.1k
    }
363
0
    if (bthread_self() != 0) {
364
        // in bthread
365
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
366
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
367
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
368
0
        return bthread_context;
369
0
    }
370
0
    if (allow_return_null) {
371
0
        return nullptr;
372
0
    }
373
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
374
0
    LOG(FATAL) << "__builtin_unreachable, " << doris::memory_orphan_check_msg;
375
0
    __builtin_unreachable();
376
0
}
Unexecuted instantiation: column_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: empty_segment_iterator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: hierarchical_data_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: segment_iterator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: segment_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: column_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vertical_segment_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: zone_map_index.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: unique_rowset_id_generator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vertical_beta_rowset_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: rowset_builder.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_change.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: segment_loader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: single_replica_compaction.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: snapshot_manager.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: storage_engine.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: storage_policy.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: full_compaction.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet_manager.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet_meta.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet_meta_manager.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: like_column_predicate.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet_schema.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet_column_object_pool.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet_schema_cache.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: engine_batch_load_task.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: push_handler.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: engine_checksum_task.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: engine_clone_task.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: engine_index_change_task.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: engine_publish_version_task.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: engine_storage_migration_task.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: index_builder.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: txn_manager.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: types.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: version_graph.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: wal_manager.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: wal_table.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: wal_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: wrapper_field.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: buffer_control_block.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: descriptors.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: exec_env.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: exec_env_init.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: external_scan_context_mgr.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: fragment_mgr.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: group_commit_mgr.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: load_channel_mgr.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: load_channel.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: load_stream_mgr.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: load_stream.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: load_stream_writer.cpp:_ZN5dorisL14thread_contextEb
global_memory_arbitrator.cpp:_ZN5dorisL14thread_contextEb
Line
Count
Source
356
24
static ThreadContext* thread_context(bool allow_return_null = false) {
357
24
    if (pthread_context_ptr_init) {
358
        // in pthread
359
24
        DCHECK(bthread_self() == 0);
360
24
        DCHECK(thread_context_ptr != nullptr);
361
24
        return thread_context_ptr;
362
24
    }
363
0
    if (bthread_self() != 0) {
364
        // in bthread
365
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
366
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
367
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
368
0
        return bthread_context;
369
0
    }
370
0
    if (allow_return_null) {
371
0
        return nullptr;
372
0
    }
373
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
374
0
    LOG(FATAL) << "__builtin_unreachable, " << doris::memory_orphan_check_msg;
375
0
    __builtin_unreachable();
376
0
}
Unexecuted instantiation: mem_tracker_limiter.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: thread_mem_tracker_mgr.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: message_body_sink.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: query_context.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: record_batch_queue.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: routine_load_task_executor.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: data_consumer_pool.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: data_consumer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: data_consumer_group.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: runtime_filter_mgr.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: runtime_query_statistics_mgr.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: runtime_state.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: snapshot_loader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: stream_load_context.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: stream_load_executor.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablets_channel.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: workload_group.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: workload_group_manager.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: workload_sched_policy_mgr.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: http_service.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: internal_service.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: fold_constant_executor.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: rowid_fetcher.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: point_query_executor.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: row_batch.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: block_compression.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: obj_lru_cache.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: s3_util.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: thread.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: thrift_util.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: calc_file_crc_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: check_tablet_segment_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: compaction_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: compaction_score_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: download_binlog_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: file_cache_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: http_stream.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: load_channel_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: load_stream_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: meta_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: pad_rowset_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: pipeline_task_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: report_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: show_hotspot_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: show_nested_index_file_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: stream_load.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: stream_load_2pc.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablet_migration_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablets_distribution_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: tablets_info_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: utils.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: aggregate_function_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: aggregate_function_group_array_intersect.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: aggregate_function_approx_count_distinct.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: aggregate_function_map.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: aggregate_function_window.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: aggregate_function_window_funnel.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: column_nullable.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: column_object.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: allocator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_util.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: block.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: data_type_factory.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: data_type_object.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: get_least_supertype.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: data_type_nullable_serde.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: data_type_object_serde.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: avro_jni_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: column_type_convert.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: csv_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: new_plain_binary_line_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: new_json_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vorc_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: parquet_column_convert.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vparquet_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: file_meta_cache.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vparquet_group_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vparquet_column_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: scanner_scheduler.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: scanner_context.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vfile_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: max_compute_jni_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: paimon_jni_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: hudi_jni_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: lakesoul_jni_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: trino_connector_jni_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: iceberg_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: table_format_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: equality_delete.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: paimon_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: transactional_hive_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: wal_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: arrow_stream_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: arrow_pip_input_stream.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vscanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vjdbc_connector.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: table_connector.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vexplode.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vexplode_numbers.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vexplode_split.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vbitmap_predicate.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vbloom_predicate.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vectorized_fn_call.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vexpr.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vcast_expr.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: varray_literal.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: varray_map_function.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: varray_filter_function.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vcase_expr.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vexpr_context.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vin_predicate.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vinfo_func.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vliteral.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vmap_literal.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vmatch_predicate.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vruntimefilter_wrapper.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vslot_ref.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vstruct_literal.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vtuple_is_null_predicate.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_register.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_exists.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_element.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_index.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_aggregation.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_distance.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_distinct.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_except.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_intersect.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_difference.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_enumerate.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_enumerate_uniq.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_range.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_compact.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_pop.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_constructor.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_apply.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_concat.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_pushfront.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_pushback.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_first_or_last_index.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_cum_sum.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_count.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_filter.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_contains_all.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_remove.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_shuffle.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_slice.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_sort.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_sortby.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_split.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_union.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_with_constant.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_array_zip.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_arrays_overlap.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: varray_match_function.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: comparison.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: comparison_equal_for_null.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: comparison_equals.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: comparison_greater.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: comparison_less.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: divide.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_assert_true.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_bit.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_bit_count.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_bit_shift.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_bit_test.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_bitmap.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_bitmap_variadic.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_case.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_cast.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_coalesce.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_collection_in.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_conv.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_convert_tz.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_date_or_datetime_computation.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_date_or_datetime_computation_v2.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_date_or_datetime_to_string.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_datetime_floor_ceil.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_datetime_string_to_string.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_decode_varchar.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_encode_varchar.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_encryption.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_fake.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_grouping.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_hash.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_helpers.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_hex.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_hll.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_ifnull.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_ignore.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_ip.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_java_udf.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_json.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_jsonb.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_map.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_multi_match.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_nullables.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_quantile_state.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_regexp.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_rpc.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_size.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_split_by_regexp.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_string.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_struct.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_struct_element.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_time_value_to_field.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_timestamp.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_tokenize.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_utility.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_uuid.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_variant_element.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_width_bucket.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: functions_geo.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: functions_logical.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: functions_multi_string_position.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: functions_multi_string_search.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: if.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: in.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: int_div.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: is_not_null.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: is_null.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: least_greast.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: like.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: match.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: math.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: minus.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: modulo.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: multiply.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: nullif.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: plus.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: random.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: round.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: time_of_function.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: to_time_function.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: function_url.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: uuid.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: uuid_numeric.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: parse2column.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: serialize.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: block_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: olap_data_convertor.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vcollect_iterator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: runtime_predicate.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vertical_block_reader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vertical_merge_iterator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vgeneric_iterators.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vdata_stream_mgr.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vdata_stream_recvr.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vsorted_run_merger.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: delta_writer_v2_pool.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: load_stream_map_pool.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: load_stream_stub.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: partition_transformers.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vtablet_writer_v2.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: async_result_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vrow_distribution.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vtablet_finder.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vtablet_block_convertor.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vwal_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: spill_stream.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: spill_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: runtime_filter_consumer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: dependency.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: file_scan_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: split_source_connector.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: hashjoin_build_sink.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: join_build_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: nested_loop_join_build_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: shared_hash_table_controller.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vjdbc_table_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: memory_scratch_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vtablet_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: hive_table_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vhive_table_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vhive_partition_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vparquet_transformer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vorc_transformer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vcsv_transformer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: iceberg_table_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: viceberg_table_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: viceberg_partition_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: analytic_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: aggregation_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vectorized_agg_fn.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: exchange_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vdata_stream_sender.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: exchange_sink_buffer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: partitioner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: multi_cast_data_stream_sink.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: multi_cast_data_streamer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: group_commit_block_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cache_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: data_queue.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: hashjoin_probe_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: join_probe_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: nested_loop_join_probe_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: inner_join_impl.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: left_semi_join_impl.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: left_anti_join_impl.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: left_outer_join_impl.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: full_outer_join_impl.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: right_outer_join_impl.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cross_join_impl.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: right_semi_join_impl.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: right_anti_join_impl.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: null_aware_left_anti_join_impl.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: null_aware_left_semi_join_impl.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: olap_scan_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: parallel_scanner_builder.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: new_olap_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_cache.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: group_commit_scan_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: jdbc_scan_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: new_jdbc_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: es_scan_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: new_es_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: analytic_source_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: aggregation_source_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: exchange_source_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vsort_exec_exprs.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: multi_cast_data_stream_source.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: datagen_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: meta_scan_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vmeta_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cache_source_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vfile_result_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: jdbc_table_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: distinct_streaming_aggregation_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: sorter.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: partition_sort_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: partition_sort_utils.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: partition_sorter.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: partition_sort_source_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: partitioned_aggregation_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: partitioned_aggregation_source_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: partitioned_hash_join_probe_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: partitioned_hash_join_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: repeat_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: result_file_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: result_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: varrow_flight_result_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: scan_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_scan_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_partitions_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_rowsets_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_backend_active_tasks.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_active_queries_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_workload_groups_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_processlist_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_routine_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_user_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_workload_sched_policy_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_table_options_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_workload_group_privileges.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_workload_group_resource_usage_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_table_properties_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_file_cache_statistics.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: schema_catalog_meta_cache_stats_scanner.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: set_probe_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: set_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: set_source_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: sort_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: heap_sorter.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: topn_sorter.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: sort_source_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: spill_sort_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: spill_sort_source_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: streaming_aggregation_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: table_function_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: table_function_factory.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: udf_table_function.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vexplode_json_array.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vexplode_bitmap.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vexplode_map.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vexplode_json_object.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: vposexplode.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: union_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: union_source_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: local_exchange_sink_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: local_exchange_source_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: pipeline_fragment_context.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: pipeline.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: assert_num_rows_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: empty_set_operator.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: local_exchanger.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: pipeline_task.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: query_cache.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: task_queue.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: task_scheduler.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_compaction_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_delete_bitmap_action.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_delete_task.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_engine_calc_delete_bitmap_task.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_meta_mgr.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_rowset_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_schema_change_job.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_storage_engine.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: block_file_cache_downloader.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_cumulative_compaction.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_base_compaction.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_cumulative_compaction_policy.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_full_compaction.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_stream_load_executor.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_tablet.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_tablet_hotspot.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_tablet_mgr.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_tablets_channel.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_delta_writer.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_rowset_builder.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_txn_delete_bitmap_cache.cpp:_ZN5dorisL14thread_contextEb
Unexecuted instantiation: cloud_warm_up_manager.cpp:_ZN5dorisL14thread_contextEb
377
378
// belong to one query object member, not be shared by multiple queries.
379
class QueryThreadContext {
380
public:
381
79
    QueryThreadContext() = default;
382
    QueryThreadContext(const TUniqueId& query_id,
383
                       const std::shared_ptr<MemTrackerLimiter>& mem_tracker,
384
                       const std::weak_ptr<WorkloadGroup>& wg_wptr)
385
0
            : query_id(query_id), query_mem_tracker(mem_tracker), wg_wptr(wg_wptr) {}
386
    // If use WorkloadGroup and can get WorkloadGroup ptr, must as a parameter.
387
    QueryThreadContext(const TUniqueId& query_id,
388
                       const std::shared_ptr<MemTrackerLimiter>& mem_tracker)
389
14
            : query_id(query_id), query_mem_tracker(mem_tracker) {}
390
391
    // Not thread safe, generally be called in class constructor, shared_ptr use_count may be
392
    // wrong when called by multiple threads, cause crash after object be destroyed prematurely.
393
39
    void init_unlocked() {
394
#ifndef BE_TEST
395
        ORPHAN_TRACKER_CHECK();
396
        query_id = doris::thread_context()->task_id();
397
        query_mem_tracker = doris::thread_context()->thread_mem_tracker_mgr->limiter_mem_tracker();
398
        wg_wptr = doris::thread_context()->workload_group();
399
#else
400
39
        query_id = TUniqueId();
401
39
        query_mem_tracker = doris::ExecEnv::GetInstance()->orphan_mem_tracker();
402
39
#endif
403
39
    }
404
405
0
    std::shared_ptr<MemTrackerLimiter> get_memory_tracker() { return query_mem_tracker; }
406
407
0
    WorkloadGroupPtr get_workload_group_ptr() { return wg_wptr.lock(); }
408
409
    TUniqueId query_id;
410
    std::shared_ptr<MemTrackerLimiter> query_mem_tracker;
411
    std::weak_ptr<WorkloadGroup> wg_wptr;
412
};
413
414
class ScopedPeakMem {
415
public:
416
0
    explicit ScopedPeakMem(int64* peak_mem) : _peak_mem(peak_mem), _mem_tracker("ScopedPeakMem") {
417
0
        ThreadLocalHandle::create_thread_local_if_not_exits();
418
0
        thread_context()->thread_mem_tracker_mgr->push_consumer_tracker(&_mem_tracker);
419
0
    }
420
421
0
    ~ScopedPeakMem() {
422
0
        thread_context()->thread_mem_tracker_mgr->pop_consumer_tracker();
423
0
        *_peak_mem += _mem_tracker.peak_consumption();
424
0
        ThreadLocalHandle::del_thread_local_if_count_is_zero();
425
0
    }
426
427
private:
428
    int64* _peak_mem;
429
    MemTracker _mem_tracker;
430
};
431
432
// only hold thread context in scope.
433
class ScopedInitThreadContext {
434
public:
435
82.4k
    explicit ScopedInitThreadContext() { ThreadLocalHandle::create_thread_local_if_not_exits(); }
436
437
82.4k
    ~ScopedInitThreadContext() { ThreadLocalHandle::del_thread_local_if_count_is_zero(); }
438
};
439
440
class AttachTask {
441
public:
442
    // not query or load, initialize with memory tracker, empty query id and default normal workload group.
443
    explicit AttachTask(const std::shared_ptr<MemTrackerLimiter>& mem_tracker);
444
445
    // is query or load, initialize with memory tracker, query id and workload group wptr.
446
    explicit AttachTask(RuntimeState* runtime_state);
447
448
    explicit AttachTask(QueryContext* query_ctx);
449
450
    explicit AttachTask(const QueryThreadContext& query_thread_context);
451
452
    void init(const QueryThreadContext& query_thread_context);
453
454
    ~AttachTask();
455
};
456
457
class SwitchThreadMemTrackerLimiter {
458
public:
459
    explicit SwitchThreadMemTrackerLimiter(
460
0
            const std::shared_ptr<doris::MemTrackerLimiter>& mem_tracker) {
461
0
        DCHECK(mem_tracker);
462
0
        doris::ThreadLocalHandle::create_thread_local_if_not_exits();
463
0
        if (mem_tracker != thread_context()->thread_mem_tracker_mgr->limiter_mem_tracker()) {
464
0
            _old_mem_tracker = thread_context()->thread_mem_tracker_mgr->limiter_mem_tracker();
465
0
            thread_context()->thread_mem_tracker_mgr->attach_limiter_tracker(mem_tracker);
466
0
        }
467
0
    }
468
469
0
    explicit SwitchThreadMemTrackerLimiter(const doris::QueryThreadContext& query_thread_context) {
470
0
        doris::ThreadLocalHandle::create_thread_local_if_not_exits();
471
0
        DCHECK(thread_context()->task_id() ==
472
0
               query_thread_context.query_id); // workload group alse not change
473
0
        DCHECK(query_thread_context.query_mem_tracker);
474
0
        if (query_thread_context.query_mem_tracker !=
475
0
            thread_context()->thread_mem_tracker_mgr->limiter_mem_tracker()) {
476
0
            _old_mem_tracker = thread_context()->thread_mem_tracker_mgr->limiter_mem_tracker();
477
0
            thread_context()->thread_mem_tracker_mgr->attach_limiter_tracker(
478
0
                    query_thread_context.query_mem_tracker);
479
0
        }
480
0
    }
481
482
0
    ~SwitchThreadMemTrackerLimiter() {
483
0
        if (_old_mem_tracker != nullptr) {
484
0
            thread_context()->thread_mem_tracker_mgr->detach_limiter_tracker(_old_mem_tracker);
485
0
        }
486
0
        doris::ThreadLocalHandle::del_thread_local_if_count_is_zero();
487
0
    }
488
489
private:
490
    std::shared_ptr<doris::MemTrackerLimiter> _old_mem_tracker {nullptr};
491
};
492
493
class AddThreadMemTrackerConsumer {
494
public:
495
    // The owner and user of MemTracker are in the same thread, and the raw pointer is faster.
496
    // If mem_tracker is nullptr, do nothing.
497
    explicit AddThreadMemTrackerConsumer(MemTracker* mem_tracker);
498
499
    // The owner and user of MemTracker are in different threads. If mem_tracker is nullptr, do nothing.
500
    explicit AddThreadMemTrackerConsumer(const std::shared_ptr<MemTracker>& mem_tracker);
501
502
    ~AddThreadMemTrackerConsumer();
503
504
private:
505
    std::shared_ptr<MemTracker> _mem_tracker; // Avoid mem_tracker being released midway.
506
    bool _need_pop = false;
507
};
508
509
class AddThreadMemTrackerConsumerByHook {
510
public:
511
    explicit AddThreadMemTrackerConsumerByHook(const std::shared_ptr<MemTracker>& mem_tracker);
512
    ~AddThreadMemTrackerConsumerByHook();
513
514
private:
515
    std::shared_ptr<MemTracker> _mem_tracker;
516
};
517
518
class ScopeSkipMemoryCheck {
519
public:
520
46.5k
    explicit ScopeSkipMemoryCheck() {
521
46.5k
        ThreadLocalHandle::create_thread_local_if_not_exits();
522
46.5k
        doris::thread_context()->skip_memory_check++;
523
46.5k
    }
524
525
46.5k
    ~ScopeSkipMemoryCheck() {
526
46.5k
        doris::thread_context()->skip_memory_check--;
527
46.5k
        ThreadLocalHandle::del_thread_local_if_count_is_zero();
528
46.5k
    }
529
};
530
531
// Basic macros for mem tracker, usually do not need to be modified and used.
532
#if defined(USE_MEM_TRACKER) && !defined(BE_TEST)
533
// used to fix the tracking accuracy of caches.
534
#define THREAD_MEM_TRACKER_TRANSFER_TO(size, tracker)                                        \
535
    do {                                                                                     \
536
        ORPHAN_TRACKER_CHECK();                                                              \
537
        doris::thread_context()->thread_mem_tracker_mgr->limiter_mem_tracker()->transfer_to( \
538
                size, tracker);                                                              \
539
    } while (0)
540
541
#define THREAD_MEM_TRACKER_TRANSFER_FROM(size, tracker)                                        \
542
    do {                                                                                       \
543
        ORPHAN_TRACKER_CHECK();                                                                \
544
        tracker->transfer_to(                                                                  \
545
                size, doris::thread_context()->thread_mem_tracker_mgr->limiter_mem_tracker()); \
546
    } while (0)
547
548
// Mem Hook to consume thread mem tracker
549
#define CONSUME_THREAD_MEM_TRACKER_BY_HOOK(size)           \
550
    do {                                                   \
551
        if (doris::use_mem_hook) {                         \
552
            doris::thread_context()->consume_memory(size); \
553
        }                                                  \
554
    } while (0)
555
#define RELEASE_THREAD_MEM_TRACKER_BY_HOOK(size) CONSUME_THREAD_MEM_TRACKER_BY_HOOK(-size)
556
#define CONSUME_THREAD_MEM_TRACKER_BY_HOOK_WITH_FN(size_fn, ...)           \
557
    do {                                                                   \
558
        if (doris::use_mem_hook) {                                         \
559
            doris::thread_context()->consume_memory(size_fn(__VA_ARGS__)); \
560
        }                                                                  \
561
    } while (0)
562
#define RELEASE_THREAD_MEM_TRACKER_BY_HOOK_WITH_FN(size_fn, ...)            \
563
    do {                                                                    \
564
        if (doris::use_mem_hook) {                                          \
565
            doris::thread_context()->consume_memory(-size_fn(__VA_ARGS__)); \
566
        }                                                                   \
567
    } while (0)
568
569
// if use mem hook, avoid repeated consume.
570
// must call create_thread_local_if_not_exits() before use thread_context().
571
#define CONSUME_THREAD_MEM_TRACKER(size)                                                       \
572
    do {                                                                                       \
573
        if (size == 0 || doris::use_mem_hook) {                                                \
574
            break;                                                                             \
575
        }                                                                                      \
576
        if (doris::pthread_context_ptr_init) {                                                 \
577
            DCHECK(bthread_self() == 0);                                                       \
578
            doris::thread_context_ptr->consume_memory(size);                                   \
579
        } else if (bthread_self() != 0) {                                                      \
580
            static_cast<doris::ThreadContext*>(bthread_getspecific(doris::btls_key))           \
581
                    ->consume_memory(size);                                                    \
582
        } else if (doris::ExecEnv::ready()) {                                                  \
583
            MEMORY_ORPHAN_CHECK();                                                             \
584
            doris::ExecEnv::GetInstance()->orphan_mem_tracker()->consume_no_update_peak(size); \
585
        }                                                                                      \
586
    } while (0)
587
#define RELEASE_THREAD_MEM_TRACKER(size) CONSUME_THREAD_MEM_TRACKER(-size)
588
589
#else
590
#define THREAD_MEM_TRACKER_TRANSFER_TO(size, tracker) (void)0
591
#define THREAD_MEM_TRACKER_TRANSFER_FROM(size, tracker) (void)0
592
#define CONSUME_THREAD_MEM_TRACKER_BY_HOOK(size) (void)0
593
#define RELEASE_THREAD_MEM_TRACKER_BY_HOOK(size) (void)0
594
#define CONSUME_THREAD_MEM_TRACKER_BY_HOOK_WITH_FN(size_fn, ...) (void)0
595
#define RELEASE_THREAD_MEM_TRACKER_BY_HOOK_WITH_FN(size_fn, ...) (void)0
596
443k
#define CONSUME_THREAD_MEM_TRACKER(size) (void)0
597
409k
#define RELEASE_THREAD_MEM_TRACKER(size) (void)0
598
#endif
599
} // namespace doris