-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathexec_env.h
More file actions
598 lines (525 loc) · 25.6 KB
/
exec_env.h
File metadata and controls
598 lines (525 loc) · 25.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#pragma once
#include <gen_cpp/olap_file.pb.h>
#include <atomic>
#include <map>
#include <memory>
#include <mutex>
#include <optional>
#include <string>
#include <vector>
#include "common/config.h"
#include "common/multi_version.h"
#include "common/status.h"
#include "exec/pipeline/pipeline_tracing.h"
#include "information_schema/schema_routine_load_job_scanner.h"
#include "io/cache/fs_file_cache_storage.h"
#include "load/memtable/memtable_memory_limiter.h"
#include "runtime/cluster_info.h"
#include "runtime/frontend_info.h" // TODO(zhiqiang): find a way to remove this include header
#include "storage/index/inverted/inverted_index_writer.h"
#include "storage/options.h"
#include "storage/tablet/tablet_fwd.h"
#include "util/threadpool.h"
namespace orc {
class MemoryPool;
}
namespace arrow {
class MemoryPool;
}
namespace doris {
class VDataStreamMgr;
class SpillFileManager;
class DeltaWriterV2Pool;
class DictionaryFactory;
class TaskScheduler;
struct RuntimeFilterTimerQueue;
class WorkloadGroupMgr;
struct WriteCooldownMetaExecutors;
class S3RateLimiterHolder;
namespace io {
class FileCacheFactory;
class HdfsMgr;
class PackedFileManager;
} // namespace io
namespace segment_v2 {
class InvertedIndexSearcherCache;
class InvertedIndexQueryCache;
class ConditionCache;
class TmpFileDirs;
class EncodingInfoResolver;
namespace inverted_index {
class AnalysisFactoryMgr;
}
} // namespace segment_v2
namespace kerberos {
class KerberosTicketMgr;
}
class QueryCache;
class WorkloadSchedPolicyMgr;
class BfdParser;
class BrokerMgr;
template <class T>
class BrpcClientCache;
class ExternalScanContextMgr;
class FragmentMgr;
class ResultCache;
class LoadPathMgr;
class NewLoadStreamMgr;
class MemTrackerLimiter;
class MemTracker;
struct TrackerLimiterGroup;
class BaseStorageEngine;
class ResultBufferMgr;
class ResultQueueMgr;
class RuntimeQueryStatisticsMgr;
class LoadChannelMgr;
class LoadStreamMgr;
class LoadStreamMapPool;
class StreamLoadExecutor;
class RoutineLoadTaskExecutor;
class StreamLoadRecorderManager;
class SmallFileMgr;
class BackendServiceClient;
class TPaloBrokerServiceClient;
class PBackendService_Stub;
class PFunctionService_Stub;
template <class T>
class ClientCache;
class HeartbeatFlags;
class FrontendServiceClient;
class FileMetaCache;
class GroupCommitMgr;
class CdcClientMgr;
class TabletSchemaCache;
class TabletColumnObjectPool;
class UserFunctionCache;
class SchemaCache;
class StoragePageCache;
class SegmentLoader;
class LookupConnectionCache;
class RowCache;
class DummyLRUCache;
class CacheManager;
class IdManager;
class ProcessProfile;
class HeapProfiler;
class WalManager;
class DNSCache;
class IndexPolicyMgr;
struct SyncRowsetStats;
class DeleteBitmapAggCache;
// set to true when BE is shutting down
inline bool k_doris_exit = false;
// set to true after BE start ready
inline bool k_is_server_ready = false;
// Execution environment for queries/plan fragments.
// Contains all required global structures, and handles to
// singleton services. Clients must call StartServices exactly
// once to properly initialise service state.
class ExecEnv {
public:
// Empty destructor because the compiler-generated one requires full
// declarations for classes in scoped_ptrs.
~ExecEnv();
BaseStorageEngine& storage_engine() { return *_storage_engine; }
// Initial exec environment. must call this to init all
[[nodiscard]] static Status init(ExecEnv* env, const std::vector<StorePath>& store_paths,
const std::vector<StorePath>& spill_store_paths,
const std::set<std::string>& broken_paths);
// Stop all threads and delete resources.
void destroy();
/// Returns the first created exec env instance. In a normal doris, this is
/// the only instance. In test setups with multiple ExecEnv's per process,
/// we return the most recently created instance.
static ExecEnv* GetInstance() {
static ExecEnv s_exec_env;
return &s_exec_env;
}
// Requires ExenEnv ready
/*
* Parameters:
* - tablet_id: the id of tablet to get
* - sync_stats: the stats of sync rowset
* - force_use_only_cached: whether only use cached data
* - cache_on_miss: whether cache the tablet meta when missing in cache
*/
static Result<BaseTabletSPtr> get_tablet(int64_t tablet_id,
SyncRowsetStats* sync_stats = nullptr,
bool force_use_only_cached = false,
bool cache_on_miss = true);
static Status get_tablet_meta(int64_t tablet_id, TabletMetaSharedPtr* tablet_meta,
bool force_use_only_cached = false);
static bool ready() { return _s_ready.load(std::memory_order_acquire); }
static bool tracking_memory() { return _s_tracking_memory.load(std::memory_order_acquire); }
static bool get_is_upgrading() { return _s_upgrading.load(std::memory_order_acquire); }
static void set_is_upgrading() { _s_upgrading = true; }
const std::string& token() const;
ExternalScanContextMgr* external_scan_context_mgr() { return _external_scan_context_mgr; }
VDataStreamMgr* vstream_mgr() { return _vstream_mgr; }
ResultBufferMgr* result_mgr() { return _result_mgr; }
ResultQueueMgr* result_queue_mgr() { return _result_queue_mgr; }
ClientCache<BackendServiceClient>* client_cache() { return _backend_client_cache; }
ClientCache<FrontendServiceClient>* frontend_client_cache() { return _frontend_client_cache; }
ClientCache<TPaloBrokerServiceClient>* broker_client_cache() { return _broker_client_cache; }
WorkloadGroupMgr* workload_group_mgr() { return _workload_group_manager; }
WorkloadSchedPolicyMgr* workload_sched_policy_mgr() { return _workload_sched_mgr; }
RuntimeQueryStatisticsMgr* runtime_query_statistics_mgr() {
return _runtime_query_statistics_mgr;
}
// using template to simplify client cache management
template <typename T>
inline ClientCache<T>* get_client_cache() {
return nullptr;
}
// Save all MemTrackerLimiters in use.
// Each group corresponds to several MemTrackerLimiters and has a lock.
// Multiple groups are used to reduce the impact of locks.
std::vector<TrackerLimiterGroup> mem_tracker_limiter_pool;
void init_mem_tracker();
std::shared_ptr<MemTrackerLimiter> orphan_mem_tracker() { return _orphan_mem_tracker; }
std::shared_ptr<MemTrackerLimiter> brpc_iobuf_block_memory_tracker() {
return _brpc_iobuf_block_memory_tracker;
}
std::shared_ptr<MemTrackerLimiter> segcompaction_mem_tracker() {
return _segcompaction_mem_tracker;
}
std::shared_ptr<MemTrackerLimiter> stream_load_pipe_tracker() {
return _stream_load_pipe_tracker;
}
std::shared_ptr<MemTrackerLimiter> tablets_no_cache_mem_tracker() {
return _tablets_no_cache_mem_tracker;
}
std::shared_ptr<MemTrackerLimiter> rowsets_no_cache_mem_tracker() {
return _rowsets_no_cache_mem_tracker;
}
std::shared_ptr<MemTrackerLimiter> segments_no_cache_mem_tracker() {
return _segments_no_cache_mem_tracker;
}
std::shared_ptr<MemTrackerLimiter> point_query_executor_mem_tracker() {
return _point_query_executor_mem_tracker;
}
std::shared_ptr<MemTrackerLimiter> query_cache_mem_tracker() {
return _query_cache_mem_tracker;
}
std::shared_ptr<MemTrackerLimiter> block_compression_mem_tracker() {
return _block_compression_mem_tracker;
}
std::shared_ptr<MemTrackerLimiter> rowid_storage_reader_tracker() {
return _rowid_storage_reader_tracker;
}
std::shared_ptr<MemTrackerLimiter> subcolumns_tree_tracker() {
return _subcolumns_tree_tracker;
}
std::shared_ptr<MemTrackerLimiter> s3_file_buffer_tracker() { return _s3_file_buffer_tracker; }
std::shared_ptr<MemTrackerLimiter> parquet_meta_tracker() { return _parquet_meta_tracker; }
ThreadPool* send_batch_thread_pool() { return _send_batch_thread_pool.get(); }
ThreadPool* buffered_reader_prefetch_thread_pool() {
return _buffered_reader_prefetch_thread_pool.get();
}
ThreadPool* send_table_stats_thread_pool() { return _send_table_stats_thread_pool.get(); }
ThreadPool* s3_file_upload_thread_pool() { return _s3_file_upload_thread_pool.get(); }
ThreadPool* lazy_release_obj_pool() { return _lazy_release_obj_pool.get(); }
ThreadPool* non_block_close_thread_pool();
ThreadPool* s3_file_system_thread_pool() { return _s3_file_system_thread_pool.get(); }
ThreadPool* udf_close_workers_pool() { return _udf_close_workers_thread_pool.get(); }
ThreadPool* segment_prefetch_thread_pool() { return _segment_prefetch_thread_pool.get(); }
void init_file_cache_factory(std::vector<doris::CachePath>& cache_paths);
io::FileCacheFactory* file_cache_factory() { return _file_cache_factory; }
UserFunctionCache* user_function_cache() { return _user_function_cache; }
FragmentMgr* fragment_mgr() { return _fragment_mgr; }
ResultCache* result_cache() { return _result_cache; }
ClusterInfo* cluster_info() { return _cluster_info; }
LoadPathMgr* load_path_mgr() { return _load_path_mgr; }
BfdParser* bfd_parser() const { return _bfd_parser; }
BrokerMgr* broker_mgr() const { return _broker_mgr; }
BrpcClientCache<PBackendService_Stub>* brpc_internal_client_cache() const {
return _internal_client_cache;
}
BrpcClientCache<PBackendService_Stub>* brpc_streaming_client_cache() const {
return _streaming_client_cache;
}
BrpcClientCache<PFunctionService_Stub>* brpc_function_client_cache() const {
return _function_client_cache;
}
LoadChannelMgr* load_channel_mgr() { return _load_channel_mgr; }
LoadStreamMgr* load_stream_mgr() { return _load_stream_mgr.get(); }
NewLoadStreamMgr* new_load_stream_mgr() { return _new_load_stream_mgr.get(); }
SmallFileMgr* small_file_mgr() { return _small_file_mgr; }
SpillFileManager* spill_file_mgr() { return _spill_file_mgr; }
GroupCommitMgr* group_commit_mgr() { return _group_commit_mgr; }
CdcClientMgr* cdc_client_mgr() { return _cdc_client_mgr; }
const std::vector<StorePath>& store_paths() const { return _store_paths; }
StreamLoadExecutor* stream_load_executor() { return _stream_load_executor.get(); }
RoutineLoadTaskExecutor* routine_load_task_executor() { return _routine_load_task_executor; }
HeartbeatFlags* heartbeat_flags() { return _heartbeat_flags; }
FileMetaCache* file_meta_cache() { return _file_meta_cache; }
MemTableMemoryLimiter* memtable_memory_limiter() { return _memtable_memory_limiter.get(); }
WalManager* wal_mgr() { return _wal_manager.get(); }
DNSCache* dns_cache() { return _dns_cache; }
WriteCooldownMetaExecutors* write_cooldown_meta_executors() {
return _write_cooldown_meta_executors.get();
}
kerberos::KerberosTicketMgr* kerberos_ticket_mgr() { return _kerberos_ticket_mgr; }
io::HdfsMgr* hdfs_mgr() { return _hdfs_mgr; }
io::PackedFileManager* packed_file_manager() { return _packed_file_manager; }
IndexPolicyMgr* index_policy_mgr() { return _index_policy_mgr; }
S3RateLimiterHolder* warmup_download_rate_limiter() { return _warmup_download_rate_limiter; }
#ifdef BE_TEST
void set_tmp_file_dir(std::unique_ptr<segment_v2::TmpFileDirs> tmp_file_dirs) {
this->_tmp_file_dirs = std::move(tmp_file_dirs);
}
void set_ready() { this->_s_ready = true; }
void set_not_ready() { this->_s_ready = false; }
void set_memtable_memory_limiter(MemTableMemoryLimiter* limiter) {
_memtable_memory_limiter.reset(limiter);
}
void set_cluster_info(ClusterInfo* cluster_info) { this->_cluster_info = cluster_info; }
void set_new_load_stream_mgr(std::unique_ptr<NewLoadStreamMgr>&& new_load_stream_mgr);
void clear_new_load_stream_mgr();
void set_stream_load_executor(std::unique_ptr<StreamLoadExecutor>&& stream_load_executor);
void clear_stream_load_executor();
void set_storage_engine(std::unique_ptr<BaseStorageEngine>&& engine);
void set_inverted_index_searcher_cache(
segment_v2::InvertedIndexSearcherCache* inverted_index_searcher_cache);
void set_inverted_index_query_cache(
segment_v2::InvertedIndexQueryCache* inverted_index_query_cache) {
_inverted_index_query_cache = inverted_index_query_cache;
}
void set_process_profile(ProcessProfile* pp) { this->_process_profile = pp; }
void set_delete_bitmap_agg_cache(DeleteBitmapAggCache* c) { _delete_bitmap_agg_cache = c; }
void set_storage_page_cache(StoragePageCache* c) { this->_storage_page_cache = c; }
void set_segment_loader(SegmentLoader* sl) { this->_segment_loader = sl; }
void set_routine_load_task_executor(RoutineLoadTaskExecutor* r) {
this->_routine_load_task_executor = r;
}
void set_wal_mgr(std::unique_ptr<WalManager>&& wm);
void clear_wal_mgr();
void set_write_cooldown_meta_executors();
static void set_tracking_memory(bool tracking_memory) {
_s_tracking_memory.store(tracking_memory, std::memory_order_release);
}
void set_orc_memory_pool(orc::MemoryPool* pool) { _orc_memory_pool = pool; }
void set_non_block_close_thread_pool(std::unique_ptr<ThreadPool>&& pool) {
_non_block_close_thread_pool = std::move(pool);
}
void set_s3_file_upload_thread_pool(std::unique_ptr<ThreadPool>&& pool) {
_s3_file_upload_thread_pool = std::move(pool);
}
void set_file_cache_factory(io::FileCacheFactory* factory) { _file_cache_factory = factory; }
void set_file_cache_open_fd_cache(std::unique_ptr<io::FDCache>&& fd_cache) {
_file_cache_open_fd_cache = std::move(fd_cache);
}
#endif
// WARN: The following setter methods are intended for use in test code and
// offline tools (like meta_tool) ONLY. They should NOT be called in the
// production environment to avoid thread safety issues and undefined behaviors.
void set_cache_manager(CacheManager* cm) { this->_cache_manager = cm; }
void set_tablet_schema_cache(TabletSchemaCache* c) { this->_tablet_schema_cache = c; }
void set_tablet_column_object_pool(TabletColumnObjectPool* c) {
this->_tablet_column_object_pool = c;
}
LoadStreamMapPool* load_stream_map_pool() { return _load_stream_map_pool.get(); }
DeltaWriterV2Pool* delta_writer_v2_pool() { return _delta_writer_v2_pool.get(); }
void wait_for_all_tasks_done();
void update_frontends(const std::vector<TFrontendInfo>& new_infos);
std::vector<TFrontendInfo> get_frontends();
std::map<TNetworkAddress, FrontendInfo> get_running_frontends();
TabletSchemaCache* get_tablet_schema_cache() { return _tablet_schema_cache; }
TabletColumnObjectPool* get_tablet_column_object_pool() { return _tablet_column_object_pool; }
SchemaCache* schema_cache() { return _schema_cache; }
StoragePageCache* get_storage_page_cache() { return _storage_page_cache; }
SegmentLoader* segment_loader() { return _segment_loader; }
LookupConnectionCache* get_lookup_connection_cache() { return _lookup_connection_cache; }
RowCache* get_row_cache() { return _row_cache; }
CacheManager* get_cache_manager() { return _cache_manager; }
IdManager* get_id_manager() { return _id_manager; }
ProcessProfile* get_process_profile() { return _process_profile; }
HeapProfiler* get_heap_profiler() { return _heap_profiler; }
segment_v2::InvertedIndexSearcherCache* get_inverted_index_searcher_cache() {
return _inverted_index_searcher_cache;
}
segment_v2::InvertedIndexQueryCache* get_inverted_index_query_cache() {
return _inverted_index_query_cache;
}
segment_v2::ConditionCache* get_condition_cache() { return _condition_cache; }
segment_v2::EncodingInfoResolver* get_encoding_info_resolver() {
return _encoding_info_resolver;
}
QueryCache* get_query_cache() { return _query_cache; }
RuntimeFilterTimerQueue* runtime_filter_timer_queue() { return _runtime_filter_timer_queue; }
DictionaryFactory* dict_factory() { return _dict_factory; }
PipelineTracerContext* pipeline_tracer_context() { return _pipeline_tracer_ctx.get(); }
segment_v2::TmpFileDirs* get_tmp_file_dirs() { return _tmp_file_dirs.get(); }
io::FDCache* file_cache_open_fd_cache() const { return _file_cache_open_fd_cache.get(); }
orc::MemoryPool* orc_memory_pool() { return _orc_memory_pool; }
arrow::MemoryPool* arrow_memory_pool() { return _arrow_memory_pool; }
bool check_auth_token(const std::string& auth_token);
void set_stream_mgr(VDataStreamMgr* vstream_mgr) { _vstream_mgr = vstream_mgr; }
void clear_stream_mgr();
DeleteBitmapAggCache* delete_bitmap_agg_cache() { return _delete_bitmap_agg_cache; }
Status init_mem_env();
private:
ExecEnv();
[[nodiscard]] Status _init(const std::vector<StorePath>& store_paths,
const std::vector<StorePath>& spill_store_paths,
const std::set<std::string>& broken_paths);
void _destroy();
Status _check_deploy_mode();
Status _create_internal_workload_group();
void _init_runtime_filter_timer_queue();
inline static std::atomic_bool _s_ready {false};
inline static std::atomic_bool _s_tracking_memory {false};
std::vector<StorePath> _store_paths;
std::vector<StorePath> _spill_store_paths;
inline static std::atomic_bool _s_upgrading {false};
io::FileCacheFactory* _file_cache_factory = nullptr;
UserFunctionCache* _user_function_cache = nullptr;
// Leave protected so that subclasses can override
ExternalScanContextMgr* _external_scan_context_mgr = nullptr;
VDataStreamMgr* _vstream_mgr = nullptr;
ResultBufferMgr* _result_mgr = nullptr;
ResultQueueMgr* _result_queue_mgr = nullptr;
ClientCache<BackendServiceClient>* _backend_client_cache = nullptr;
ClientCache<FrontendServiceClient>* _frontend_client_cache = nullptr;
ClientCache<TPaloBrokerServiceClient>* _broker_client_cache = nullptr;
// The default tracker consumed by mem hook. If the thread does not attach other trackers,
// by default all consumption will be passed to the process tracker through the orphan tracker.
// In real time, `consumption of all limiter trackers` + `orphan tracker consumption` = `process tracker consumption`.
// Ideally, all threads are expected to attach to the specified tracker, so that "all memory has its own ownership",
// and the consumption of the orphan mem tracker is close to 0, but greater than 0.
std::shared_ptr<MemTrackerLimiter> _orphan_mem_tracker;
std::shared_ptr<MemTrackerLimiter> _brpc_iobuf_block_memory_tracker;
// Count the memory consumption of segment compaction tasks.
std::shared_ptr<MemTrackerLimiter> _segcompaction_mem_tracker;
std::shared_ptr<MemTrackerLimiter> _stream_load_pipe_tracker;
std::shared_ptr<MemTrackerLimiter> _tablets_no_cache_mem_tracker;
std::shared_ptr<MemTrackerLimiter> _rowsets_no_cache_mem_tracker;
std::shared_ptr<MemTrackerLimiter> _segments_no_cache_mem_tracker;
// Tracking memory may be shared between multiple queries.
std::shared_ptr<MemTrackerLimiter> _point_query_executor_mem_tracker;
std::shared_ptr<MemTrackerLimiter> _block_compression_mem_tracker;
std::shared_ptr<MemTrackerLimiter> _query_cache_mem_tracker;
// TODO, looking forward to more accurate tracking.
std::shared_ptr<MemTrackerLimiter> _rowid_storage_reader_tracker;
std::shared_ptr<MemTrackerLimiter> _subcolumns_tree_tracker;
std::shared_ptr<MemTrackerLimiter> _s3_file_buffer_tracker;
// Tracking memory consumption of parquet meta
std::shared_ptr<MemTrackerLimiter> _parquet_meta_tracker;
std::unique_ptr<ThreadPool> _send_batch_thread_pool;
// Threadpool used to prefetch remote file for buffered reader
std::unique_ptr<ThreadPool> _buffered_reader_prefetch_thread_pool;
// Threadpool used to send TableStats to FE
std::unique_ptr<ThreadPool> _send_table_stats_thread_pool;
// Threadpool used to upload local file to s3
std::unique_ptr<ThreadPool> _s3_file_upload_thread_pool;
// Pool used by join node to build hash table
// Pool to use a new thread to release object
std::unique_ptr<ThreadPool> _lazy_release_obj_pool;
std::unique_ptr<ThreadPool> _non_block_close_thread_pool;
std::unique_ptr<ThreadPool> _s3_file_system_thread_pool;
// for java-udf to close
std::unique_ptr<ThreadPool> _udf_close_workers_thread_pool;
// Threadpool used to prefetch segment file cache blocks
std::unique_ptr<ThreadPool> _segment_prefetch_thread_pool;
FragmentMgr* _fragment_mgr = nullptr;
WorkloadGroupMgr* _workload_group_manager = nullptr;
ResultCache* _result_cache = nullptr;
ClusterInfo* _cluster_info = nullptr;
LoadPathMgr* _load_path_mgr = nullptr;
BfdParser* _bfd_parser = nullptr;
BrokerMgr* _broker_mgr = nullptr;
LoadChannelMgr* _load_channel_mgr = nullptr;
std::unique_ptr<LoadStreamMgr> _load_stream_mgr;
std::unique_ptr<NewLoadStreamMgr> _new_load_stream_mgr;
BrpcClientCache<PBackendService_Stub>* _internal_client_cache = nullptr;
BrpcClientCache<PBackendService_Stub>* _streaming_client_cache = nullptr;
BrpcClientCache<PFunctionService_Stub>* _function_client_cache = nullptr;
std::unique_ptr<StreamLoadExecutor> _stream_load_executor;
RoutineLoadTaskExecutor* _routine_load_task_executor = nullptr;
StreamLoadRecorderManager* _stream_load_recorder_manager = nullptr;
SmallFileMgr* _small_file_mgr = nullptr;
HeartbeatFlags* _heartbeat_flags = nullptr;
// To save meta info of external file, such as parquet footer.
FileMetaCache* _file_meta_cache = nullptr;
std::unique_ptr<MemTableMemoryLimiter> _memtable_memory_limiter;
std::unique_ptr<LoadStreamMapPool> _load_stream_map_pool;
std::unique_ptr<DeltaWriterV2Pool> _delta_writer_v2_pool;
std::unique_ptr<WalManager> _wal_manager;
DNSCache* _dns_cache = nullptr;
std::unique_ptr<WriteCooldownMetaExecutors> _write_cooldown_meta_executors;
std::mutex _frontends_lock;
// ip:brpc_port -> frontend_indo
std::map<TNetworkAddress, FrontendInfo> _frontends;
GroupCommitMgr* _group_commit_mgr = nullptr;
CdcClientMgr* _cdc_client_mgr = nullptr;
// Maybe we should use unique_ptr, but it need complete type, which means we need
// to include many headers, and for some cpp file that do not need class like TabletSchemaCache,
// these redundancy header could introduce potential bug, at least, more header means slow compile.
// So we choose to use raw pointer, please remember to delete these pointer in deconstructor.
TabletSchemaCache* _tablet_schema_cache = nullptr;
TabletColumnObjectPool* _tablet_column_object_pool = nullptr;
std::unique_ptr<BaseStorageEngine> _storage_engine;
SchemaCache* _schema_cache = nullptr;
StoragePageCache* _storage_page_cache = nullptr;
SegmentLoader* _segment_loader = nullptr;
LookupConnectionCache* _lookup_connection_cache = nullptr;
RowCache* _row_cache = nullptr;
CacheManager* _cache_manager = nullptr;
IdManager* _id_manager = nullptr;
ProcessProfile* _process_profile = nullptr;
HeapProfiler* _heap_profiler = nullptr;
segment_v2::InvertedIndexSearcherCache* _inverted_index_searcher_cache = nullptr;
segment_v2::InvertedIndexQueryCache* _inverted_index_query_cache = nullptr;
segment_v2::ConditionCache* _condition_cache = nullptr;
segment_v2::EncodingInfoResolver* _encoding_info_resolver = nullptr;
QueryCache* _query_cache = nullptr;
std::unique_ptr<io::FDCache> _file_cache_open_fd_cache;
DeleteBitmapAggCache* _delete_bitmap_agg_cache {nullptr};
RuntimeFilterTimerQueue* _runtime_filter_timer_queue = nullptr;
DictionaryFactory* _dict_factory = nullptr;
WorkloadSchedPolicyMgr* _workload_sched_mgr = nullptr;
IndexPolicyMgr* _index_policy_mgr = nullptr;
RuntimeQueryStatisticsMgr* _runtime_query_statistics_mgr = nullptr;
std::unique_ptr<PipelineTracerContext> _pipeline_tracer_ctx;
std::unique_ptr<segment_v2::TmpFileDirs> _tmp_file_dirs;
SpillFileManager* _spill_file_mgr = nullptr;
orc::MemoryPool* _orc_memory_pool = nullptr;
arrow::MemoryPool* _arrow_memory_pool = nullptr;
kerberos::KerberosTicketMgr* _kerberos_ticket_mgr = nullptr;
io::HdfsMgr* _hdfs_mgr = nullptr;
io::PackedFileManager* _packed_file_manager = nullptr;
S3RateLimiterHolder* _warmup_download_rate_limiter = nullptr;
};
template <>
inline ClientCache<BackendServiceClient>* ExecEnv::get_client_cache<BackendServiceClient>() {
return _backend_client_cache;
}
template <>
inline ClientCache<FrontendServiceClient>* ExecEnv::get_client_cache<FrontendServiceClient>() {
return _frontend_client_cache;
}
template <>
inline ClientCache<TPaloBrokerServiceClient>*
ExecEnv::get_client_cache<TPaloBrokerServiceClient>() {
return _broker_client_cache;
}
inline segment_v2::InvertedIndexQueryCache* GetInvertedIndexQueryCache() {
return ExecEnv::GetInstance()->get_inverted_index_query_cache();
}
} // namespace doris