Coverage Report

Created: 2026-08-15 01:43

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/runtime/thread_context.h
Line
Count
Source
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
23
#include <memory>
24
#include <string>
25
#include <thread>
26
27
#include "common/exception.h"
28
#include "common/logging.h"
29
#include "common/macros.h"
30
#include "runtime/memory/mem_tracker_limiter.h"
31
#include "runtime/memory/thread_mem_tracker_mgr.h"
32
#include "util/defer_op.h" // IWYU pragma: keep
33
34
// Used to tracking query/load/compaction/e.g. execution thread memory usage.
35
// This series of methods saves some information to the thread local context of the current worker thread,
36
// including MemTracker, QueryID, etc. Use CONSUME_THREAD_MEM_TRACKER/RELEASE_THREAD_MEM_TRACKER in the code segment where
37
// the macro is located to record the memory into MemTracker.
38
// Not use it in rpc done.run(), because bthread_setspecific may have errors when UBSAN compiles.
39
40
// Attach to query/load/compaction/e.g. when thread starts.
41
// This will save some info about a working thread in the thread context.
42
// Looking forward to tracking memory during thread execution into MemTrackerLimiter.
43
12.7M
#define SCOPED_ATTACH_TASK(arg1) auto VARNAME_LINENUM(attach_task) = AttachTask(arg1)
44
45
// If the current thread is not executing a Task, such as a StorageEngine thread,
46
// use SCOPED_INIT_THREAD_CONTEXT to initialize ThreadContext.
47
#define SCOPED_INIT_THREAD_CONTEXT() \
48
358
    auto VARNAME_LINENUM(scoped_tls_itc) = doris::ScopedInitThreadContext()
49
50
// Switch resource context in thread context, used after SCOPED_ATTACH_TASK.
51
// If just want to switch mem tracker, use SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER first.
52
#define SCOPED_SWITCH_RESOURCE_CONTEXT(arg1) \
53
    auto VARNAME_LINENUM(switch_resource_context) = doris::SwitchResourceContext(arg1)
54
55
// Switch MemTrackerLimiter for count memory during thread execution.
56
// Used after SCOPED_ATTACH_TASK, in order to count the memory into another
57
// MemTrackerLimiter instead of the MemTrackerLimiter added by the attach task.
58
#define SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER(arg1) \
59
16.8M
    auto VARNAME_LINENUM(switch_mem_tracker) = doris::SwitchThreadMemTrackerLimiter(arg1)
60
61
// Looking forward to tracking memory during thread execution into MemTracker.
62
// Usually used to record query more detailed memory, including ExecNode operators.
63
#define SCOPED_CONSUME_MEM_TRACKER(mem_tracker) \
64
1.51M
    auto VARNAME_LINENUM(add_mem_consumer) = doris::AddThreadMemTrackerConsumer(mem_tracker)
65
66
#define DEFER_RELEASE_RESERVED()   \
67
9.42M
    Defer VARNAME_LINENUM(defer) { \
68
9.42M
            [&]() { doris::thread_context()->thread_mem_tracker_mgr->shrink_reserved(); }};
unity_7_cxx.cxx:_ZZN5doris12PipelineTask7executeEPbENK3$_2clEv
Line
Count
Source
68
6.97M
            [&]() { doris::thread_context()->thread_mem_tracker_mgr->shrink_reserved(); }};
unity_7_cxx.cxx:_ZZN5doris12PipelineTask7executeEPbENK3$_3clEv
Line
Count
Source
68
2.42M
            [&]() { doris::thread_context()->thread_mem_tracker_mgr->shrink_reserved(); }};
69
70
// Count a code segment memory
71
// Usage example:
72
//      int64_t peak_mem = 0;
73
//      {
74
//          SCOPED_PEAK_MEM(&peak_mem);
75
//          xxxx
76
//      }
77
//      LOG(INFO) << *peak_mem;
78
#define SCOPED_PEAK_MEM(peak_mem) \
79
753k
    auto VARNAME_LINENUM(scope_peak_mem) = doris::ScopedPeakMem(peak_mem)
80
81
#define SCOPED_SKIP_MEMORY_CHECK() \
82
24.4M
    auto VARNAME_LINENUM(scope_skip_memory_check) = doris::ScopeSkipMemoryCheck()
83
84
#define SKIP_LARGE_MEMORY_CHECK(...)                                                    \
85
    do {                                                                                \
86
        doris::ThreadLocalHandle::create_thread_local_if_not_exits();                   \
87
        doris::thread_context()->thread_mem_tracker_mgr->skip_large_memory_check++;     \
88
        DEFER({                                                                         \
89
            doris::thread_context()->thread_mem_tracker_mgr->skip_large_memory_check--; \
90
            doris::ThreadLocalHandle::del_thread_local_if_count_is_zero();              \
91
        });                                                                             \
92
        __VA_ARGS__;                                                                    \
93
    } while (0)
94
95
#define LIMIT_LOCAL_SCAN_IO(data_dir, bytes_read)                                            \
96
2.20M
    std::shared_ptr<IOThrottle> iot = nullptr;                                               \
97
2.20M
    auto* t_ctx = doris::thread_context();                                                   \
98
2.20M
    if (t_ctx->is_attach_task() && t_ctx->resource_ctx()->workload_group() != nullptr) {     \
99
1.42M
        iot = t_ctx->resource_ctx()->workload_group()->get_local_scan_io_throttle(data_dir); \
100
1.42M
    }                                                                                        \
101
2.20M
    if (iot) {                                                                               \
102
1.42M
        iot->acquire(-1);                                                                    \
103
1.42M
    }                                                                                        \
