Coverage Report

Created: 2025-05-20 19:11

/root/doris/be/src/runtime/exec_env.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 <common/multi_version.h>
21
22
#include <atomic>
23
#include <map>
24
#include <memory>
25
#include <mutex>
26
#include <string>
27
#include <vector>
28
29
#include "common/status.h"
30
#include "olap/memtable_memory_limiter.h"
31
#include "olap/options.h"
32
#include "olap/rowset/segment_v2/inverted_index_writer.h"
33
#include "olap/tablet_fwd.h"
34
#include "pipeline/pipeline_tracing.h"
35
#include "runtime/frontend_info.h" // TODO(zhiqiang): find a way to remove this include header
36
#include "util/threadpool.h"
37
38
namespace orc {
39
class MemoryPool;
40
}
41
namespace arrow {
42
class MemoryPool;
43
}
44
45
namespace doris {
46
namespace vectorized {
47
class VDataStreamMgr;
48
class ScannerScheduler;
49
class SpillStreamManager;
50
class DeltaWriterV2Pool;
51
} // namespace vectorized
52
namespace pipeline {
53
class TaskScheduler;
54
class BlockedTaskScheduler;
55
struct RuntimeFilterTimerQueue;
56
} // namespace pipeline
57
class WorkloadGroupMgr;
58
struct WriteCooldownMetaExecutors;
59
namespace io {
60
class FileCacheFactory;
61
} // namespace io
62
namespace segment_v2 {
63
class InvertedIndexSearcherCache;
64
class InvertedIndexQueryCache;
65
class TmpFileDirs;
66
} // namespace segment_v2
67
68
class WorkloadSchedPolicyMgr;
69
class BfdParser;
70
class BrokerMgr;
71
template <class T>
72
class BrpcClientCache;
73
class ExternalScanContextMgr;
74
class FragmentMgr;
75
class ResultCache;
76
class LoadPathMgr;
77
class NewLoadStreamMgr;
78
class MemTrackerLimiter;
79
class MemTracker;
80
class StorageEngine;
81
class ResultBufferMgr;
82
class ResultQueueMgr;
83
class RuntimeQueryStatisticsMgr;
84
class TMasterInfo;
85
class LoadChannelMgr;
86
class LoadStreamMgr;
87
class LoadStreamMapPool;
88
class StreamLoadExecutor;
89
class RoutineLoadTaskExecutor;
90
class SmallFileMgr;
91
class BlockSpillManager;
92
class BackendServiceClient;
93
class TPaloBrokerServiceClient;
94
class PBackendService_Stub;
95
class PFunctionService_Stub;
96
template <class T>
97
class ClientCache;
98
class HeartbeatFlags;
99
class FrontendServiceClient;
100
class FileMetaCache;
101
class GroupCommitMgr;
102
class TabletSchemaCache;
103
class TabletColumnObjectPool;
104
class UserFunctionCache;
105
class SchemaCache;
106
class StoragePageCache;
107
class SegmentLoader;
108
class LookupConnectionCache;
109
class RowCache;
110
class DummyLRUCache;
111
class CacheManager;
112
class HeapProfiler;
113
class WalManager;
114
class DNSCache;
115
116
inline bool k_doris_exit = false;
117
118
// Execution environment for queries/plan fragments.
119
// Contains all required global structures, and handles to
120
// singleton services. Clients must call StartServices exactly
121
// once to properly initialise service state.
122
class ExecEnv {
123
public:
124
#ifdef CLOUD_MODE
125
    using Engine = CloudStorageEngine; // TODO(plat1ko)
126
#else
127
    using Engine = StorageEngine;
128
#endif
129
130
    // Empty destructor because the compiler-generated one requires full
131
    // declarations for classes in scoped_ptrs.
132
    ~ExecEnv();
133
134
    // Initial exec environment. must call this to init all
135
    [[nodiscard]] static Status init(ExecEnv* env, const std::vector<StorePath>& store_paths,
136
                                     const std::vector<StorePath>& spill_store_paths,
137
                                     const std::set<std::string>& broken_paths);
138
139
    // Stop all threads and delete resources.
140
    void destroy();
141
142
    /// Returns the first created exec env instance. In a normal doris, this is
143
    /// the only instance. In test setups with multiple ExecEnv's per process,
144
    /// we return the most recently created instance.
145
109k
    static ExecEnv* GetInstance() {
146
109k
        static ExecEnv s_exec_env;
147
109k
        return &s_exec_env;
148
109k
    }
149
150
    // Requires ExenEnv ready
151
    static Result<BaseTabletSPtr> get_tablet(int64_t tablet_id);
152
153
887k
    static bool ready() { return _s_ready.load(std::memory_order_acquire); }
154
7
    static bool tracking_memory() { return _s_tracking_memory.load(std::memory_order_acquire); }
155
    const std::string& token() const;
156
0
    ExternalScanContextMgr* external_scan_context_mgr() { return _external_scan_context_mgr; }
157
0
    vectorized::VDataStreamMgr* vstream_mgr() { return _vstream_mgr; }
158
0
    ResultBufferMgr* result_mgr() { return _result_mgr; }
159
1
    ResultQueueMgr* result_queue_mgr() { return _result_queue_mgr; }
160
0
    ClientCache<BackendServiceClient>* client_cache() { return _backend_client_cache; }
161
0
    ClientCache<FrontendServiceClient>* frontend_client_cache() { return _frontend_client_cache; }
162
0
    ClientCache<TPaloBrokerServiceClient>* broker_client_cache() { return _broker_client_cache; }
163
164
0
    pipeline::TaskScheduler* pipeline_task_scheduler() { return _without_group_task_scheduler; }
165
0
    WorkloadGroupMgr* workload_group_mgr() { return _workload_group_manager; }
166
0
    WorkloadSchedPolicyMgr* workload_sched_policy_mgr() { return _workload_sched_mgr; }
167
0
    RuntimeQueryStatisticsMgr* runtime_query_statistics_mgr() {
168
0
        return _runtime_query_statistics_mgr;
169
0
    }
170
171
    // using template to simplify client cache management
172
    template <typename T>
173
    inline ClientCache<T>* get_client_cache() {
174
        return nullptr;
175
    }
176
177
    // Save all MemTrackerLimiters in use.
178
    // Each group corresponds to several MemTrackerLimiters and has a lock.
179
    // Multiple groups are used to reduce the impact of locks.
180
    std::vector<TrackerLimiterGroup> mem_tracker_limiter_pool;
181
    void init_mem_tracker();
182
85
    std::shared_ptr<MemTrackerLimiter> orphan_mem_tracker() { return _orphan_mem_tracker; }
183
21
    MemTrackerLimiter* orphan_mem_tracker_raw() { return _orphan_mem_tracker_raw; }
184
461
    MemTrackerLimiter* details_mem_tracker_set() { return _details_mem_tracker_set.get(); }
185
48.0k
    std::shared_ptr<MemTracker> page_no_cache_mem_tracker() { return _page_no_cache_mem_tracker; }
186
0
    MemTracker* brpc_iobuf_block_memory_tracker() { return _brpc_iobuf_block_memory_tracker.get(); }
187
0
    std::shared_ptr<MemTrackerLimiter> segcompaction_mem_tracker() {
188
0
        return _segcompaction_mem_tracker;
189
0
    }
190
0
    std::shared_ptr<MemTrackerLimiter> stream_load_pipe_tracker() {
191
0
        return _stream_load_pipe_tracker;
192
0
    }
193
0
    std::shared_ptr<MemTrackerLimiter> point_query_executor_mem_tracker() {
194
0
        return _point_query_executor_mem_tracker;
195
0
    }
196
0
    std::shared_ptr<MemTrackerLimiter> block_compression_mem_tracker() {
197
0
        return _block_compression_mem_tracker;
198
0
    }
199
0
    std::shared_ptr<MemTrackerLimiter> rowid_storage_reader_tracker() {
200
0
        return _rowid_storage_reader_tracker;
201
0
    }
202
0
    std::shared_ptr<MemTrackerLimiter> subcolumns_tree_tracker() {
203
0
        return _subcolumns_tree_tracker;
204
0
    }
205
0
    std::shared_ptr<MemTrackerLimiter> s3_file_buffer_tracker() { return _s3_file_buffer_tracker; }
206
16
    std::shared_ptr<MemTrackerLimiter> parquet_meta_tracker() { return _parquet_meta_tracker; }
207
208
5
    ThreadPool* send_batch_thread_pool() { return _send_batch_thread_pool.get(); }
209
4
    ThreadPool* buffered_reader_prefetch_thread_pool() {
210
4
        return _buffered_reader_prefetch_thread_pool.get();
211
4
    }
212
0
    ThreadPool* s3_file_upload_thread_pool() { return _s3_file_upload_thread_pool.get(); }
213
0
    ThreadPool* send_report_thread_pool() { return _send_report_thread_pool.get(); }
214
0
    ThreadPool* join_node_thread_pool() { return _join_node_thread_pool.get(); }
215
0
    ThreadPool* lazy_release_obj_pool() { return _lazy_release_obj_pool.get(); }
216
217
    Status init_pipeline_task_scheduler();
218
    void init_file_cache_factory(std::vector<doris::CachePath>& cache_paths);
219
0
    io::FileCacheFactory* file_cache_factory() { return _file_cache_factory; }
220
0
    UserFunctionCache* user_function_cache() { return _user_function_cache; }
221
1
    FragmentMgr* fragment_mgr() { return _fragment_mgr; }
222
0
    ResultCache* result_cache() { return _result_cache; }
223
25
    TMasterInfo* master_info() { return _master_info; }
224
1
    LoadPathMgr* load_path_mgr() { return _load_path_mgr; }
225
1
    BfdParser* bfd_parser() const { return _bfd_parser; }
226
0
    BrokerMgr* broker_mgr() const { return _broker_mgr; }
227
25
    BrpcClientCache<PBackendService_Stub>* brpc_internal_client_cache() const {
228
25
        return _internal_client_cache;
229
25
    }
230
0
    BrpcClientCache<PBackendService_Stub>* brpc_streaming_client_cache() const {
231
0
        return _streaming_client_cache;
232
0
    }
233
0
    BrpcClientCache<PFunctionService_Stub>* brpc_function_client_cache() const {
234
0
        return _function_client_cache;
235
0
    }
236
0
    LoadChannelMgr* load_channel_mgr() { return _load_channel_mgr; }
237
0
    LoadStreamMgr* load_stream_mgr() { return _load_stream_mgr.get(); }
238
5
    std::shared_ptr<NewLoadStreamMgr> new_load_stream_mgr() { return _new_load_stream_mgr; }
239
0
    SmallFileMgr* small_file_mgr() { return _small_file_mgr; }
240
7
    BlockSpillManager* block_spill_mgr() { return _block_spill_mgr; }
241
0
    doris::vectorized::SpillStreamManager* spill_stream_mgr() { return _spill_stream_mgr; }
242
0
    GroupCommitMgr* group_commit_mgr() { return _group_commit_mgr; }
243
244
2
    const std::vector<StorePath>& store_paths() const { return _store_paths; }
245
246
1
    std::shared_ptr<StreamLoadExecutor> stream_load_executor() { return _stream_load_executor; }
247
0
    RoutineLoadTaskExecutor* routine_load_task_executor() { return _routine_load_task_executor; }
248
0
    HeartbeatFlags* heartbeat_flags() { return _heartbeat_flags; }
249
0
    vectorized::ScannerScheduler* scanner_scheduler() { return _scanner_scheduler; }
250
0
    FileMetaCache* file_meta_cache() { return _file_meta_cache; }
251
12
    MemTableMemoryLimiter* memtable_memory_limiter() { return _memtable_memory_limiter.get(); }
252
62
    WalManager* wal_mgr() { return _wal_manager.get(); }
253
19
    DNSCache* dns_cache() { return _dns_cache; }
254
5
    WriteCooldownMetaExecutors* write_cooldown_meta_executors() {
255
5
        return _write_cooldown_meta_executors.get();
256
5
    }
257
258
#ifdef BE_TEST
259
29
    void set_tmp_file_dir(std::unique_ptr<segment_v2::TmpFileDirs> tmp_file_dirs) {
260
29
        this->_tmp_file_dirs = std::move(tmp_file_dirs);
261
29
    }
262
4
    void set_ready() { this->_s_ready = true; }
263
0
    void set_not_ready() { this->_s_ready = false; }
264
10
    void set_memtable_memory_limiter(MemTableMemoryLimiter* limiter) {
265
10
        _memtable_memory_limiter.reset(limiter);
266
10
    }
267
1
    void set_master_info(TMasterInfo* master_info) { this->_master_info = master_info; }
268
1
    void set_new_load_stream_mgr(std::shared_ptr<NewLoadStreamMgr> new_load_stream_mgr) {
269
1
        this->_new_load_stream_mgr = new_load_stream_mgr;
270
1
    }
271
1
    void set_stream_load_executor(std::shared_ptr<StreamLoadExecutor> stream_load_executor) {
272
1
        this->_stream_load_executor = stream_load_executor;
273
1
    }
274
275
197
    void set_storage_engine(StorageEngine* se) { this->_storage_engine = se; }
276
1
    void set_cache_manager(CacheManager* cm) { this->_cache_manager = cm; }
277
1
    void set_tablet_schema_cache(TabletSchemaCache* c) { this->_tablet_schema_cache = c; }
278
1
    void set_tablet_column_object_pool(TabletColumnObjectPool* c) {
279
1
        this->_tablet_column_object_pool = c;
280
1
    }
281
1
    void set_storage_page_cache(StoragePageCache* c) { this->_storage_page_cache = c; }
282
1
    void set_segment_loader(SegmentLoader* sl) { this->_segment_loader = sl; }
283
0
    void set_routine_load_task_executor(RoutineLoadTaskExecutor* r) {
284
0
        this->_routine_load_task_executor = r;
285
0
    }
286
2
    void set_wal_mgr(std::shared_ptr<WalManager> wm) { this->_wal_manager = wm; }
287
1
    void set_dummy_lru_cache(std::shared_ptr<DummyLRUCache> dummy_lru_cache) {
288
1
        this->_dummy_lru_cache = dummy_lru_cache;
289
1
    }
290
    void set_write_cooldown_meta_executors();
291
1
    static void set_tracking_memory(bool tracking_memory) {
292
1
        _s_tracking_memory.store(tracking_memory, std::memory_order_acquire);
293
1
    }
294
#endif
295
0
    LoadStreamMapPool* load_stream_map_pool() { return _load_stream_map_pool.get(); }
296
297
0
    vectorized::DeltaWriterV2Pool* delta_writer_v2_pool() { return _delta_writer_v2_pool.get(); }
298
299
    void wait_for_all_tasks_done();
300
301
    void update_frontends(const std::vector<TFrontendInfo>& new_infos);
302
    std::map<TNetworkAddress, FrontendInfo> get_frontends();
303
    std::map<TNetworkAddress, FrontendInfo> get_running_frontends();
304
305
6.24k
    TabletSchemaCache* get_tablet_schema_cache() { return _tablet_schema_cache; }
306
9.92k
    StorageEngine* get_storage_engine() { return _storage_engine; }
307
156
    TabletColumnObjectPool* get_tablet_column_object_pool() { return _tablet_column_object_pool; }
308
0
    SchemaCache* schema_cache() { return _schema_cache; }
309
21.4k
    StoragePageCache* get_storage_page_cache() { return _storage_page_cache; }
310
21.4k
    SegmentLoader* segment_loader() { return _segment_loader; }
311
0
    LookupConnectionCache* get_lookup_connection_cache() { return _lookup_connection_cache; }
312
0
    RowCache* get_row_cache() { return _row_cache; }
313
655
    CacheManager* get_cache_manager() { return _cache_manager; }
314
0
    HeapProfiler* get_heap_profiler() { return _heap_profiler; }
315
26
    segment_v2::InvertedIndexSearcherCache* get_inverted_index_searcher_cache() {
316
26
        return _inverted_index_searcher_cache;
317
26
    }
318
28
    segment_v2::InvertedIndexQueryCache* get_inverted_index_query_cache() {
319
28
        return _inverted_index_query_cache;
320
28
    }
321
8
    std::shared_ptr<DummyLRUCache> get_dummy_lru_cache() { return _dummy_lru_cache; }
322
323
0
    std::shared_ptr<pipeline::BlockedTaskScheduler> get_global_block_scheduler() {
324
0
        return _global_block_scheduler;
325
0
    }
326
327
0
    pipeline::RuntimeFilterTimerQueue* runtime_filter_timer_queue() {
328
0
        return _runtime_filter_timer_queue;
329
0
    }
330
331
0
    pipeline::PipelineTracerContext* pipeline_tracer_context() {
332
0
        return _pipeline_tracer_ctx.get();
333
0
    }
334
335
84
    segment_v2::TmpFileDirs* get_tmp_file_dirs() { return _tmp_file_dirs.get(); }
336
337
0
    orc::MemoryPool* orc_memory_pool() { return _orc_memory_pool; }
338
0
    arrow::MemoryPool* arrow_memory_pool() { return _arrow_memory_pool; }
339
340
private:
341
    ExecEnv();
342
343
    [[nodiscard]] Status _init(const std::vector<StorePath>& store_paths,
344
                               const std::vector<StorePath>& spill_store_paths,
345
                               const std::set<std::string>& broken_paths);
346
    void _destroy();
347
348
    Status _init_mem_env();
349
350
    void _register_metrics();
351
    void _deregister_metrics();
352
353
    inline static std::atomic_bool _s_ready {false};
354
    inline static std::atomic_bool _s_tracking_memory {false};
355
    std::vector<StorePath> _store_paths;
356
    std::vector<StorePath> _spill_store_paths;
357
358
    io::FileCacheFactory* _file_cache_factory = nullptr;
359
    UserFunctionCache* _user_function_cache = nullptr;
360
    // Leave protected so that subclasses can override
361
    ExternalScanContextMgr* _external_scan_context_mgr = nullptr;
362
    vectorized::VDataStreamMgr* _vstream_mgr = nullptr;
363
    ResultBufferMgr* _result_mgr = nullptr;
364
    ResultQueueMgr* _result_queue_mgr = nullptr;
365
    ClientCache<BackendServiceClient>* _backend_client_cache = nullptr;
366
    ClientCache<FrontendServiceClient>* _frontend_client_cache = nullptr;
367
    ClientCache<TPaloBrokerServiceClient>* _broker_client_cache = nullptr;
368
369
    // The default tracker consumed by mem hook. If the thread does not attach other trackers,
370
    // by default all consumption will be passed to the process tracker through the orphan tracker.
371
    // In real time, `consumption of all limiter trackers` + `orphan tracker consumption` = `process tracker consumption`.
372
    // Ideally, all threads are expected to attach to the specified tracker, so that "all memory has its own ownership",
373
    // and the consumption of the orphan mem tracker is close to 0, but greater than 0.
374
    std::shared_ptr<MemTrackerLimiter> _orphan_mem_tracker;
375
    MemTrackerLimiter* _orphan_mem_tracker_raw = nullptr;
376
    std::shared_ptr<MemTrackerLimiter> _details_mem_tracker_set;
377
    // page size not in cache, data page/index page/etc.
378
    std::shared_ptr<MemTracker> _page_no_cache_mem_tracker;
379
    std::shared_ptr<MemTracker> _brpc_iobuf_block_memory_tracker;
380
    // Count the memory consumption of segment compaction tasks.
381
    std::shared_ptr<MemTrackerLimiter> _segcompaction_mem_tracker;
382
    std::shared_ptr<MemTrackerLimiter> _stream_load_pipe_tracker;
383
384
    // Tracking memory may be shared between multiple queries.
385
    std::shared_ptr<MemTrackerLimiter> _point_query_executor_mem_tracker;
386
    std::shared_ptr<MemTrackerLimiter> _block_compression_mem_tracker;
387
388
    // TODO, looking forward to more accurate tracking.
389
    std::shared_ptr<MemTrackerLimiter> _rowid_storage_reader_tracker;
390
    std::shared_ptr<MemTrackerLimiter> _subcolumns_tree_tracker;
391
    std::shared_ptr<MemTrackerLimiter> _s3_file_buffer_tracker;
392
393
    // Tracking memory consumption of parquet meta
394
    std::shared_ptr<MemTrackerLimiter> _parquet_meta_tracker;
395
396
    std::unique_ptr<ThreadPool> _send_batch_thread_pool;
397
    // Threadpool used to prefetch remote file for buffered reader
398
    std::unique_ptr<ThreadPool> _buffered_reader_prefetch_thread_pool;
399
    // Threadpool used to upload local file to s3
400
    std::unique_ptr<ThreadPool> _s3_file_upload_thread_pool;
401
    // Pool used by fragment manager to send profile or status to FE coordinator
402
    std::unique_ptr<ThreadPool> _send_report_thread_pool;
403
    // Pool used by join node to build hash table
404
    std::unique_ptr<ThreadPool> _join_node_thread_pool;
405
    // Pool to use a new thread to release object
406
    std::unique_ptr<ThreadPool> _lazy_release_obj_pool;
407
408
    FragmentMgr* _fragment_mgr = nullptr;
409
    pipeline::TaskScheduler* _without_group_task_scheduler = nullptr;
410
    WorkloadGroupMgr* _workload_group_manager = nullptr;
411
412
    ResultCache* _result_cache = nullptr;
413
    TMasterInfo* _master_info = nullptr;
414
    LoadPathMgr* _load_path_mgr = nullptr;
415
416
    BfdParser* _bfd_parser = nullptr;
417
    BrokerMgr* _broker_mgr = nullptr;
418
    LoadChannelMgr* _load_channel_mgr = nullptr;
419
    std::unique_ptr<LoadStreamMgr> _load_stream_mgr;
420
    // TODO(zhiqiang): Do not use shared_ptr in exec_env, we can not control its life cycle.
421
    std::shared_ptr<NewLoadStreamMgr> _new_load_stream_mgr;
422
    BrpcClientCache<PBackendService_Stub>* _internal_client_cache = nullptr;
423
    BrpcClientCache<PBackendService_Stub>* _streaming_client_cache = nullptr;
424
    BrpcClientCache<PFunctionService_Stub>* _function_client_cache = nullptr;
425
426
    std::shared_ptr<StreamLoadExecutor> _stream_load_executor;
427
    RoutineLoadTaskExecutor* _routine_load_task_executor = nullptr;
428
    SmallFileMgr* _small_file_mgr = nullptr;
429
    HeartbeatFlags* _heartbeat_flags = nullptr;
430
    vectorized::ScannerScheduler* _scanner_scheduler = nullptr;
431
432
    BlockSpillManager* _block_spill_mgr = nullptr;
433
    // To save meta info of external file, such as parquet footer.
434
    FileMetaCache* _file_meta_cache = nullptr;
435
    std::unique_ptr<MemTableMemoryLimiter> _memtable_memory_limiter;
436
    std::unique_ptr<LoadStreamMapPool> _load_stream_map_pool;
437
    std::unique_ptr<vectorized::DeltaWriterV2Pool> _delta_writer_v2_pool;
438
    std::shared_ptr<WalManager> _wal_manager;
439
    DNSCache* _dns_cache = nullptr;
440
    std::unique_ptr<WriteCooldownMetaExecutors> _write_cooldown_meta_executors;
441
442
    std::mutex _frontends_lock;
443
    // ip:brpc_port -> frontend_indo
444
    std::map<TNetworkAddress, FrontendInfo> _frontends;
445
    GroupCommitMgr* _group_commit_mgr = nullptr;
446
447
    // Maybe we should use unique_ptr, but it need complete type, which means we need
448
    // to include many headers, and for some cpp file that do not need class like TabletSchemaCache,
449
    // these redundancy header could introduce potential bug, at least, more header means slow compile.
450
    // So we choose to use raw pointer, please remember to delete these pointer in deconstructor.
451
    TabletSchemaCache* _tablet_schema_cache = nullptr;
452
    StorageEngine* _storage_engine = nullptr;
453
    TabletColumnObjectPool* _tablet_column_object_pool = nullptr;
454
    SchemaCache* _schema_cache = nullptr;
455
    StoragePageCache* _storage_page_cache = nullptr;
456
    SegmentLoader* _segment_loader = nullptr;
457
    LookupConnectionCache* _lookup_connection_cache = nullptr;
458
    RowCache* _row_cache = nullptr;
459
    CacheManager* _cache_manager = nullptr;
460
    HeapProfiler* _heap_profiler = nullptr;
461
    segment_v2::InvertedIndexSearcherCache* _inverted_index_searcher_cache = nullptr;
462
    segment_v2::InvertedIndexQueryCache* _inverted_index_query_cache = nullptr;
463
    std::shared_ptr<DummyLRUCache> _dummy_lru_cache = nullptr;
464
465
    // used for query with group cpu hard limit
466
    std::shared_ptr<pipeline::BlockedTaskScheduler> _global_block_scheduler;
467
    // used for query without workload group
468
    std::shared_ptr<pipeline::BlockedTaskScheduler> _without_group_block_scheduler;
469
470
    pipeline::RuntimeFilterTimerQueue* _runtime_filter_timer_queue = nullptr;
471
472
    WorkloadSchedPolicyMgr* _workload_sched_mgr = nullptr;
473
474
    RuntimeQueryStatisticsMgr* _runtime_query_statistics_mgr = nullptr;
475
476
    std::unique_ptr<pipeline::PipelineTracerContext> _pipeline_tracer_ctx;
477
    std::unique_ptr<segment_v2::TmpFileDirs> _tmp_file_dirs;
478
    doris::vectorized::SpillStreamManager* _spill_stream_mgr = nullptr;
479
480
    orc::MemoryPool* _orc_memory_pool = nullptr;
481
    arrow::MemoryPool* _arrow_memory_pool = nullptr;
482
};
483
484
template <>
485
0
inline ClientCache<BackendServiceClient>* ExecEnv::get_client_cache<BackendServiceClient>() {
486
0
    return _backend_client_cache;
487
0
}
488
template <>
489
0
inline ClientCache<FrontendServiceClient>* ExecEnv::get_client_cache<FrontendServiceClient>() {
490
0
    return _frontend_client_cache;
491
0
}
492
template <>
493
inline ClientCache<TPaloBrokerServiceClient>*
494
0
ExecEnv::get_client_cache<TPaloBrokerServiceClient>() {
495
0
    return _broker_client_cache;
496
0
}
497
498
0
inline segment_v2::InvertedIndexQueryCache* GetInvertedIndexQueryCache() {
499
0
    return ExecEnv::GetInstance()->get_inverted_index_query_cache();
500
0
}
501
502
} // namespace doris