/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 "io/cache/fs_file_cache_storage.h" |
31 | | #include "olap/memtable_memory_limiter.h" |
32 | | #include "olap/options.h" |
33 | | #include "olap/rowset/segment_v2/inverted_index_writer.h" |
34 | | #include "olap/tablet_fwd.h" |
35 | | #include "pipeline/pipeline_tracing.h" |
36 | | #include "runtime/cluster_info.h" |
37 | | #include "runtime/frontend_info.h" // TODO(zhiqiang): find a way to remove this include header |
38 | | #include "util/threadpool.h" |
39 | | |
40 | | namespace orc { |
41 | | class MemoryPool; |
42 | | } |
43 | | namespace arrow { |
44 | | class MemoryPool; |
45 | | } |
46 | | |
47 | | namespace doris { |
48 | | namespace vectorized { |
49 | | class VDataStreamMgr; |
50 | | class ScannerScheduler; |
51 | | class SpillStreamManager; |
52 | | class DeltaWriterV2Pool; |
53 | | } // namespace vectorized |
54 | | namespace pipeline { |
55 | | class TaskScheduler; |
56 | | struct RuntimeFilterTimerQueue; |
57 | | } // namespace pipeline |
58 | | class WorkloadGroupMgr; |
59 | | struct WriteCooldownMetaExecutors; |
60 | | namespace io { |
61 | | class FileCacheFactory; |
62 | | } // namespace io |
63 | | namespace segment_v2 { |
64 | | class InvertedIndexSearcherCache; |
65 | | class InvertedIndexQueryCache; |
66 | | class TmpFileDirs; |
67 | | } // namespace segment_v2 |
68 | | |
69 | | class QueryCache; |
70 | | class WorkloadSchedPolicyMgr; |
71 | | class BfdParser; |
72 | | class BrokerMgr; |
73 | | template <class T> |
74 | | class BrpcClientCache; |
75 | | class ExternalScanContextMgr; |
76 | | class FragmentMgr; |
77 | | class ResultCache; |
78 | | class LoadPathMgr; |
79 | | class NewLoadStreamMgr; |
80 | | class MemTrackerLimiter; |
81 | | class MemTracker; |
82 | | struct TrackerLimiterGroup; |
83 | | class BaseStorageEngine; |
84 | | class ResultBufferMgr; |
85 | | class ResultQueueMgr; |
86 | | class RuntimeQueryStatisticsMgr; |
87 | | class LoadChannelMgr; |
88 | | class LoadStreamMgr; |
89 | | class LoadStreamMapPool; |
90 | | class StreamLoadExecutor; |
91 | | class RoutineLoadTaskExecutor; |
92 | | class SmallFileMgr; |
93 | | class BackendServiceClient; |
94 | | class TPaloBrokerServiceClient; |
95 | | class PBackendService_Stub; |
96 | | class PFunctionService_Stub; |
97 | | template <class T> |
98 | | class ClientCache; |
99 | | class HeartbeatFlags; |
100 | | class FrontendServiceClient; |
101 | | class FileMetaCache; |
102 | | class GroupCommitMgr; |
103 | | class TabletSchemaCache; |
104 | | class TabletColumnObjectPool; |
105 | | class UserFunctionCache; |
106 | | class SchemaCache; |
107 | | class StoragePageCache; |
108 | | class SegmentLoader; |
109 | | class LookupConnectionCache; |
110 | | class RowCache; |
111 | | class DummyLRUCache; |
112 | | class CacheManager; |
113 | | class ProcessProfile; |
114 | | class HeapProfiler; |
115 | | class WalManager; |
116 | | class DNSCache; |
117 | | |
118 | | inline bool k_doris_exit = false; |
119 | | |
120 | | // Execution environment for queries/plan fragments. |
121 | | // Contains all required global structures, and handles to |
122 | | // singleton services. Clients must call StartServices exactly |
123 | | // once to properly initialise service state. |
124 | | class ExecEnv { |
125 | | public: |
126 | | // Empty destructor because the compiler-generated one requires full |
127 | | // declarations for classes in scoped_ptrs. |
128 | | ~ExecEnv(); |
129 | | |
130 | 8.38k | BaseStorageEngine& storage_engine() { return *_storage_engine; } |
131 | | |
132 | | // Initial exec environment. must call this to init all |
133 | | [[nodiscard]] static Status init(ExecEnv* env, const std::vector<StorePath>& store_paths, |
134 | | const std::vector<StorePath>& spill_store_paths, |
135 | | const std::set<std::string>& broken_paths); |
136 | | |
137 | | // Stop all threads and delete resources. |
138 | | void destroy(); |
139 | | |
140 | | /// Returns the first created exec env instance. In a normal doris, this is |
141 | | /// the only instance. In test setups with multiple ExecEnv's per process, |
142 | | /// we return the most recently created instance. |
143 | 87.3k | static ExecEnv* GetInstance() { |
144 | 87.3k | static ExecEnv s_exec_env; |
145 | 87.3k | return &s_exec_env; |
146 | 87.3k | } |
147 | | |
148 | | // Requires ExenEnv ready |
149 | | static Result<BaseTabletSPtr> get_tablet(int64_t tablet_id); |
150 | | |
151 | 1.76M | static bool ready() { return _s_ready.load(std::memory_order_acquire); } |
152 | 6 | static bool tracking_memory() { return _s_tracking_memory.load(std::memory_order_acquire); } |
153 | | const std::string& token() const; |
154 | 0 | ExternalScanContextMgr* external_scan_context_mgr() { return _external_scan_context_mgr; } |
155 | 0 | vectorized::VDataStreamMgr* vstream_mgr() { return _vstream_mgr; } |
156 | 0 | ResultBufferMgr* result_mgr() { return _result_mgr; } |
157 | 1 | ResultQueueMgr* result_queue_mgr() { return _result_queue_mgr; } |
158 | 0 | ClientCache<BackendServiceClient>* client_cache() { return _backend_client_cache; } |
159 | 0 | ClientCache<FrontendServiceClient>* frontend_client_cache() { return _frontend_client_cache; } |
160 | 0 | ClientCache<TPaloBrokerServiceClient>* broker_client_cache() { return _broker_client_cache; } |
161 | | |
162 | 0 | pipeline::TaskScheduler* pipeline_task_scheduler() { return _without_group_task_scheduler; } |
163 | 0 | WorkloadGroupMgr* workload_group_mgr() { return _workload_group_manager; } |
164 | 0 | WorkloadSchedPolicyMgr* workload_sched_policy_mgr() { return _workload_sched_mgr; } |
165 | 0 | RuntimeQueryStatisticsMgr* runtime_query_statistics_mgr() { |
166 | 0 | return _runtime_query_statistics_mgr; |
167 | 0 | } |
168 | | |
169 | | // using template to simplify client cache management |
170 | | template <typename T> |
171 | | inline ClientCache<T>* get_client_cache() { |
172 | | return nullptr; |
173 | | } |
174 | | |
175 | | // Save all MemTrackerLimiters in use. |
176 | | // Each group corresponds to several MemTrackerLimiters and has a lock. |
177 | | // Multiple groups are used to reduce the impact of locks. |
178 | | std::vector<TrackerLimiterGroup> mem_tracker_limiter_pool; |
179 | | void init_mem_tracker(); |
180 | 77 | std::shared_ptr<MemTrackerLimiter> orphan_mem_tracker() { return _orphan_mem_tracker; } |
181 | 48.2k | std::shared_ptr<MemTracker> page_no_cache_mem_tracker() { return _page_no_cache_mem_tracker; } |
182 | 0 | std::shared_ptr<MemTrackerLimiter> brpc_iobuf_block_memory_tracker() { |
183 | 0 | return _brpc_iobuf_block_memory_tracker; |
184 | 0 | } |
185 | 0 | std::shared_ptr<MemTrackerLimiter> segcompaction_mem_tracker() { |
186 | 0 | return _segcompaction_mem_tracker; |
187 | 0 | } |
188 | 0 | std::shared_ptr<MemTrackerLimiter> stream_load_pipe_tracker() { |
189 | 0 | return _stream_load_pipe_tracker; |
190 | 0 | } |
191 | 0 | std::shared_ptr<MemTrackerLimiter> point_query_executor_mem_tracker() { |
192 | 0 | return _point_query_executor_mem_tracker; |
193 | 0 | } |
194 | 0 | std::shared_ptr<MemTrackerLimiter> query_cache_mem_tracker() { |
195 | 0 | return _query_cache_mem_tracker; |
196 | 0 | } |
197 | 0 | std::shared_ptr<MemTrackerLimiter> block_compression_mem_tracker() { |
198 | 0 | return _block_compression_mem_tracker; |
199 | 0 | } |
200 | 0 | std::shared_ptr<MemTrackerLimiter> rowid_storage_reader_tracker() { |
201 | 0 | return _rowid_storage_reader_tracker; |
202 | 0 | } |
203 | 0 | std::shared_ptr<MemTrackerLimiter> subcolumns_tree_tracker() { |
204 | 0 | return _subcolumns_tree_tracker; |
205 | 0 | } |
206 | 0 | std::shared_ptr<MemTrackerLimiter> s3_file_buffer_tracker() { return _s3_file_buffer_tracker; } |
207 | | |
208 | 0 | 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* send_table_stats_thread_pool() { return _send_table_stats_thread_pool.get(); } |
213 | 14 | ThreadPool* s3_file_upload_thread_pool() { return _s3_file_upload_thread_pool.get(); } |
214 | 0 | ThreadPool* lazy_release_obj_pool() { return _lazy_release_obj_pool.get(); } |
215 | | ThreadPool* non_block_close_thread_pool(); |
216 | 0 | ThreadPool* s3_file_system_thread_pool() { return _s3_file_system_thread_pool.get(); } |
217 | | |
218 | | Status init_pipeline_task_scheduler(); |
219 | | void init_file_cache_factory(std::vector<doris::CachePath>& cache_paths); |
220 | 72 | io::FileCacheFactory* file_cache_factory() { return _file_cache_factory; } |
221 | 0 | UserFunctionCache* user_function_cache() { return _user_function_cache; } |
222 | 1 | FragmentMgr* fragment_mgr() { return _fragment_mgr; } |
223 | 0 | ResultCache* result_cache() { return _result_cache; } |
224 | 9 | ClusterInfo* cluster_info() { return _cluster_info; } |
225 | 1 | LoadPathMgr* load_path_mgr() { return _load_path_mgr; } |
226 | 1 | BfdParser* bfd_parser() const { return _bfd_parser; } |
227 | 0 | BrokerMgr* broker_mgr() const { return _broker_mgr; } |
228 | 0 | BrpcClientCache<PBackendService_Stub>* brpc_internal_client_cache() const { |
229 | 0 | return _internal_client_cache; |
230 | 0 | } |
231 | 0 | BrpcClientCache<PBackendService_Stub>* brpc_streaming_client_cache() const { |
232 | 0 | return _streaming_client_cache; |
233 | 0 | } |
234 | 0 | BrpcClientCache<PFunctionService_Stub>* brpc_function_client_cache() const { |
235 | 0 | return _function_client_cache; |
236 | 0 | } |
237 | 0 | LoadChannelMgr* load_channel_mgr() { return _load_channel_mgr; } |
238 | 0 | LoadStreamMgr* load_stream_mgr() { return _load_stream_mgr.get(); } |
239 | 5 | std::shared_ptr<NewLoadStreamMgr> new_load_stream_mgr() { return _new_load_stream_mgr; } |
240 | 0 | SmallFileMgr* small_file_mgr() { return _small_file_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 | 1 | 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 | 13 | MemTableMemoryLimiter* memtable_memory_limiter() { return _memtable_memory_limiter.get(); } |
252 | 57 | WalManager* wal_mgr() { return _wal_manager.get(); } |
253 | 4 | 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 | 22 | void set_tmp_file_dir(std::unique_ptr<segment_v2::TmpFileDirs> tmp_file_dirs) { |
260 | 22 | this->_tmp_file_dirs = std::move(tmp_file_dirs); |
261 | 22 | } |
262 | 4 | void set_ready() { this->_s_ready = true; } |
263 | 0 | void set_not_ready() { this->_s_ready = false; } |
264 | 12 | void set_memtable_memory_limiter(MemTableMemoryLimiter* limiter) { |
265 | 12 | _memtable_memory_limiter.reset(limiter); |
266 | 12 | } |
267 | 1 | void set_cluster_info(ClusterInfo* cluster_info) { this->_cluster_info = cluster_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 | | void set_storage_engine(std::unique_ptr<BaseStorageEngine>&& engine); |
276 | | void set_inverted_index_searcher_cache( |
277 | | segment_v2::InvertedIndexSearcherCache* inverted_index_searcher_cache); |
278 | 1 | void set_cache_manager(CacheManager* cm) { this->_cache_manager = cm; } |
279 | 1 | void set_process_profile(ProcessProfile* pp) { this->_process_profile = pp; } |
280 | 1 | void set_tablet_schema_cache(TabletSchemaCache* c) { this->_tablet_schema_cache = c; } |
281 | 1 | void set_tablet_column_object_pool(TabletColumnObjectPool* c) { |
282 | 1 | this->_tablet_column_object_pool = c; |
283 | 1 | } |
284 | 1 | void set_storage_page_cache(StoragePageCache* c) { this->_storage_page_cache = c; } |
285 | 1 | void set_segment_loader(SegmentLoader* sl) { this->_segment_loader = sl; } |
286 | 0 | void set_routine_load_task_executor(RoutineLoadTaskExecutor* r) { |
287 | 0 | this->_routine_load_task_executor = r; |
288 | 0 | } |
289 | 2 | void set_wal_mgr(std::shared_ptr<WalManager> wm) { this->_wal_manager = wm; } |
290 | 1 | void set_dummy_lru_cache(std::shared_ptr<DummyLRUCache> dummy_lru_cache) { |
291 | 1 | this->_dummy_lru_cache = dummy_lru_cache; |
292 | 1 | } |
293 | | void set_write_cooldown_meta_executors(); |
294 | 1 | static void set_tracking_memory(bool tracking_memory) { |
295 | 1 | _s_tracking_memory.store(tracking_memory, std::memory_order_release); |
296 | 1 | } |
297 | | #endif |
298 | 0 | LoadStreamMapPool* load_stream_map_pool() { return _load_stream_map_pool.get(); } |
299 | | |
300 | 0 | vectorized::DeltaWriterV2Pool* delta_writer_v2_pool() { return _delta_writer_v2_pool.get(); } |
301 | | |
302 | | void wait_for_all_tasks_done(); |
303 | | |
304 | | void update_frontends(const std::vector<TFrontendInfo>& new_infos); |
305 | | std::vector<TFrontendInfo> get_frontends(); |
306 | | std::map<TNetworkAddress, FrontendInfo> get_running_frontends(); |
307 | | |
308 | 2.66k | TabletSchemaCache* get_tablet_schema_cache() { return _tablet_schema_cache; } |
309 | 124 | TabletColumnObjectPool* get_tablet_column_object_pool() { return _tablet_column_object_pool; } |
310 | 0 | SchemaCache* schema_cache() { return _schema_cache; } |
311 | 21.5k | StoragePageCache* get_storage_page_cache() { return _storage_page_cache; } |
312 | 1.16k | SegmentLoader* segment_loader() { return _segment_loader; } |
313 | 0 | LookupConnectionCache* get_lookup_connection_cache() { return _lookup_connection_cache; } |
314 | 0 | RowCache* get_row_cache() { return _row_cache; } |
315 | 687 | CacheManager* get_cache_manager() { return _cache_manager; } |
316 | 0 | ProcessProfile* get_process_profile() { return _process_profile; } |
317 | 0 | HeapProfiler* get_heap_profiler() { return _heap_profiler; } |
318 | 146 | segment_v2::InvertedIndexSearcherCache* get_inverted_index_searcher_cache() { |
319 | 146 | return _inverted_index_searcher_cache; |
320 | 146 | } |
321 | 0 | segment_v2::InvertedIndexQueryCache* get_inverted_index_query_cache() { |
322 | 0 | return _inverted_index_query_cache; |
323 | 0 | } |
324 | 0 | QueryCache* get_query_cache() { return _query_cache; } |
325 | 52 | std::shared_ptr<DummyLRUCache> get_dummy_lru_cache() { return _dummy_lru_cache; } |
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 | 99 | segment_v2::TmpFileDirs* get_tmp_file_dirs() { return _tmp_file_dirs.get(); } |
336 | 3.84k | io::FDCache* file_cache_open_fd_cache() const { return _file_cache_open_fd_cache.get(); } |
337 | | |
338 | 0 | orc::MemoryPool* orc_memory_pool() { return _orc_memory_pool; } |
339 | 0 | arrow::MemoryPool* arrow_memory_pool() { return _arrow_memory_pool; } |
340 | | |
341 | | bool check_auth_token(const std::string& auth_token); |
342 | | |
343 | | private: |
344 | | ExecEnv(); |
345 | | |
346 | | [[nodiscard]] Status _init(const std::vector<StorePath>& store_paths, |
347 | | const std::vector<StorePath>& spill_store_paths, |
348 | | const std::set<std::string>& broken_paths); |
349 | | void _destroy(); |
350 | | |
351 | | Status _init_mem_env(); |
352 | | Status _check_deploy_mode(); |
353 | | |
354 | | void _register_metrics(); |
355 | | void _deregister_metrics(); |
356 | | |
357 | | inline static std::atomic_bool _s_ready {false}; |
358 | | inline static std::atomic_bool _s_tracking_memory {false}; |
359 | | std::vector<StorePath> _store_paths; |
360 | | std::vector<StorePath> _spill_store_paths; |
361 | | |
362 | | io::FileCacheFactory* _file_cache_factory = nullptr; |
363 | | UserFunctionCache* _user_function_cache = nullptr; |
364 | | // Leave protected so that subclasses can override |
365 | | ExternalScanContextMgr* _external_scan_context_mgr = nullptr; |
366 | | vectorized::VDataStreamMgr* _vstream_mgr = nullptr; |
367 | | ResultBufferMgr* _result_mgr = nullptr; |
368 | | ResultQueueMgr* _result_queue_mgr = nullptr; |
369 | | ClientCache<BackendServiceClient>* _backend_client_cache = nullptr; |
370 | | ClientCache<FrontendServiceClient>* _frontend_client_cache = nullptr; |
371 | | ClientCache<TPaloBrokerServiceClient>* _broker_client_cache = nullptr; |
372 | | |
373 | | // The default tracker consumed by mem hook. If the thread does not attach other trackers, |
374 | | // by default all consumption will be passed to the process tracker through the orphan tracker. |
375 | | // In real time, `consumption of all limiter trackers` + `orphan tracker consumption` = `process tracker consumption`. |
376 | | // Ideally, all threads are expected to attach to the specified tracker, so that "all memory has its own ownership", |
377 | | // and the consumption of the orphan mem tracker is close to 0, but greater than 0. |
378 | | std::shared_ptr<MemTrackerLimiter> _orphan_mem_tracker; |
379 | | // page size not in cache, data page/index page/etc. |
380 | | std::shared_ptr<MemTracker> _page_no_cache_mem_tracker; |
381 | | std::shared_ptr<MemTrackerLimiter> _brpc_iobuf_block_memory_tracker; |
382 | | // Count the memory consumption of segment compaction tasks. |
383 | | std::shared_ptr<MemTrackerLimiter> _segcompaction_mem_tracker; |
384 | | std::shared_ptr<MemTrackerLimiter> _stream_load_pipe_tracker; |
385 | | |
386 | | // Tracking memory may be shared between multiple queries. |
387 | | std::shared_ptr<MemTrackerLimiter> _point_query_executor_mem_tracker; |
388 | | std::shared_ptr<MemTrackerLimiter> _block_compression_mem_tracker; |
389 | | std::shared_ptr<MemTrackerLimiter> _query_cache_mem_tracker; |
390 | | |
391 | | // TODO, looking forward to more accurate tracking. |
392 | | std::shared_ptr<MemTrackerLimiter> _rowid_storage_reader_tracker; |
393 | | std::shared_ptr<MemTrackerLimiter> _subcolumns_tree_tracker; |
394 | | std::shared_ptr<MemTrackerLimiter> _s3_file_buffer_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 send TableStats to FE |
400 | | std::unique_ptr<ThreadPool> _send_table_stats_thread_pool; |
401 | | // Threadpool used to upload local file to s3 |
402 | | std::unique_ptr<ThreadPool> _s3_file_upload_thread_pool; |
403 | | // Pool used by join node to build hash table |
404 | | // Pool to use a new thread to release object |
405 | | std::unique_ptr<ThreadPool> _lazy_release_obj_pool; |
406 | | std::unique_ptr<ThreadPool> _non_block_close_thread_pool; |
407 | | std::unique_ptr<ThreadPool> _s3_file_system_thread_pool; |
408 | | |
409 | | FragmentMgr* _fragment_mgr = nullptr; |
410 | | pipeline::TaskScheduler* _without_group_task_scheduler = nullptr; |
411 | | WorkloadGroupMgr* _workload_group_manager = nullptr; |
412 | | |
413 | | ResultCache* _result_cache = nullptr; |
414 | | ClusterInfo* _cluster_info = nullptr; |
415 | | LoadPathMgr* _load_path_mgr = nullptr; |
416 | | |
417 | | BfdParser* _bfd_parser = nullptr; |
418 | | BrokerMgr* _broker_mgr = nullptr; |
419 | | LoadChannelMgr* _load_channel_mgr = nullptr; |
420 | | std::unique_ptr<LoadStreamMgr> _load_stream_mgr; |
421 | | // TODO(zhiqiang): Do not use shared_ptr in exec_env, we can not control its life cycle. |
422 | | std::shared_ptr<NewLoadStreamMgr> _new_load_stream_mgr; |
423 | | BrpcClientCache<PBackendService_Stub>* _internal_client_cache = nullptr; |
424 | | BrpcClientCache<PBackendService_Stub>* _streaming_client_cache = nullptr; |
425 | | BrpcClientCache<PFunctionService_Stub>* _function_client_cache = nullptr; |
426 | | |
427 | | std::shared_ptr<StreamLoadExecutor> _stream_load_executor; |
428 | | RoutineLoadTaskExecutor* _routine_load_task_executor = nullptr; |
429 | | SmallFileMgr* _small_file_mgr = nullptr; |
430 | | HeartbeatFlags* _heartbeat_flags = nullptr; |
431 | | vectorized::ScannerScheduler* _scanner_scheduler = nullptr; |
432 | | |
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 | | TabletColumnObjectPool* _tablet_column_object_pool = nullptr; |
453 | | std::unique_ptr<BaseStorageEngine> _storage_engine; |
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 | | ProcessProfile* _process_profile = nullptr; |
461 | | HeapProfiler* _heap_profiler = nullptr; |
462 | | segment_v2::InvertedIndexSearcherCache* _inverted_index_searcher_cache = nullptr; |
463 | | segment_v2::InvertedIndexQueryCache* _inverted_index_query_cache = nullptr; |
464 | | QueryCache* _query_cache = nullptr; |
465 | | std::shared_ptr<DummyLRUCache> _dummy_lru_cache = nullptr; |
466 | | std::unique_ptr<io::FDCache> _file_cache_open_fd_cache; |
467 | | |
468 | | pipeline::RuntimeFilterTimerQueue* _runtime_filter_timer_queue = nullptr; |
469 | | |
470 | | WorkloadSchedPolicyMgr* _workload_sched_mgr = nullptr; |
471 | | |
472 | | RuntimeQueryStatisticsMgr* _runtime_query_statistics_mgr = nullptr; |
473 | | |
474 | | std::unique_ptr<pipeline::PipelineTracerContext> _pipeline_tracer_ctx; |
475 | | std::unique_ptr<segment_v2::TmpFileDirs> _tmp_file_dirs; |
476 | | doris::vectorized::SpillStreamManager* _spill_stream_mgr = nullptr; |
477 | | |
478 | | orc::MemoryPool* _orc_memory_pool = nullptr; |
479 | | arrow::MemoryPool* _arrow_memory_pool = nullptr; |
480 | | }; |
481 | | |
482 | | template <> |
483 | 0 | inline ClientCache<BackendServiceClient>* ExecEnv::get_client_cache<BackendServiceClient>() { |
484 | 0 | return _backend_client_cache; |
485 | 0 | } |
486 | | template <> |
487 | 0 | inline ClientCache<FrontendServiceClient>* ExecEnv::get_client_cache<FrontendServiceClient>() { |
488 | 0 | return _frontend_client_cache; |
489 | 0 | } |
490 | | template <> |
491 | | inline ClientCache<TPaloBrokerServiceClient>* |
492 | 0 | ExecEnv::get_client_cache<TPaloBrokerServiceClient>() { |
493 | 0 | return _broker_client_cache; |
494 | 0 | } |
495 | | |
496 | 0 | inline segment_v2::InvertedIndexQueryCache* GetInvertedIndexQueryCache() { |
497 | 0 | return ExecEnv::GetInstance()->get_inverted_index_query_cache(); |
498 | 0 | } |
499 | | |
500 | | } // namespace doris |