Coverage Report

Created: 2026-03-15 18:01

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