Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate add transaction many times when pending_delta has many segmentgroups #1081

Merged
merged 1 commit into from
Apr 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions be/src/olap/olap_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,16 @@ void OLAPTable::load_pending_data() {
std::set<int64_t> error_pending_data;

for (const PPendingDelta& pending_delta : _header->pending_delta()) {
OLAPStatus add_status = OLAPEngine::get_instance()->add_transaction(
pending_delta.partition_id(), pending_delta.transaction_id(),
_tablet_id, _schema_hash, pending_delta.pending_segment_group()[0].load_id());
if (add_status != OLAP_SUCCESS) {
LOG(ERROR) << "find transaction exists in engine when load pending data. tablet=" << full_name()
<< ", transaction_id=" << pending_delta.transaction_id();
error_pending_data.insert(pending_delta.transaction_id());
continue;
}

for (const PPendingSegmentGroup& pending_segment_group : pending_delta.pending_segment_group()) {
SegmentGroup* segment_group = new SegmentGroup(this, false,
pending_segment_group.pending_segment_group_id(),
Expand Down Expand Up @@ -842,17 +852,6 @@ void OLAPTable::load_pending_data() {
error_pending_data.insert(pending_delta.transaction_id());
break;
}

OLAPStatus add_status = OLAPEngine::get_instance()->add_transaction(
pending_delta.partition_id(), pending_delta.transaction_id(),
_tablet_id, _schema_hash, pending_segment_group.load_id());

if (add_status != OLAP_SUCCESS) {
LOG(WARNING) << "find transaction exists in engine when load pending data. [table=" << full_name()
<< " transaction_id=" << pending_delta.transaction_id() << "]";
error_pending_data.insert(pending_delta.transaction_id());
break;
}
}

if (error_pending_data.find(pending_delta.transaction_id()) != error_pending_data.end()) {
Expand Down