Userwhite commented on code in PR #62058:
URL: https://github.com/apache/doris/pull/62058#discussion_r3031355371
##########
be/src/storage/rowset_builder.cpp:
##########
@@ -417,5 +475,93 @@ Status BaseRowsetBuilder::_build_current_tablet_schema(
table_schema_param->sequence_map_col_uid(),
_max_version_in_flush_phase));
return Status::OK();
}
+
+GroupRowsetBuilder::GroupRowsetBuilder(StorageEngine& engine, const
WriteRequest& req,
+ const WriteRequest& row_binlog_req,
RuntimeProfile* profile)
+ : BaseRowsetBuilder(
+ [](int64_t tablet_id) {
+ WriteRequest group_req;
+ group_req.tablet_id = tablet_id;
+ group_req.write_req_type = WriteRequestType::GROUP;
+ return group_req;
+ }(req.tablet_id),
+ profile) {
+ _row_binlog_rowset_builder =
+ std::make_shared<RowBinlogRowsetBuilder>(engine, row_binlog_req,
profile);
+ _txn_rs_builder = std::make_shared<RowsetBuilder>(engine, req, profile);
+}
+
+Status GroupRowsetBuilder::init() {
+ // init binlog builder first so that its rowset id can be added into
+ // PendingLocalRowsets before txn builder init.
+ RETURN_IF_ERROR(_row_binlog_rowset_builder->init());
+ // before init txn, need to add all rowset_ids into PendingLocalRowsets.
+ // see https://github.com/apache/doris/pull/25921
+ RETURN_IF_ERROR(_txn_rs_builder->attach_pending_rs_guard_to_txn(
+ _row_binlog_rowset_builder->rowset_id()));
+ RETURN_IF_ERROR(_txn_rs_builder->init());
+
+ // Create a GroupRowsetWriter that forwards flush to both underlying
+ // RowsetWriters.
+ std::unique_ptr<doris::GroupRowsetWriter> group_writer;
+
RETURN_IF_ERROR(RowsetFactory::create_empty_group_rowset_writer(&group_writer));
+ group_writer->set_data_writer(_txn_rs_builder->rowset_writer());
+
group_writer->set_row_binlog_writer(_row_binlog_rowset_builder->rowset_writer());
+
+ _rowset_writer = std::move(group_writer);
+ _is_init = true;
+ return Status::OK();
+}
+
+Status GroupRowsetBuilder::submit_calc_delete_bitmap_task() {
+ return _txn_rs_builder->submit_calc_delete_bitmap_task();
+}
+
+Status GroupRowsetBuilder::wait_calc_delete_bitmap() {
+ return _txn_rs_builder->wait_calc_delete_bitmap();
+}
+
+Status GroupRowsetBuilder::commit_txn() {
+ // Attach binlog rowset to txn rowset, so that commit/rollback and
+ // clean-up are all handled by txn rowset builder.
+
RETURN_IF_ERROR(_txn_rs_builder->attach_rowset_to_txn(_row_binlog_rowset_builder->rowset()));
+ return _txn_rs_builder->commit_txn();
Review Comment:
write module will be introduced by next PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]