Coverage Report

Created: 2026-08-10 15:16

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/cloud/cloud_cumulative_compaction_binlog_policy.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 "cloud/cloud_cumulative_compaction_policy.h"
21
#include "storage/compaction/cumulative_compaction_binlog_policy.h"
22
23
namespace doris {
24
25
class CloudBinlogCumulativeCompactionPolicy final : public CloudCumulativeCompactionPolicy {
26
public:
27
244
    CloudBinlogCumulativeCompactionPolicy() = default;
28
241
    ~CloudBinlogCumulativeCompactionPolicy() override = default;
29
30
    int64_t new_cumulative_point(CloudTablet* tablet, const RowsetSharedPtr& output_rowset,
31
                                 Version& last_delete_version,
32
                                 int64_t last_cumulative_point) override;
33
34
    int64_t get_compaction_level(CloudTablet* tablet,
35
                                 const std::vector<RowsetSharedPtr>& input_rowsets,
36
                                 RowsetSharedPtr output_rowset) override;
37
38
    int64_t pick_input_rowsets(CloudTablet* tablet,
39
                               const std::vector<RowsetSharedPtr>& candidate_rowsets,
40
                               const int64_t max_compaction_score,
41
                               const int64_t min_compaction_score,
42
                               std::vector<RowsetSharedPtr>* input_rowsets,
43
                               Version* last_delete_version, size_t* compaction_score,
44
                               bool allow_delete = false) override;
45
46
0
    std::string name() override { return std::string(CUMULATIVE_BINLOG_POLICY); }
47
48
private:
49
    bool is_compaction_enough(const RowsetMetaSharedPtr& rowset_meta) const;
50
    void filter_new_visible_rowsets(const std::vector<RowsetSharedPtr>& candidate_rowsets,
51
                                    std::vector<RowsetSharedPtr>* output_rowsets) const;
52
    uint32_t calc_binlog_compaction_level_score(
53
            CloudTablet* tablet, const std::vector<RowsetSharedPtr>& candidate_rowsets,
54
            int8_t level) const;
55
    uint32_t calc_binlog_compaction_score(CloudTablet* tablet,
56
                                          const std::vector<RowsetSharedPtr>& candidate_rowsets,
57
                                          int8_t* compaction_level) const;
58
};
59
60
} // namespace doris