Coverage Report

Created: 2026-06-09 21:12

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
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,
37
                 bool* memtable_flushed = nullptr) override;
38
39
    Status close() override;
40
41
    Status flush_memtable_async() override;
42
43
    Status cancel_with_status(const Status& st) override;
44
45
    Status build_rowset() override;
46
47
    void update_tablet_stats();
48
49
    const RowsetMetaSharedPtr& rowset_meta();
50
51
0
    bool is_init() const { return _is_init; }
52
53
    static Status batch_init(std::vector<CloudDeltaWriter*> writers);
54
55
    Status commit_rowset();
56
57
    Status set_txn_related_info();
58
0
    std::shared_ptr<ResourceContext> resource_context() { return _resource_ctx; }
59
60
private:
61
    // Convert `_rowset_builder` from `BaseRowsetBuilder` to `CloudRowsetBuilder`
62
    CloudRowsetBuilder* rowset_builder();
63
64
    // Handle commit for empty rowset (when no data is written)
65
    Status _commit_empty_rowset();
66
67
    bthread::Mutex _mtx;
68
    CloudStorageEngine& _engine;
69
    std::shared_ptr<ResourceContext> _resource_ctx;
70
};
71
72
} // namespace doris