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

[Fix](partial update) Fix partial update info loss when the delete bitmaps of the committed transactions are calculated by the compaction #26556

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
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
34 changes: 17 additions & 17 deletions be/src/olap/compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,24 +719,24 @@ Status Compaction::modify_rowsets(const Merger::Statistics* stats) {
// Therefore, we need to check if every committed rowset has calculated delete bitmap for
// all compaction input rowsets.
continue;
} else {
DeleteBitmap txn_output_delete_bitmap(_tablet->tablet_id());
_tablet->calc_compaction_output_rowset_delete_bitmap(
_input_rowsets, _rowid_conversion, 0, UINT64_MAX, &missed_rows,
&location_map, *it.delete_bitmap.get(), &txn_output_delete_bitmap);
if (config::enable_merge_on_write_correctness_check) {
RowsetIdUnorderedSet rowsetids;
rowsetids.insert(_output_rowset->rowset_id());
_tablet->add_sentinel_mark_to_delete_bitmap(&txn_output_delete_bitmap,
rowsetids);
}
it.delete_bitmap->merge(txn_output_delete_bitmap);
// Step3: write back updated delete bitmap and tablet info.
it.rowset_ids.insert(_output_rowset->rowset_id());
StorageEngine::instance()->txn_manager()->set_txn_related_delete_bitmap(
it.partition_id, it.transaction_id, _tablet->tablet_id(),
_tablet->tablet_uid(), true, it.delete_bitmap, it.rowset_ids, nullptr);
}
DeleteBitmap txn_output_delete_bitmap(_tablet->tablet_id());
_tablet->calc_compaction_output_rowset_delete_bitmap(
_input_rowsets, _rowid_conversion, 0, UINT64_MAX, &missed_rows,
&location_map, *it.delete_bitmap.get(), &txn_output_delete_bitmap);
if (config::enable_merge_on_write_correctness_check) {
RowsetIdUnorderedSet rowsetids;
rowsetids.insert(_output_rowset->rowset_id());
_tablet->add_sentinel_mark_to_delete_bitmap(&txn_output_delete_bitmap,
rowsetids);
}
it.delete_bitmap->merge(txn_output_delete_bitmap);
// Step3: write back updated delete bitmap and tablet info.
it.rowset_ids.insert(_output_rowset->rowset_id());
StorageEngine::instance()->txn_manager()->set_txn_related_delete_bitmap(
it.partition_id, it.transaction_id, _tablet->tablet_id(),
_tablet->tablet_uid(), true, it.delete_bitmap, it.rowset_ids,
it.partial_update_info);
}

// Convert the delete bitmap of the input rowsets to output rowset for
Expand Down
7 changes: 5 additions & 2 deletions be/src/olap/txn_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,11 +675,14 @@ void TxnManager::get_all_commit_tablet_txn_info_by_tablet(
const RowsetSharedPtr& rowset = tablet_load_it->second.rowset;
const DeleteBitmapPtr& delete_bitmap = tablet_load_it->second.delete_bitmap;
const RowsetIdUnorderedSet& rowset_ids = tablet_load_it->second.rowset_ids;
const std::shared_ptr<PartialUpdateInfo> partial_update_info =
tablet_load_it->second.partial_update_info;
if (!rowset || !delete_bitmap) {
continue;
}
commit_tablet_txn_info_vec->push_back(CommitTabletTxnInfo(
partition_id, transaction_id, delete_bitmap, rowset_ids));
commit_tablet_txn_info_vec->push_back(
CommitTabletTxnInfo(partition_id, transaction_id, delete_bitmap, rowset_ids,
partial_update_info));
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions be/src/olap/txn_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,18 @@ struct TabletTxnInfo {

struct CommitTabletTxnInfo {
CommitTabletTxnInfo(TPartitionId partition_id, TTransactionId transaction_id,
DeleteBitmapPtr delete_bitmap, RowsetIdUnorderedSet rowset_ids)
DeleteBitmapPtr delete_bitmap, RowsetIdUnorderedSet rowset_ids,
std::shared_ptr<PartialUpdateInfo> partial_update_info)
: transaction_id(transaction_id),
partition_id(partition_id),
delete_bitmap(delete_bitmap),
rowset_ids(rowset_ids) {}
rowset_ids(rowset_ids),
partial_update_info(partial_update_info) {}
TTransactionId transaction_id;
TPartitionId partition_id;
DeleteBitmapPtr delete_bitmap;
RowsetIdUnorderedSet rowset_ids;
std::shared_ptr<PartialUpdateInfo> partial_update_info;
};

using CommitTabletTxnInfoVec = std::vector<CommitTabletTxnInfo>;
Expand Down