Coverage Report

Created: 2026-06-06 01:52

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
6
void GroupRowsetWriter::set_data_writer(const RowsetWriterSharedPtr& txn_rowset_writer) {
27
6
    _txn_rowset_writer = txn_rowset_writer;
28
6
}
29
30
void GroupRowsetWriter::set_row_binlog_writer(
31
6
        const RowsetWriterSharedPtr& row_binlog_rowset_writer) {
32
6
    _row_binlog_rowset_writer = row_binlog_rowset_writer;
33
6
}
34
35
3
Status GroupRowsetWriter::flush_rowsets() {
36
3
    RETURN_IF_ERROR(_txn_rowset_writer->flush());
37
3
    RETURN_IF_ERROR(_row_binlog_rowset_writer->flush());
38
3
    return Status::OK();
39
3
}
40
41
3
Status GroupRowsetWriter::build_rowsets(std::vector<RowsetSharedPtr>& rowsets) {
42
3
    rowsets.clear();
43
3
    rowsets.reserve(2);
44
45
3
    RowsetSharedPtr txn_rowset;
46
3
    RowsetSharedPtr row_binlog_rowset;
47
3
    RETURN_IF_ERROR(_txn_rowset_writer->build(txn_rowset));
48
3
    Status st = Status::OK();
49
3
    DBUG_EXECUTE_IF("GroupRowsetWriter::build_rowsets.row_binlog_build_failed",
50
3
                    { st = Status::InternalError("debug row binlog build failed"); });
51
3
    if (st.ok()) {
52
3
        st = _row_binlog_rowset_writer->build(row_binlog_rowset);
53
3
    }
54
3
    if (!st.ok()) {
55
0
        RETURN_IF_ERROR(_txn_rowset_writer->force_rollback());
56
0
        return st;
57
0
    }
58
59
3
    rowsets.emplace_back(std::move(txn_rowset));
60
3
    rowsets.emplace_back(std::move(row_binlog_rowset));
61
3
    return Status::OK();
62
3
}
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
0
Status GroupRowsetWriter::flush_single_block(const Block* block) {
71
0
    RETURN_IF_ERROR(_txn_rowset_writer->flush_single_block(block));
72
0
    RETURN_IF_ERROR(_row_binlog_rowset_writer->flush_single_block(block));
73
0
    return Status::OK();
74
0
}
75
76
} // namespace doris