104
2.20M
    Defer defer {                                                                            \
105
2.54M
        [&]() {                                                                              \
106
2.54M
            if (iot) {                                                                       \
107
1.41M
                iot->update_next_io_time(*bytes_read);                                       \
108
1.41M
                t_ctx->resource_ctx()->workload_group()->update_local_scan_io(data_dir,      \
109
1.41M
                                                                              *bytes_read);  \
110
1.41M
            }                                                                                \
111
2.54M
        }                                                                                    \
local_file_reader.cpp:_ZZN5doris2io15LocalFileReader12read_at_implEmNS_5SliceEPmPKNS0_9IOContextEENK3$_0clEv
Line
Count
Source
105
2.54M
        [&]() {                                                                              \
106
2.54M
            if (iot) {                                                                       \
107
1.41M
                iot->update_next_io_time(*bytes_read);                                       \
108
1.41M
                t_ctx->resource_ctx()->workload_group()->update_local_scan_io(data_dir,      \
109
1.41M
                                                                              *bytes_read);  \
110
1.41M
            }                                                                                \
111
2.54M
        }                                                                                    \
local_file_reader.cpp:_ZZN5doris2io15LocalFileReader18read_at_iobuf_implEmmPN5butil5IOBufEPmPKNS0_9IOContextEENK3$_0clEv
Line
Count
Source
105
7
        [&]() {                                                                              \
106
7
            if (iot) {                                                                       \
107
0
                iot->update_next_io_time(*bytes_read);                                       \
108
0
                t_ctx->resource_ctx()->workload_group()->update_local_scan_io(data_dir,      \
109
0
                                                                              *bytes_read);  \
110
0
            }                                                                                \
111
7
        }                                                                                    \
112
2.20M
    }
113
114
#define LIMIT_REMOTE_SCAN_IO(bytes_read)                                                     \
115
255k
    std::shared_ptr<IOThrottle> iot = nullptr;                                               \
116
255k
    auto* t_ctx = doris::thread_context();                                                   \
117
255k
    if (t_ctx->is_attach_task() && t_ctx->resource_ctx()->workload_group() != nullptr) {     \
118
171k
        iot = t_ctx->resource_ctx()->workload_group()->get_remote_scan_io_throttle();        \
119
171k
    }                                                                                        \
120
255k
    if (iot) {                                                                               \
121
171k
        iot->acquire(-1);                                                                    \
122
171k
    }                                                                                        \
123
255k
    Defer defer {                                                                            \
124
255k
        [&]() {                                                                              \
125
254k
            if (iot) {                                                                       \
126
170k
                iot->update_next_io_time(*bytes_read);                                       \
127
170k
                t_ctx->resource_ctx()->workload_group()->update_remote_scan_io(*bytes_read); \
128
170k
            }                                                                                \
129
254k
        }                                                                                    \
peer_file_cache_reader.cpp:_ZZN5doris2io19PeerFileCacheReader12fetch_blocksERKSt6vectorISt10shared_ptrINS0_9FileBlockEESaIS5_EEPNS0_15PeerFetchResultEmPKNS0_9IOContextEblNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEENK3$_0clEv
Line
Count
Source
124
39
        [&]() {                                                                              \
125
39
            if (iot) {                                                                       \
126
3
                iot->update_next_io_time(*bytes_read);                                       \
127
3
                t_ctx->resource_ctx()->workload_group()->update_remote_scan_io(*bytes_read); \
128
3
            }                                                                                \
129
39
        }                                                                                    \
buffered_reader.cpp:_ZZN5doris2io14PrefetchBuffer11read_bufferEmPKcmPmENK3$_1clEv
Line
Count
Source
124
121
        [&]() {                                                                              \
125
121
            if (iot) {                                                                       \
126
90
                iot->update_next_io_time(*bytes_read);                                       \
127
90
                t_ctx->resource_ctx()->workload_group()->update_remote_scan_io(*bytes_read); \
128
90
            }                                                                                \
129
121
        }                                                                                    \
Unexecuted instantiation: hdfs_file_reader.cpp:_ZZN5doris2io14HdfsFileReader15do_read_at_implEmNS_5SliceEPmPKNS0_9IOContextEENK3$_0clEv
s3_file_reader.cpp:_ZZN5doris2io12S3FileReader12read_at_implEmNS_5SliceEPmPKNS0_9IOContextEENK3$_0clEv
Line
Count
Source
124
254k
        [&]() {                                                                              \
125
254k
            if (iot) {                                                                       \
126
170k
                iot->update_next_io_time(*bytes_read);                                       \
127
170k
                t_ctx->resource_ctx()->workload_group()->update_remote_scan_io(*bytes_read); \
128
170k
            }                                                                                \
129
254k
        }                                                                                    \
130
255k
    }
