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](merge-on-write) Fix MergeIndexDeleteBitmapCalculator::calculate_one() coredump #44284

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Changes from 1 commit
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
26 changes: 15 additions & 11 deletions be/src/olap/delete_bitmap_calculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ bool MergeIndexDeleteBitmapCalculatorContext::Comparator::operator()(
// std::proiroty_queue is a max heap, and function should return the result of `lhs < rhs`
// so if the result of the function is true, rhs will be popped before lhs
Slice key1, key2;
RETURN_IF_ERROR(lhs->get_current_key(key1));
RETURN_IF_ERROR(rhs->get_current_key(key2));
// MergeIndexDeleteBitmapCalculatorContext::get_current_key may return non-OK status if encounter
// memory allocation failure, we can only throw exception here to propagate error in this situation
THROW_IF_ERROR(lhs->get_current_key(key1));
THROW_IF_ERROR(rhs->get_current_key(key2));
if (_sequence_length == 0 && _rowid_length == 0) {
auto cmp_result = key1.compare(key2);
// when key1 is the same as key2,
Expand Down Expand Up @@ -209,16 +211,18 @@ Status MergeIndexDeleteBitmapCalculator::calculate_one(RowLocation& loc) {
}

Status MergeIndexDeleteBitmapCalculator::calculate_all(DeleteBitmapPtr delete_bitmap) {
RowLocation loc;
while (true) {
auto st = calculate_one(loc);
if (st.is<ErrorCode::END_OF_FILE>()) {
break;
RETURN_IF_CATCH_EXCEPTION({
bobhan1 marked this conversation as resolved.
Show resolved Hide resolved
RowLocation loc;
while (true) {
auto st = calculate_one(loc);
if (st.is<ErrorCode::END_OF_FILE>()) {
break;
}
RETURN_IF_ERROR(st);
delete_bitmap->add({_rowset_id, loc.segment_id, DeleteBitmap::TEMP_VERSION_COMMON},
loc.row_id);
}
RETURN_IF_ERROR(st);
delete_bitmap->add({_rowset_id, loc.segment_id, DeleteBitmap::TEMP_VERSION_COMMON},
loc.row_id);
}
});
return Status::OK();
}

Expand Down
Loading