Coverage Report

Created: 2026-08-03 13:02

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_segment(int64_t seg_id, OlapReaderStatistics* read_stats,
79
                        segment_v2::SegmentSharedPtr* segment,
80
                        const io::IOContext* io_ctx = nullptr);
81
82
    Status load_segment(RowsetSegmentRef seg, OlapReaderStatistics* read_stats,
83
                        segment_v2::SegmentSharedPtr* segment,
84
                        const io::IOContext* io_ctx = nullptr);
85
86
    Status get_segments_size(std::vector<size_t>* segments_size);
87
88
    Status get_inverted_index_size(int64_t* index_size) override;
89
90
    [[nodiscard]] virtual Status add_to_binlog() override;
91
92
    Status calc_file_crc(uint32_t* crc_value, int64_t* file_count);
93
94
    Status show_nested_index_file(rapidjson::Value* rowset_value,
95
                                  rapidjson::Document::AllocatorType& allocator);
96
97
    Status get_segment_num_rows(std::vector<uint32_t>* segment_rows, bool enable_segment_cache,
98
                                OlapReaderStatistics* read_stats,
99
                                const io::IOContext* io_ctx = nullptr);
100
101
protected:
102
    BetaRowset(const TabletSchemaSPtr& schema, const RowsetMetaSharedPtr& rowset_meta,
103
               std::string tablet_path);
104
105
    // init segment groups
106
    Status init() override;
107
108
    void do_close() override;
109
110
    Status check_current_rowset_segment() override;
111
112
    void clear_inverted_index_cache() override;
113
114
private:
115
    friend class RowsetFactory;
116
    friend class BetaRowsetReader;
117
118
    DorisCallOnce<Status> _load_segment_rows_once;
119
    std::vector<uint32_t> _segments_rows;
120
};
121
122
} // namespace doris
123
124
#endif //DORIS_SRC_OLAP_ROWSET_BETA_ROWSET_H_