be/src/cloud/cloud_delta_writer.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 <bthread/mutex.h> |
21 | | |
22 | | #include "load/delta_writer/delta_writer.h" |
23 | | #include "runtime/workload_management/resource_context.h" |
24 | | |
25 | | namespace doris { |
26 | | |
27 | | class CloudStorageEngine; |
28 | | class CloudRowsetBuilder; |
29 | | |
30 | | class CloudDeltaWriter final : public BaseDeltaWriter { |
31 | | public: |
32 | | CloudDeltaWriter(CloudStorageEngine& engine, const WriteRequest& req, RuntimeProfile* profile, |
33 | | const UniqueId& load_id); |
34 | | ~CloudDeltaWriter() override; |
35 | | |
36 | | Status write(const Block* block, const DorisVector<uint32_t>& row_idxs) override; |
37 | | |
38 | | Status close() override; |
39 | | |
40 | | Status cancel_with_status(const Status& st) override; |
41 | | |
42 | | Status build_rowset() override; |
43 | | |
44 | | void update_tablet_stats(); |
45 | | |
46 | | const RowsetMetaSharedPtr& rowset_meta(); |
47 | | |
48 | 617k | bool is_init() const { return _is_init; } |
49 | | |
50 | | static Status batch_init(std::vector<CloudDeltaWriter*> writers); |
51 | | |
52 | | Status commit_rowset(); |
53 | | |
54 | | Status set_txn_related_delete_bitmap(); |
55 | 181k | std::shared_ptr<ResourceContext> resource_context() { return _resource_ctx; } |
56 | | |
57 | | private: |
58 | | // Convert `_rowset_builder` from `BaseRowsetBuilder` to `CloudRowsetBuilder` |
59 | | CloudRowsetBuilder* rowset_builder(); |
60 | | |
61 | | // Handle commit for empty rowset (when no data is written) |
62 | | Status _commit_empty_rowset(); |
63 | | |
64 | | bthread::Mutex _mtx; |
65 | | CloudStorageEngine& _engine; |
66 | | std::shared_ptr<ResourceContext> _resource_ctx; |
67 | | }; |
68 | | |
69 | | } // namespace doris |