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