Coverage Report

Created: 2026-08-22 00:50

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