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 "storage/rowset_builder.h" |
21 | | |
22 | | namespace doris { |
23 | | |
24 | | class CloudTablet; |
25 | | class CloudStorageEngine; |
26 | | |
27 | | class CloudRowsetBuilder : public BaseRowsetBuilder { |
28 | | public: |
29 | | CloudRowsetBuilder(CloudStorageEngine& engine, const WriteRequest& req, |
30 | | RuntimeProfile* profile); |
31 | | |
32 | | ~CloudRowsetBuilder() override; |
33 | | |
34 | | Status init() override; |
35 | | |
36 | | virtual void update_tablet_stats(); |
37 | | |
38 | | const RowsetMetaSharedPtr& rowset_meta(); |
39 | | |
40 | | virtual Status commit_rowset(const std::string& job_id, int64_t table_id); |
41 | | |
42 | | virtual Status set_txn_related_info(); |
43 | | |
44 | 2 | virtual void set_skip_writing_rowset_metadata(bool skip) { |
45 | 2 | _skip_writing_rowset_metadata = skip; |
46 | 2 | } |
47 | | |
48 | | protected: |
49 | | // Convert `_tablet` from `BaseTablet` to `CloudTablet` |
50 | | CloudTablet* cloud_tablet(); |
51 | | |
52 | | Status check_tablet_version_count(); |
53 | | |
54 | | CloudStorageEngine& _engine; |
55 | | |
56 | | // whether to skip writing rowset metadata to meta service. |
57 | | // This is used for empty rowset when config::skip_writing_empty_rowset_metadata is true. |
58 | | bool _skip_writing_rowset_metadata = false; |
59 | | }; |
60 | | |
61 | | class CloudGroupRowsetBuilder final : public CloudRowsetBuilder { |
62 | | public: |
63 | | CloudGroupRowsetBuilder(CloudStorageEngine& engine, const WriteRequest& group_build_req, |
64 | | const WriteRequest& sub_data_req, |
65 | | const WriteRequest& sub_row_binlog_req, RuntimeProfile* profile); |
66 | | |
67 | | Status init() override; |
68 | | |
69 | | Status build_rowset() override; |
70 | | |
71 | | Status submit_calc_delete_bitmap_task() override; |
72 | | |
73 | | Status wait_calc_delete_bitmap() override; |
74 | | |
75 | | void update_tablet_stats() override; |
76 | | |
77 | | Status commit_rowset(const std::string& job_id, int64_t table_id) override; |
78 | | |
79 | | Status set_txn_related_info() override; |
80 | | |
81 | | void set_skip_writing_rowset_metadata(bool skip) override; |
82 | | |
83 | 0 | const BaseTabletSPtr& tablet_sptr() const override { return _data_builder->tablet_sptr(); } |
84 | | |
85 | 0 | const RowsetSharedPtr& rowset() const override { return _data_builder->rowset(); } |
86 | | |
87 | 0 | const TabletSchemaSPtr& tablet_schema() const override { |
88 | 0 | return _data_builder->tablet_schema(); |
89 | 0 | } |
90 | | |
91 | 0 | const std::shared_ptr<PartialUpdateInfo>& get_partial_update_info() const override { |
92 | 0 | return _data_builder->get_partial_update_info(); |
93 | 0 | } |
94 | | |
95 | 1 | CloudRowsetBuilder* data_builder() { return _data_builder.get(); } |
96 | | |
97 | 1 | CloudRowsetBuilder* row_binlog_builder() { return _row_binlog_builder.get(); } |
98 | | |
99 | | private: |
100 | | std::shared_ptr<CloudRowsetBuilder> _data_builder; |
101 | | std::shared_ptr<CloudRowsetBuilder> _row_binlog_builder; |
102 | | }; |
103 | | |
104 | | } // namespace doris |