Coverage Report

Created: 2026-05-20 14:58

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/storage/rowset/group_rowset_writer.cpp
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
#include "storage/rowset/group_rowset_writer.h"
19
20
#include "storage/rowset/beta_rowset_writer.h"
21
#include "storage/segment/segment_writer.h"
22
#include "util/debug_points.h"
23
24
namespace doris {
25
26
12
void GroupRowsetWriter::set_data_writer(const RowsetWriterSharedPtr& txn_rowset_writer) {
27
12
    _txn_rowset_writer = txn_rowset_writer;
28
12
}
29
30
void GroupRowsetWriter::set_row_binlog_writer(
31
12
        const RowsetWriterSharedPtr& row_binlog_rowset_writer) {
32
12
    _row_binlog_rowset_writer = row_binlog_rowset_writer;
33
12
}
34
35
7
Status GroupRowsetWriter::flush_rowsets() {
36
7
    RETURN_IF_ERROR(_txn_rowset_writer->flush());
37
7
    RETURN_IF_ERROR(_row_binlog_rowset_writer->flush());
38
7
    return Status::OK();
39
7
}
40
41
8
Status GroupRowsetWriter::build_rowsets(std::vector<RowsetSharedPtr>& rowsets) {
42
8
    rowsets.clear();
43
8
    rowsets.reserve(2);
44
45
8
    RowsetSharedPtr txn_rowset;
46
8
    RowsetSharedPtr row_binlog_rowset;
47
8
    RETURN_IF_ERROR(_txn_rowset_writer->build(txn_rowset));
48
8
    Status st = Status::OK();
49
8
    DBUG_EXECUTE_IF("GroupRowsetWriter::build_rowsets.row_binlog_build_failed",
50
8
                    { st = Status::InternalError("debug row binlog build failed"); });
51
8
    if (st.ok()) {
52
7
        st = _row_binlog_rowset_writer->build(row_binlog_rowset);
53
7
    }
54
8
    if (!st.ok()) {
55
1
        RETURN_IF_ERROR(_txn_rowset_writer->force_rollback());
56
1
        return st;
57
1
    }
58
59
7
    rowsets.emplace_back(std::move(txn_rowset));
60
7
    rowsets.emplace_back(std::move(row_binlog_rowset));
61
7
    return Status::OK();
62
8
}
63
64
0
Status GroupRowsetWriter::flush_memtable(Block* block, int32_t segment_id, int64_t* flush_size) {
65
0
    RETURN_IF_ERROR(_txn_rowset_writer->flush_memtable(block, segment_id, flush_size));
66
0
    RETURN_IF_ERROR(_row_binlog_rowset_writer->flush_memtable(block, segment_id, flush_size));
67
0
    return Status::OK();
68
0
}
69
70
2
Status GroupRowsetWriter::flush_single_block(const Block* block) {
71
2
    RETURN_IF_ERROR(_txn_rowset_writer->flush_single_block(block));
72
2
    RETURN_IF_ERROR(_row_binlog_rowset_writer->flush_single_block(block));
73
2
    return Status::OK();
74
2
}
75
76
} // namespace doris