/root/doris/be/src/olap/options.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 <gen_cpp/Types_types.h> |
21 | | #include <stdint.h> |
22 | | |
23 | | #include <string> |
24 | | #include <utility> |
25 | | #include <vector> |
26 | | |
27 | | #include "common/status.h" |
28 | | #include "io/cache/file_cache_common.h" |
29 | | #include "util/uid_util.h" |
30 | | |
31 | | namespace doris { |
32 | | |
33 | | struct StorePath { |
34 | 9 | StorePath() : capacity_bytes(-1), storage_medium(TStorageMedium::HDD) {} |
35 | | StorePath(const std::string& path_, int64_t capacity_bytes_) |
36 | 59 | : path(path_), capacity_bytes(capacity_bytes_), storage_medium(TStorageMedium::HDD) {} |
37 | | StorePath(const std::string& path_, int64_t capacity_bytes_, |
38 | | TStorageMedium::type storage_medium_) |
39 | 0 | : path(path_), capacity_bytes(capacity_bytes_), storage_medium(storage_medium_) {} |
40 | | std::string path; |
41 | | int64_t capacity_bytes; |
42 | | TStorageMedium::type storage_medium; |
43 | | }; |
44 | | |
45 | | // parse a single root path of storage_root_path |
46 | | Status parse_root_path(const std::string& root_path, StorePath* path); |
47 | | |
48 | | Status parse_conf_store_paths(const std::string& config_path, std::vector<StorePath>* path); |
49 | | |
50 | | void parse_conf_broken_store_paths(const std::string& config_path, std::set<std::string>* paths); |
51 | | |
52 | | struct CachePath { |
53 | | io::FileCacheSettings init_settings() const; |
54 | | |
55 | | CachePath(std::string path, int64_t total_bytes, int64_t query_limit_bytes, |
56 | | size_t normal_percent, size_t disposable_percent, size_t index_percent, |
57 | | size_t ttl_percent, std::string storage) |
58 | | : path(std::move(path)), |
59 | | total_bytes(total_bytes), |
60 | | query_limit_bytes(query_limit_bytes), |
61 | | normal_percent(normal_percent), |
62 | | disposable_percent(disposable_percent), |
63 | | index_percent(index_percent), |
64 | | ttl_percent(ttl_percent), |
65 | 4 | storage(storage) {} |
66 | | |
67 | | std::string path; |
68 | | int64_t total_bytes = 0; |
69 | | int64_t query_limit_bytes = 0; |
70 | | size_t normal_percent = io::DEFAULT_NORMAL_PERCENT; |
71 | | size_t disposable_percent = io::DEFAULT_DISPOSABLE_PERCENT; |
72 | | size_t index_percent = io::DEFAULT_INDEX_PERCENT; |
73 | | size_t ttl_percent = io::DEFAULT_TTL_PERCENT; |
74 | | std::string storage = "disk"; |
75 | | }; |
76 | | |
77 | | Status parse_conf_cache_paths(const std::string& config_path, std::vector<CachePath>& path); |
78 | | |
79 | | struct EngineOptions { |
80 | | // list paths that tablet will be put into. |
81 | | std::vector<StorePath> store_paths; |
82 | | std::set<std::string> broken_paths; |
83 | | // BE's UUID. It will be reset every time BE restarts. |
84 | | UniqueId backend_uid {0, 0}; |
85 | | }; |
86 | | } // namespace doris |