131
132
namespace doris {
133
134
class ThreadContext;
135
class MemTracker;
136
class QueryContext;
137
class ResourceContext;
138
class RuntimeState;
139
class SwitchResourceContext;
140
141
extern bthread_key_t btls_key;
142
143
static std::string NO_THREAD_CONTEXT_MSG =
144
        "Current thread not exist ThreadContext, usually after the thread is started, using "
145
        "SCOPED_ATTACH_TASK macro to create a ThreadContext and bind a Task.";
146
147
// Is true after ThreadContext construction.
148
inline thread_local bool pthread_context_ptr_init = false;
149
inline thread_local constinit ThreadContext* thread_context_ptr = nullptr;
150
151
// The thread context saves some info about a working thread.
152
// 2 required info:
153
//   1. thread_id:   Current thread id, Auto generated.
154
//   2. type(abolished):        The type is a enum value indicating which type of task current thread is running.
155
//                   For example: QUERY, LOAD, COMPACTION, ...
156
//   3. task id:     A unique id to identify this task. maybe query id, load job id, etc.
157
//   4. ThreadMemTrackerMgr
158
//
159
// There may be other optional info to be added later.
160
//
161
// Note: Keep the class simple and only add properties.
162
class ThreadContext {
163
public:
164
3.25M
    ThreadContext() { thread_mem_tracker_mgr = std::make_unique<ThreadMemTrackerMgr>(); }
165
166
3.24M
    ~ThreadContext() = default;
167
168
    void attach_task(const std::shared_ptr<ResourceContext>& rc);
169
170
12.7M
    void detach_task() {
171
12.7M
        resource_ctx_.reset();
172
12.7M
        thread_mem_tracker_mgr->detach_limiter_tracker();
173
12.7M
        thread_mem_tracker_mgr->disable_wait_gc();
174
12.7M
    }
175
176
16.6M
    bool is_attach_task() { return resource_ctx_ != nullptr; }
177
178
6.90M
    std::shared_ptr<ResourceContext> resource_ctx() {
179
6.90M
#ifndef BE_TEST
180
6.90M
        DCHECK(is_attach_task());
181
6.90M
#endif
182
6.91M
        if (is_attach_task()) {
183
6.91M
            return resource_ctx_;
184
6.91M
        }
185
18.4E
        return _make_orphan_resource_ctx();
186
6.90M
    }
187
188
42.4k
    static std::string get_thread_id() {
189
42.4k
        std::stringstream ss;
190
42.4k
        ss << std::this_thread::get_id();
191
42.4k
        return ss.str();
192
42.4k
    }
193
    // Note that if set global Memory Hook, After thread_mem_tracker_mgr is initialized,
194
    // the current thread Hook starts to consume/release mem_tracker.
195
    // the use of shared_ptr will cause a crash. The guess is that there is an
196
    // intermediate state during the copy construction of shared_ptr. Shared_ptr is not equal
197
    // to nullptr, but the object it points to is not initialized. At this time, when the memory
198
    // is released somewhere, the hook is triggered to cause the crash.
199
    std::unique_ptr<ThreadMemTrackerMgr> thread_mem_tracker_mgr;
200
201
    int thread_local_handle_count = 0;
202
203
private:
204
    friend class SwitchResourceContext;
205
206
    // Cold fallback for threads without an attached task; defined in the .cpp
207
    // so this header does not need the full ResourceContext / ExecEnv types.
208
    static std::shared_ptr<ResourceContext> _make_orphan_resource_ctx();
209
210
    std::shared_ptr<ResourceContext> resource_ctx_;
211
};
212
213
class ThreadLocalHandle {
214
public:
215
56.4M
    static void create_thread_local_if_not_exits() {
216
56.4M
        if (bthread_self() == 0) {
217
54.1M
            if (!pthread_context_ptr_init) {
218
1.44M
                thread_context_ptr = new ThreadContext();
219
1.44M
                pthread_context_ptr_init = true;
220
1.44M
            }
221
54.1M
            DCHECK(thread_context_ptr != nullptr);
222
54.1M
            thread_context_ptr->thread_local_handle_count++;
223
54.1M
        } else {
224
            // Avoid calling bthread_getspecific frequently to get bthread local.
225
            // Very frequent bthread_getspecific will slow, but create_thread_local_if_not_exits is not expected to be much.
226
            // Cache the pointer of bthread local in pthead local.
227
2.25M
            auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
228
2.25M
            if (bthread_context == nullptr) {
229
                // If bthread_context == nullptr:
230
                // 1. First call to bthread_getspecific (and before any bthread_setspecific) returns NULL
231
                // 2. There are not enough reusable btls in btls pool.
232
                // else if bthread_context != nullptr:
233
                // 1. A new bthread starts, but get a reuses btls.
234
1.77M
                bthread_context = new ThreadContext;
235
                // The brpc server should respond as quickly as possible.
236
1.77M
                bthread_context->thread_mem_tracker_mgr->disable_wait_gc();
237
                // set the data so that next time bthread_getspecific in the thread returns the data.
238
1.77M
                CHECK(0 == bthread_setspecific(btls_key, bthread_context) || doris::k_doris_exit);
239
1.77M
            }
240
2.25M
            DCHECK(bthread_context != nullptr);
241
2.25M
            bthread_context->thread_local_handle_count++;
242
2.25M
        }
243
56.4M
    }
244
245
    // `create_thread_local_if_not_exits` and `del_thread_local_if_count_is_zero` should be used in pairs,
246
    // `del_thread_local_if_count_is_zero` should only be called if `create_thread_local_if_not_exits` returns true
247
56.6M
    static void del_thread_local_if_count_is_zero() {
248
56.6M
        if (pthread_context_ptr_init) {
249
            // in pthread
250
54.2M
            thread_context_ptr->thread_local_handle_count--;
251
54.2M
            if (thread_context_ptr->thread_local_handle_count == 0) {
252
1.43M
                pthread_context_ptr_init = false;
253
1.43M
                delete doris::thread_context_ptr;
254
1.43M
                thread_context_ptr = nullptr;
255
1.43M
            }
256
54.2M
        } else if (bthread_self() != 0) {
257
            // in bthread
258
2.34M
            auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
259
2.34M
            DCHECK(bthread_context != nullptr);
260
2.34M
            bthread_context->thread_local_handle_count--;
261
2.34M
        } else {
262
48.6k
            throw Exception(Status::FatalError("__builtin_unreachable"));
263
48.6k
        }
264
56.6M
    }
265
};
266
267
// must call create_thread_local_if_not_exits() before use thread_context().
268
609M
static ThreadContext* thread_context() {
269
609M
    if (pthread_context_ptr_init) {
270
        // in pthread
271
604M
        DCHECK(bthread_self() == 0);
272
604M
        DCHECK(thread_context_ptr != nullptr);
273
604M
        return thread_context_ptr;
274
604M
    }
275
4.86M
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
4.86M
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
4.86M
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
4.86M
        return bthread_context;
281
4.86M
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
18.4E
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
4.67M
}
Unexecuted instantiation: doris_main.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: agent_server.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: task_worker_pool.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: config.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: daemon.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_0_cxx.cxx:_ZN5dorisL14thread_contextEv
block.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
45.7M
static ThreadContext* thread_context() {
269
45.7M
    if (pthread_context_ptr_init) {
270
        // in pthread
271
45.7M
        DCHECK(bthread_self() == 0);
272
45.7M
        DCHECK(thread_context_ptr != nullptr);
273
45.7M
        return thread_context_ptr;
274
45.7M
    }
275
1.65k
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
0
        return bthread_context;
281
0
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
1.65k
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
1.65k
}
Unexecuted instantiation: data_type_factory.cpp:_ZN5dorisL14thread_contextEv
allocator.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
411M
static ThreadContext* thread_context() {
269
411M
    if (pthread_context_ptr_init) {
270
        // in pthread
271
411M
        DCHECK(bthread_self() == 0);
272
411M
        DCHECK(thread_context_ptr != nullptr);
273
411M
        return thread_context_ptr;
274
411M
    }
275
18.4E
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
1.53k
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
1.53k
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
1.53k
        return bthread_context;
281
1.53k
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
18.4E
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
18.4E
}
Unexecuted instantiation: field.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vdatetime_value.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: timestamptz_value.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_decimal.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_serde.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_number_serde.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_decimal_serde.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_string_serde.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: get_least_supertype.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_number_base.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_nullable_serde.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_date_or_datetime_v2.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_datetimev2_serde.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_datev2_serde.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_variant_v2_serde.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_variant.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: column_variant.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: convert_field_to_type.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_variant_serde.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_ipv4.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_ipv4_serde.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_ipv6.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_ipv6_serde.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_date.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_date_or_datetime_serde.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_timestamptz.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_timestamptz_serde.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_date_time.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_time.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_type_time_serde.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_13_cxx.cxx:_ZN5dorisL14thread_contextEv
unity_1_cxx.cxx:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
1.49M
static ThreadContext* thread_context() {
269
1.49M
    if (pthread_context_ptr_init) {
270
        // in pthread
271
1.49M
        DCHECK(bthread_self() == 0);
272
1.49M
        DCHECK(thread_context_ptr != nullptr);
273
1.49M
        return thread_context_ptr;
274
1.49M
    }
275
18.4E
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
0
        return bthread_context;
281
0
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
18.4E
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
18.4E
}
unity_7_cxx.cxx:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
17.0M
static ThreadContext* thread_context() {
269
17.0M
    if (pthread_context_ptr_init) {
270
        // in pthread
271
17.0M
        DCHECK(bthread_self() == 0);
272
17.0M
        DCHECK(thread_context_ptr != nullptr);
273
17.0M
        return thread_context_ptr;
274
17.0M
    }
275
18.4E
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
0
        return bthread_context;
281
0
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
18.4E
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
18.4E
}
Unexecuted instantiation: unity_6_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_12_cxx.cxx:_ZN5dorisL14thread_contextEv
unity_11_cxx.cxx:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
171k
static ThreadContext* thread_context() {
269
171k
    if (pthread_context_ptr_init) {
270
        // in pthread
271
171k
        DCHECK(bthread_self() == 0);
272
171k
        DCHECK(thread_context_ptr != nullptr);
273
171k
        return thread_context_ptr;
274
171k
    }
275
18.4E
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
0
        return bthread_context;
281
0
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
18.4E
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
18.4E
}
Unexecuted instantiation: unity_10_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_2_cxx.cxx:_ZN5dorisL14thread_contextEv
unity_9_cxx.cxx:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
1.83M
static ThreadContext* thread_context() {
269
1.83M
    if (pthread_context_ptr_init) {
270
        // in pthread
271
1.83M
        DCHECK(bthread_self() == 0);
272
1.83M
        DCHECK(thread_context_ptr != nullptr);
273
1.83M
        return thread_context_ptr;
274
1.83M
    }
275
18.4E
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
0
        return bthread_context;
281
0
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
18.4E
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
18.4E
}
Unexecuted instantiation: unity_5_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_8_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_4_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_3_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: hashjoin_build_sink.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: join_build_sink_operator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: operator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: partitioned_aggregation_sink_operator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: scan_operator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vfile_result_writer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_30_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_29_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_28_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_27_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_26_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_25_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_24_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_23_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_22_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_21_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_20_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_19_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_18_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_17_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_16_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_15_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: unity_14_cxx.cxx:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: ai_functions.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: function_array_aggregation.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: function_cast_decimal.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: function_bitmap_variadic.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: function_date_or_datetime_computation.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: function_datetime_floor_ceil.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: function_jsonb_transform.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: function_string_misc.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: function_variant_element.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: in.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: minus.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: multiply.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: plus.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: round.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: uuid.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: arrow_row_batch.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: arrow_stream_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: csv_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: new_plain_binary_line_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: jni_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: new_json_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: native_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vorc_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: column_type_convert.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vparquet_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: schema_desc.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vparquet_group_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vparquet_column_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vparquet_column_chunk_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vparquet_page_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: parquet_column_convert.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vparquet_page_index.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: parquet_block_split_bloom_filter.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: es_http_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: es_scroll_parser.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: hive_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: hive_orc_nested_column_utils.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: hudi_jni_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: hudi_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: iceberg_delete_file_reader_helper.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: deletion_vector_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: iceberg_position_delete_sys_table_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: iceberg_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: iceberg_orc_nested_column_utils.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: equality_delete.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: iceberg_sys_table_jni_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: jdbc_jni_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: max_compute_jni_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: paimon_cpp_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: paimon_jni_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: paimon_predicate_converter.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: paimon_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: parquet_metadata_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: parquet_utils.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: remote_doris_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: table_format_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: table_schema_change_helper.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: transactional_hive_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: trino_connector_jni_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: text_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: merge_partitioner.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: iceberg_partition_function.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vcsv_transformer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vfile_format_transformer_factory.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vjni_format_transformer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vnative_transformer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vorc_transformer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vparquet_transformer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: column_mapper.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: column_mapper_nested.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cast.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: iceberg_sys_table_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: delete_predicate.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: jdbc_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: jni_table_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: adbc_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: materialized_reader_util.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: parquet_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: parquet_file_context.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: native_schema_desc.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: column_chunk_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: page_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: parquet_scan.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: parquet_statistics.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: native_column_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: column_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: count_column_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: level_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: orc_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: orc_search_argument.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: equality_delete_predicate.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: table_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: json_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: wal_table_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: wal_reader.cpp:_ZN5dorisL14thread_contextEv
cached_remote_file_reader.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
14
static ThreadContext* thread_context() {
269
14
    if (pthread_context_ptr_init) {
270
        // in pthread
271
14
        DCHECK(bthread_self() == 0);
272
14
        DCHECK(thread_context_ptr != nullptr);
273
14
        return thread_context_ptr;
274
14
    }
275
0
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
0
        return bthread_context;
281
0
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
0
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
0
}
Unexecuted instantiation: block_file_cache_ttl_mgr.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cache_block_meta_store.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: block_file_cache_factory.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: fs_file_cache_storage.cpp:_ZN5dorisL14thread_contextEv
peer_file_cache_reader.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
39
static ThreadContext* thread_context() {
269
39
    if (pthread_context_ptr_init) {
270
        // in pthread
271
23
        DCHECK(bthread_self() == 0);
272
23
        DCHECK(thread_context_ptr != nullptr);
273
23
        return thread_context_ptr;
274
23
    }
275
16
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
16
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
16
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
16
        return bthread_context;
281
16
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
0
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
16
}
file_factory.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
278k
static ThreadContext* thread_context() {
269
278k
    if (pthread_context_ptr_init) {
270
        // in pthread
271
278k
        DCHECK(bthread_self() == 0);
272
278k
        DCHECK(thread_context_ptr != nullptr);
273
278k
        return thread_context_ptr;
274
278k
    }
275
18.4E
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
0
        return bthread_context;
281
0
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
18.4E
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
18.4E
}
buffered_reader.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
121
static ThreadContext* thread_context() {
269
121
    if (pthread_context_ptr_init) {
270
        // in pthread
271
121
        DCHECK(bthread_self() == 0);
272
121
        DCHECK(thread_context_ptr != nullptr);
273
121
        return thread_context_ptr;
274
121
    }
275
0
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
0
        return bthread_context;
281
0
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
0
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
0
}
Unexecuted instantiation: file_meta_cache.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: file_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: file_system.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: hdfs_file_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: hdfs_file_system.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: local_file_system.cpp:_ZN5dorisL14thread_contextEv
local_file_reader.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
2.54M
static ThreadContext* thread_context() {
269
2.54M
    if (pthread_context_ptr_init) {
270
        // in pthread
271
2.54M
        DCHECK(bthread_self() == 0);
272
2.54M
        DCHECK(thread_context_ptr != nullptr);
273
2.54M
        return thread_context_ptr;
274
2.54M
    }
275
18.4E
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
0
        return bthread_context;
281
0
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
18.4E
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
18.4E
}
Unexecuted instantiation: remote_file_system.cpp:_ZN5dorisL14thread_contextEv
s3_file_reader.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
255k
static ThreadContext* thread_context() {
269
255k
    if (pthread_context_ptr_init) {
270
        // in pthread
271
255k
        DCHECK(bthread_self() == 0);
272
255k
        DCHECK(thread_context_ptr != nullptr);
273
255k
        return thread_context_ptr;
274
255k
    }
275
2
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
0
        return bthread_context;
281
0
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
2
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
2
}
Unexecuted instantiation: s3_file_system.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: s3_file_bufferpool.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: stream_load_pipe.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: stream_sink_file_writer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: packed_file_manager.cpp:_ZN5dorisL14thread_contextEv
page_cache.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
1.51M
static ThreadContext* thread_context() {
269
1.51M
    if (pthread_context_ptr_init) {
270
        // in pthread
271
1.51M
        DCHECK(bthread_self() == 0);
272
1.51M
        DCHECK(thread_context_ptr != nullptr);
273
1.51M
        return thread_context_ptr;
274
1.51M
    }
275
18.4E
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
0
        return bthread_context;
281
0
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
18.4E
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
18.4E
}
Unexecuted instantiation: collection_statistics.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_dir.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: delete_handler.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: inverted_index_compound_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: inverted_index_fs_directory.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: block_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vcollect_iterator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: key_coder.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: olap_scan_common.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: olap_server.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cumulative_compaction_policy.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cumulative_compaction_time_series_policy.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cumulative_compaction_binlog_policy.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: compaction.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: merger.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vertical_block_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vertical_merge_iterator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cold_data_compaction.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: block_column_predicate.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: null_predicate.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: predicate_creator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: predicate_creator_comparison.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: predicate_creator_in_list_in.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: predicate_creator_in_list_not_in.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: predicate_collector.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: row_cursor.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: beta_rowset.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: beta_rowset_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vgeneric_iterators.cpp:_ZN5dorisL14thread_contextEv
beta_rowset_writer.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
19.9k
static ThreadContext* thread_context() {
269
19.9k
    if (pthread_context_ptr_init) {
270
        // in pthread
271
19.9k
        DCHECK(bthread_self() == 0);
272
19.9k
        DCHECK(thread_context_ptr != nullptr);
273
19.9k
        return thread_context_ptr;
274
19.9k
    }
275
5
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
0
        return bthread_context;
281
0
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
5
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
5
}
calc_delete_bitmap_executor.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
6.06k
static ThreadContext* thread_context() {
269
6.06k
    if (pthread_context_ptr_init) {
270
        // in pthread
271
6.06k
        DCHECK(bthread_self() == 0);
272
6.06k
        DCHECK(thread_context_ptr != nullptr);
273
6.06k
        return thread_context_ptr;
274
6.06k
    }
275
0
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
0
        return bthread_context;
281
0
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
0
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
0
}
Unexecuted instantiation: rowset.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: rowset_factory.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: group_rowset_writer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: rowset_meta.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: rowset_meta_manager.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: segcompaction.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: segment_creator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vertical_beta_rowset_writer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: rowset_version_mgr.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: schema.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: schema_change.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: binary_dict_page.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: bitshuffle_page.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: zone_map_index.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: condition_cache.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: encoding_info.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: lazy_init_segment_iterator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: page_io.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: row_binlog_segment_writer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: historical_row_retriever.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: row_key_encoder.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: key_probe.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: historical_row_fetcher.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: partial_update_info.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: olap_data_convertor.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: column_writer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: segment.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: column_meta_accessor.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: external_col_meta_util.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: empty_segment_iterator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: column_reader_cache.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: segment_index_file_cache_loader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: segment_iterator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: like_column_predicate.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: segment_loader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: segment_prefetcher.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: segment_writer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: nested_group_provider.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: variant_column_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: binary_column_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: hierarchical_data_iterator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: variant_storage_cell.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: stream_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: sparse_column_merge_iterator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: binary_column_extract_iterator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: variant_column_writer_impl.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: variant_path_builder.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: variant_shredder.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: nested_group_routing_plan.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: variant_column_writer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: variant_ext_meta_writer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: variant_external_meta_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: variant_streaming_compaction_writer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: nested_group_streaming_write_plan.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: variant_writer_helpers.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: variant_stats_calculator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: vertical_segment_writer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: virtual_column_iterator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: snapshot_manager.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: storage_engine.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: storage_policy.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: base_tablet.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: delete_bitmap_calculator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: tablet.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cumulative_compaction.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: base_compaction.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: full_compaction.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: tablet_manager.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: tablet_meta.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: tablet_meta_manager.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: tablet_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: tablet_schema.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: tablet_column_object_pool.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: tablet_schema_cache.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: tablet_info.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: engine_batch_load_task.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: engine_checksum_task.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: engine_clone_task.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: engine_cloud_index_change_task.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: engine_index_change_task.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: engine_publish_version_task.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: engine_storage_migration_task.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: index_builder.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: block_transform.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: partial_update_fill.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: transform_util.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: txn_manager.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: types.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: version_graph.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: descriptors.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: exec_env.cpp:_ZN5dorisL14thread_contextEv
exec_env_init.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
7
static ThreadContext* thread_context() {
269
7
    if (pthread_context_ptr_init) {
270
        // in pthread
271
7
        DCHECK(bthread_self() == 0);
272
7
        DCHECK(thread_context_ptr != nullptr);
273
7
        return thread_context_ptr;
274
7
    }
275
0
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
0
        return bthread_context;
281
0
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
0
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
0
}
Unexecuted instantiation: ann_index_ivf_list_cache.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: external_scan_context_mgr.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: fragment_mgr.cpp:_ZN5dorisL14thread_contextEv
global_memory_arbitrator.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
70.4M
static ThreadContext* thread_context() {
269
70.4M
    if (pthread_context_ptr_init) {
270
        // in pthread
271
70.4M
        DCHECK(bthread_self() == 0);
272
70.4M
        DCHECK(thread_context_ptr != nullptr);
273
70.4M
        return thread_context_ptr;
274
70.4M
    }
275
9.74k
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
0
        return bthread_context;
281
0
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
9.74k
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
9.74k
}
Unexecuted instantiation: mem_tracker_limiter.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: memory_profile.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: query_cache.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: query_context.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: result_block_buffer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: record_batch_queue.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: runtime_predicate.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: runtime_state.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: snapshot_loader.cpp:_ZN5dorisL14thread_contextEv
thread_context.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
56.0M
static ThreadContext* thread_context() {
269
56.0M
    if (pthread_context_ptr_init) {
270
        // in pthread
271
51.3M
        DCHECK(bthread_self() == 0);
272
51.3M
        DCHECK(thread_context_ptr != nullptr);
273
51.3M
        return thread_context_ptr;
274
51.3M
    }
275
4.69M
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
4.69M
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
4.69M
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
4.69M
        return bthread_context;
281
4.69M
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
18.4E
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
4.65M
}
Unexecuted instantiation: cloud_plugin_downloader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: workload_group.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: workload_group_manager.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: query_task_controller.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: workload_action.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: workload_sched_policy_mgr.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: backend_service.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: internal_service.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: fold_constant_executor.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: point_query_executor.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: be_server_starter_factory.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: http_service.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: heartbeat_server.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: arrow_flight_batch_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: python_server.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: python_udf_runtime.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: block_compression.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: date_func.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: path_in_data.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: serialize.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: mysql_row_buffer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: obj_lru_cache.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: s3_util.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: thread.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: thrift_util.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: load_channel_mgr.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: load_channel.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: load_stream_mgr.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: load_stream.cpp:_ZN5dorisL14thread_contextEv
load_stream_writer.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
784
static ThreadContext* thread_context() {
269
784
    if (pthread_context_ptr_init) {
270
        // in pthread
271
0
        DCHECK(bthread_self() == 0);
272
0
        DCHECK(thread_context_ptr != nullptr);
273
0
        return thread_context_ptr;
274
0
    }
275
784
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
784
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
784
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
784
        return bthread_context;
281
784
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
0
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
784
}
Unexecuted instantiation: rowset_builder.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: tablets_channel.cpp:_ZN5dorisL14thread_contextEv
delta_writer.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
106k
static ThreadContext* thread_context() {
269
106k
    if (pthread_context_ptr_init) {
270
        // in pthread
271
163
        DCHECK(bthread_self() == 0);
272
163
        DCHECK(thread_context_ptr != nullptr);
273
163
        return thread_context_ptr;
274
163
    }
275
106k
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
106k
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
106k
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
106k
        return bthread_context;
281
106k
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
18.4E
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
106k
}
Unexecuted instantiation: delta_writer_v2.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: beta_rowset_writer_v2.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: push_handler.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: group_commit_mgr.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: wal_manager.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: wal_table.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: wal_writer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: memtable.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: memtable_flush_executor.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: memtable_memory_limiter.cpp:_ZN5dorisL14thread_contextEv
memtable_writer.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
54.4k
static ThreadContext* thread_context() {
269
54.4k
    if (pthread_context_ptr_init) {
270
        // in pthread
271
300
        DCHECK(bthread_self() == 0);
272
300
        DCHECK(thread_context_ptr != nullptr);
273
300
        return thread_context_ptr;
274
300
    }
275
54.1k
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
54.1k
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
54.1k
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
54.1k
        return bthread_context;
281
54.1k
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
18.4E
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
54.1k
}
Unexecuted instantiation: message_body_sink.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: routine_load_task_executor.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_consumer_pool.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_consumer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: data_consumer_group.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: multi_table_pipe.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: stream_load_context.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: stream_load_executor.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: stream_load_recorder_manager.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_backend_service.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: block_file_cache_downloader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_cluster_info.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_compaction_action.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_delete_task.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_engine_calc_delete_bitmap_task.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_index_change_compaction.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_internal_service.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_meta_mgr.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_committed_rs_mgr.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_rowset_writer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_schema_change_job.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_snapshot_loader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_snapshot_mgr.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_storage_engine.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_cumulative_compaction.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_full_compaction.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_base_compaction.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_compaction_stop_token.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_cumulative_compaction_policy.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_cumulative_compaction_binlog_policy.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_stream_load_executor.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_tablet.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_tablet_hotspot.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_tablet_mgr.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_tablets_channel.cpp:_ZN5dorisL14thread_contextEv
cloud_delta_writer.cpp:_ZN5dorisL14thread_contextEv
Line
Count
Source
268
268k
static ThreadContext* thread_context() {
269
268k
    if (pthread_context_ptr_init) {
270
        // in pthread
271
268k
        DCHECK(bthread_self() == 0);
272
268k
        DCHECK(thread_context_ptr != nullptr);
273
268k
        return thread_context_ptr;
274
268k
    }
275
18.4E
    if (bthread_self() != 0) {
276
        // in bthread
277
        // bthread switching pthread may be very frequent, remember not to use lock or other time-consuming operations.
278
0
        auto* bthread_context = static_cast<ThreadContext*>(bthread_getspecific(btls_key));
279
0
        DCHECK(bthread_context != nullptr && bthread_context->thread_local_handle_count > 0);
280
0
        return bthread_context;
281
0
    }
282
    // It means that use thread_context() but this thread not attached a query/load using SCOPED_ATTACH_TASK macro.
283
18.4E
    throw Exception(Status::FatalError("{}", doris::NO_THREAD_CONTEXT_MSG));
284
18.4E
}
Unexecuted instantiation: cloud_rowset_builder.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_txn_delete_bitmap_cache.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: cloud_warm_up_manager.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: delete_bitmap_file_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: delete_bitmap_file_writer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: ann_index.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: ann_index_iterator.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: ann_index_reader.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: ann_index_result_cache.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: ann_index_writer.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: ann_topn_runtime.cpp:_ZN5dorisL14thread_contextEv
Unexecuted instantiation: faiss_ann_index.cpp:_ZN5dorisL14thread_contextEv
285
286
class ScopedPeakMem {
287
public:
288
    explicit ScopedPeakMem(int64_t* peak_mem)
289
754k
            : _peak_mem(peak_mem),
290
754k
              _mem_tracker("ScopedPeakMem:" + UniqueId::gen_uid().to_string()) {
291
754k
        ThreadLocalHandle::create_thread_local_if_not_exits();
292
754k
        thread_context()->thread_mem_tracker_mgr->push_consumer_tracker(&_mem_tracker);
293
754k
    }
294
295
754k
    ~ScopedPeakMem() {
296
754k
        thread_context()->thread_mem_tracker_mgr->pop_consumer_tracker();
297
754k
        *_peak_mem += _mem_tracker.peak_consumption();
298
754k
        ThreadLocalHandle::del_thread_local_if_count_is_zero();
299
754k
    }
300
301
private:
302
    int64_t* _peak_mem;
303
    MemTracker _mem_tracker;
304
};
305
306
// only hold thread context in scope.
307
class ScopedInitThreadContext {
308
public:
309
481
    explicit ScopedInitThreadContext() { ThreadLocalHandle::create_thread_local_if_not_exits(); }
310
311
472
    ~ScopedInitThreadContext() { ThreadLocalHandle::del_thread_local_if_count_is_zero(); }
312
};
313
314
class AttachTask {
315
public:
316
    // you must use ResourceCtx or MemTracker initialization.
317
    explicit AttachTask() = delete;
318
319
    explicit AttachTask(const std::shared_ptr<ResourceContext>& rc);
320
321
    // Shortcut attach task, initialize an empty resource context, and set the memory tracker.
322
    explicit AttachTask(const std::shared_ptr<MemTrackerLimiter>& mem_tracker);
323
324
    // is query or load, initialize with memory tracker, query id and workload group wptr.
325
    explicit AttachTask(RuntimeState* runtime_state);
326
327
    explicit AttachTask(QueryContext* query_ctx);
328
329
    void init(const std::shared_ptr<ResourceContext>& rc);
330
331
    ~AttachTask();
332
};
333
334
class SwitchResourceContext {
335
public:
336
    explicit SwitchResourceContext(const std::shared_ptr<ResourceContext>& rc);
337
338
    ~SwitchResourceContext();
339
340
private:
341
    std::shared_ptr<ResourceContext> old_resource_ctx_ {nullptr};
342
};
343
344
class SwitchThreadMemTrackerLimiter {
345
public:
346
    explicit SwitchThreadMemTrackerLimiter(
347
            const std::shared_ptr<doris::MemTrackerLimiter>& mem_tracker);
348
349
    ~SwitchThreadMemTrackerLimiter();
350
351
private:
352
    bool is_switched_ {false};
353
};
354
355
class AddThreadMemTrackerConsumer {
356
public:
357
    // The owner and user of MemTracker are in the same thread, and the raw pointer is faster.
358
    // If mem_tracker is nullptr, do nothing.
359
    explicit AddThreadMemTrackerConsumer(MemTracker* mem_tracker);
360
361
    // The owner and user of MemTracker are in different threads. If mem_tracker is nullptr, do nothing.
362
    explicit AddThreadMemTrackerConsumer(const std::shared_ptr<MemTracker>& mem_tracker);
363
364
    ~AddThreadMemTrackerConsumer();
365
366
private:
367
    std::shared_ptr<MemTracker> _mem_tracker; // Avoid mem_tracker being released midway.
368
    bool _need_pop = false;
369
};
370
371
class ScopeSkipMemoryCheck {
372
public:
373
24.4M
    explicit ScopeSkipMemoryCheck() {
374
24.4M
        ThreadLocalHandle::create_thread_local_if_not_exits();
375
24.4M
        doris::thread_context()->thread_mem_tracker_mgr->skip_memory_check++;
376
24.4M
    }
377
378
24.5M
    ~ScopeSkipMemoryCheck() {
379
24.5M
        doris::thread_context()->thread_mem_tracker_mgr->skip_memory_check--;
380
24.5M
        ThreadLocalHandle::del_thread_local_if_count_is_zero();
381
24.5M
    }
382
};
383
384
// Basic macros for mem tracker, usually do not need to be modified and used.
385
// must call create_thread_local_if_not_exits() before use thread_context().
386
#define CONSUME_THREAD_MEM_TRACKER(size)                                                           \
387
141M
    do {                                                                                           \
388
141M
        if (size == 0) {                                                                           \
389
226k
            break;                                                                                 \
390
226k
        }                                                                                          \
391
141M
        if (doris::pthread_context_ptr_init) {                                                     \
392
141M
            DCHECK(bthread_self() == 0);                                                           \
393
141M
            doris::thread_context_ptr->thread_mem_tracker_mgr->consume(size);                      \
394
141M
        } else if (bthread_self() != 0) {                                                          \
395
1.53k
            auto* bthread_context =                                                                \
396
1.53k
                    static_cast<doris::ThreadContext*>(bthread_getspecific(doris::btls_key));      \
397
1.53k
            DCHECK(bthread_context != nullptr);                                                    \
398
1.53k
            if (bthread_context != nullptr) {                                                      \
399
1.53k
                bthread_context->thread_mem_tracker_mgr->consume(size);                            \
400
1.53k
            } else {                                                                               \
401
0
                doris::ExecEnv::GetInstance()->orphan_mem_tracker()->consume_no_update_peak(size); \
402
0
            }                                                                                      \
403
496k
        } else if (doris::ExecEnv::ready()) {                                                      \
404
0
            DCHECK(doris::k_doris_exit || !doris::config::enable_memory_orphan_check)              \
405
0
                    << doris::NO_THREAD_CONTEXT_MSG;                                               \
406
0
            doris::ExecEnv::GetInstance()->orphan_mem_tracker()->consume_no_update_peak(size);     \
407
0
        }                                                                                          \
408
141M
    } while (0)
409
70.9M
#define RELEASE_THREAD_MEM_TRACKER(size) CONSUME_THREAD_MEM_TRACKER(-size)
410
411
} // namespace doris