Coverage Report

Created: 2026-07-15 15:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/storage/rowset/beta_rowset.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
#ifndef DORIS_SRC_OLAP_ROWSET_BETA_ROWSET_H_
19
#define DORIS_SRC_OLAP_ROWSET_BETA_ROWSET_H_
20
21
#include <stddef.h>
22
23
#include <cstdint>
24
#include <memory>
25
#include <string>
26
#include <vector>
27
28
#include "common/status.h"
29
#include "storage/olap_common.h"
30
#include "storage/rowset/rowset.h"
31
#include "storage/rowset/rowset_meta.h"
32
#include "storage/rowset/rowset_reader.h"
33
#include "storage/segment/segment.h"
34
#include "storage/tablet/tablet_schema.h"
35
36
namespace doris {
37
38
class BetaRowset;
39
40
namespace io {
41
struct IOContext;
42
class RemoteFileSystem;
43
} // namespace io
44
struct RowsetId;
45
46
using BetaRowsetSharedPtr = std::shared_ptr<BetaRowset>;
47
48
class BetaRowset final : public Rowset {
49
public:
50
    ~BetaRowset() override;
51
52
    Status create_reader(RowsetReaderSharedPtr* result) override;
53
54
    // Return the absolute path of local segcompacted segment file
55
    static std::string local_segment_path_segcompacted(const std::string& tablet_path,
56
                                                       const RowsetId& rowset_id, int64_t begin,
57
                                                       int64_t end);
58
59
    Status remove() override;
60
61
    Status link_files_to(const std::string& dir, RowsetId new_rowset_id,
62
                         size_t new_rowset_start_seg_id = 0,
63
                         std::set<int64_t>* without_index_uids = nullptr) override;
64
65
    Status copy_files_to(const std::string& dir, const RowsetId& new_rowset_id) override;
66
67
    Status upload_to(const StorageResource& dest_fs, const RowsetId& new_rowset_id) override;
68
69
    // only applicable to alpha rowset, no op here
70
0
    Status remove_old_files(std::vector<std::string>* files_to_remove) override {
71
0
        return Status::OK();
72
0
    }
73
74
    Status check_file_exist() override;
75
76
    Status load_segments(std::vector<segment_v2::SegmentSharedPtr>* segments);
77
78
    Status load_segments(int64_t seg_id_begin, int64_t seg_id_end,
79
                         std::vector<segment_v2::SegmentSharedPtr>* segments);
80
81
    Status load_segment(int64_t seg_id, OlapReaderStatistics* read_stats,
82
                        segment_v2::SegmentSharedPtr* segment,
83
                        const io::IOContext* io_ctx = nullptr);
84
85
    Status get_segments_size(std::vector<size_t>* segments_size);
86
87
    Status get_inverted_index_size(int64_t* index_size) override;
88
89
    [[nodiscard]] virtual Status add_to_binlog() override;
90
91
    Status calc_file_crc(uint32_t* crc_value, int64_t* file_count);
92
93
    Status show_nested_index_file(rapidjson::Value* rowset_value,
94
                                  rapidjson::Document::AllocatorType& allocator);
95
96
    Status get_segment_num_rows(std::vector<uint32_t>* segment_rows, bool enable_segment_cache,
97
                                OlapReaderStatistics* read_stats,
98
                                const io::IOContext* io_ctx = nullptr);
99
100
protected:
101
    BetaRowset(const TabletSchemaSPtr& schema, const RowsetMetaSharedPtr& rowset_meta,
102
               std::string tablet_path);
103
104
    // init segment groups
105
    Status init() override;
106
107
    void do_close() override;
108
109
    Status check_current_rowset_segment() override;
110
111
    void clear_inverted_index_cache() override;
112
113
private:
114
    friend class RowsetFactory;
115
    friend class BetaRowsetReader;
116
117
    DorisCallOnce<Status> _load_segment_rows_once;
118
    std::vector<uint32_t> _segments_rows;
119
};
120
121
} // namespace doris
122
123
#endif //DORIS_SRC_OLAP_ROWSET_BETA_ROWSET_H_