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 | | |
22 | | namespace doris { |
23 | | |
24 | 2 | void GroupRowsetWriter::set_data_writer(const RowsetWriterSharedPtr& txn_rowset_writer) { |
25 | 2 | _txn_rowset_writer = std::dynamic_pointer_cast<BaseBetaRowsetWriter>(txn_rowset_writer); |
26 | 2 | } |
27 | | |
28 | | void GroupRowsetWriter::set_row_binlog_writer( |
29 | 2 | const RowsetWriterSharedPtr& row_binlog_rowset_writer) { |
30 | 2 | _row_binlog_rowset_writer = row_binlog_rowset_writer; |
31 | 2 | } |
32 | | |
33 | 2 | Status GroupRowsetWriter::flush_rowsets() { |
34 | 2 | RETURN_IF_ERROR(_txn_rowset_writer->flush()); |
35 | 2 | if (_row_binlog_rowset_writer) { |
36 | 2 | RETURN_IF_ERROR(_row_binlog_rowset_writer->flush()); |
37 | 2 | } |
38 | 2 | return Status::OK(); |
39 | 2 | } |
40 | | |
41 | 1 | Status GroupRowsetWriter::build_rowsets(std::vector<RowsetSharedPtr>& rowsets) { |
42 | 1 | if (rowsets.size() < 2) { |
43 | 0 | return Status::InvalidArgument( |
44 | 0 | "GroupRowsetWriter::build_rowsets expects at least 2 rowset slots"); |
45 | 0 | } |
46 | 1 | RETURN_IF_ERROR(_txn_rowset_writer->build(rowsets[0])); |
47 | 1 | if (_row_binlog_rowset_writer) { |
48 | 1 | RETURN_IF_ERROR(_row_binlog_rowset_writer->build(rowsets[1])); |
49 | 1 | } |
50 | 1 | return Status::OK(); |
51 | 1 | } |
52 | | |
53 | | } // namespace doris |