Coverage Report

Created: 2026-08-07 14:29

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(CloudStorageEngine& engine, const WriteRequest& group_build_req,
35
                     const WriteRequest& sub_data_req, const WriteRequest& sub_row_binlog_req,
36
                     RuntimeProfile* profile, const UniqueId& load_id);
37
    ~CloudDeltaWriter() override;
38
39
    Status write(const Block* block, const TabletAddRowsPayload& rows,
40
                 bool* memtable_flushed = nullptr) override;
41
42
    Status close() override;
43
44
    Status flush_memtable_async() override;
45
46
    Status cancel_with_status(const Status& st) override;
47
48
    Status build_rowset() override;
49
50
    void update_tablet_stats();
51
52
353k
    bool is_init() const { return _is_init; }
53
54
    static Status batch_init(std::vector<CloudDeltaWriter*> writers);
55
56
    Status commit_rowset();
57
58
    Status set_txn_related_info();
59
54.5k
    std::shared_ptr<ResourceContext> resource_context() { return _resource_ctx; }
60
61
private:
62
    // Convert `_rowset_builder` from `BaseRowsetBuilder` to `CloudRowsetBuilder`
63
    CloudRowsetBuilder* rowset_builder();
64
65
    // Handle commit for empty rowset (when no data is written)
66
    Status _commit_empty_rowset();
67
68
    bthread::Mutex _mtx;
69
    std::shared_ptr<ResourceContext> _resource_ctx;
70
};
71
72
} // namespace doris