be/src/agent/be_exec_version_manager.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 <fmt/format.h> |
21 | | #include <glog/logging.h> |
22 | | |
23 | | #include "common/exception.h" |
24 | | #include "common/status.h" |
25 | | |
26 | | namespace doris { |
27 | | |
28 | | constexpr inline int USE_NEW_FIXED_OBJECT_SERIALIZATION_VERSION = 10; |
29 | | constexpr inline int SUPPORT_ICEBERG_MERGE_CARDINALITY_VERSION = 11; |
30 | | |
31 | | class BeExecVersionManager { |
32 | | public: |
33 | | BeExecVersionManager() = delete; |
34 | | |
35 | | static Status check_be_exec_version(int be_exec_version); |
36 | | |
37 | | static int get_function_compatibility(int be_exec_version, std::string function_name); |
38 | | |
39 | | static void check_function_compatibility(int current_be_exec_version, int data_be_exec_version, |
40 | | std::string function_name); |
41 | | |
42 | 7.68M | static int get_newest_version() { return max_be_exec_version; } |
43 | | |
44 | 0 | static std::string get_function_suffix(int be_exec_version) { |
45 | 0 | return "_for_old_version_" + std::to_string(be_exec_version); |
46 | 0 | } |
47 | | |
48 | | // For example, there are incompatible changes between version=7 and version=6, at this time breaking_old_version is 6. |
49 | | static void registe_old_function_compatibility(int breaking_old_version, |
50 | 0 | std::string function_name) { |
51 | 0 | _function_change_map[function_name].insert(breaking_old_version); |
52 | 0 | } |
53 | | |
54 | 48 | static void registe_restrict_function_compatibility(std::string function_name) { |
55 | 48 | _function_restrict_map.insert(function_name); |
56 | 48 | } |
57 | | |
58 | | private: |
59 | | static const int max_be_exec_version; |
60 | | static const int min_be_exec_version; |
61 | | // [function name] -> [breaking change start version] |
62 | | static std::map<std::string, std::set<int>> _function_change_map; |
63 | | // those function must has input newest be exec version |
64 | | static std::set<std::string> _function_restrict_map; |
65 | | }; |
66 | | |
67 | | } // namespace doris |