Coverage Report

Created: 2026-08-18 16:48

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
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
constexpr inline int SUPPORT_ICEBERG_VARIANT_VERSION = 12;
31
constexpr inline int SUPPORT_EXTERNAL_TABLE_SINK_HASH_VERSION = 13;
32
33
class BeExecVersionManager {
34
public:
35
    BeExecVersionManager() = delete;
36
37
    static Status check_be_exec_version(int be_exec_version);
38
39
    static int get_function_compatibility(int be_exec_version, std::string function_name);
40
41
    static void check_function_compatibility(int current_be_exec_version, int data_be_exec_version,
42
                                             std::string function_name);
43
44
278k
    static int get_newest_version() { return max_be_exec_version; }
45
46
0
    static std::string get_function_suffix(int be_exec_version) {
47
0
        return "_for_old_version_" + std::to_string(be_exec_version);
48
0
    }
49
50
    // For example, there are incompatible changes between version=7 and version=6, at this time breaking_old_version is 6.
51
    static void registe_old_function_compatibility(int breaking_old_version,
52
0
                                                   std::string function_name) {
53
0
        _function_change_map[function_name].insert(breaking_old_version);
54
0
    }
55
56
48
    static void registe_restrict_function_compatibility(std::string function_name) {
57
48
        _function_restrict_map.insert(function_name);
58
48
    }
59
60
private:
61
    static const int max_be_exec_version;
62
    static const int min_be_exec_version;
63
    // [function name] -> [breaking change start version]
64
    static std::map<std::string, std::set<int>> _function_change_map;
65
    // those function must has input newest be exec version
66
    static std::set<std::string> _function_restrict_map;
67
};
68
69
} // namespace doris