Skip to content

Commit

Permalink
[fix](partial update) only report error when in strict mode partial u…
Browse files Browse the repository at this point in the history
…pdate when finding missing rowsets during flushing memtable (#28764)

related pr: #28062, #28674, #28677
fix #28677
  • Loading branch information
bobhan1 authored Dec 22, 2023
1 parent c1457f9 commit 49eaf0c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 24 deletions.
12 changes: 0 additions & 12 deletions be/src/olap/rowset/beta_rowset_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,6 @@ Status BetaRowsetWriter::_generate_delete_bitmap(int32_t segment_id) {
{
std::shared_lock meta_rlock(tablet->get_header_lock());
specified_rowsets = tablet->get_rowset_by_ids(&_context.mow_context->rowset_ids);
if (specified_rowsets.size() != _context.mow_context->rowset_ids.size()) {
LOG(WARNING) << fmt::format(
"[Memtable Flush] some rowsets have been deleted due to "
"compaction(specified_rowsets.size()={}, but rowset_ids.size()={}), reset "
"rowset_ids to the latest value. tablet_id: {}, cur max_version: {}, "
"transaction_id: {}",
specified_rowsets.size(), _context.mow_context->rowset_ids.size(),
_context.tablet->tablet_id(), _context.mow_context->max_version,
_context.mow_context->txn_id);
return Status::InternalError<false>(
"[Memtable Flush] some rowsets have been deleted due to compaction");
}
}
OlapStopWatch watch;
RETURN_IF_ERROR(tablet->calc_delete_bitmap(rowset, segments, specified_rowsets,
Expand Down
15 changes: 9 additions & 6 deletions be/src/olap/rowset/segment_v2/segment_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,16 +412,19 @@ Status SegmentWriter::append_block_with_partial_content(const vectorized::Block*
{
std::shared_lock rlock(tablet->get_header_lock());
specified_rowsets = tablet->get_rowset_by_ids(&_mow_context->rowset_ids);
if (specified_rowsets.size() != _mow_context->rowset_ids.size()) {
if (_opts.rowset_ctx->partial_update_info->is_strict_mode &&
specified_rowsets.size() != _mow_context->rowset_ids.size()) {
// Only when this is a strict mode partial update that missing rowsets here will lead to problems.
// In other case, the missing rowsets will be calculated in later phases(commit phase/publish phase)
LOG(WARNING) << fmt::format(
"[Memtable Flush] some rowsets have been deleted due to "
"compaction(specified_rowsets.size()={}, but rowset_ids.size()={}), reset "
"rowset_ids to the latest value. tablet_id: {}, cur max_version: {}, "
"transaction_id: {}",
specified_rowsets.size(), _mow_context->rowset_ids.size(), tablet->tablet_id(),
"compaction(specified_rowsets.size()={}, but rowset_ids.size()={}) in strict "
"mode partial update. tablet_id: {}, cur max_version: {}, transaction_id: {}",
specified_rowsets.size(), _mow_context->rowset_ids.size(), _tablet->tablet_id(),
_mow_context->max_version, _mow_context->txn_id);
return Status::InternalError<false>(
"[Memtable Flush] some rowsets have been deleted due to compaction");
"[Memtable Flush] some rowsets have been deleted due to "
"compaction in strict mode partial update");
}
}
std::vector<std::unique_ptr<SegmentCacheHandle>> segment_caches(specified_rowsets.size());
Expand Down
15 changes: 9 additions & 6 deletions be/src/olap/rowset/segment_v2/vertical_segment_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,19 @@ Status VerticalSegmentWriter::_append_block_with_partial_content(RowsInBlock& da
{
std::shared_lock rlock(tablet->get_header_lock());
specified_rowsets = tablet->get_rowset_by_ids(&_mow_context->rowset_ids);
if (specified_rowsets.size() != _mow_context->rowset_ids.size()) {
if (_opts.rowset_ctx->partial_update_info->is_strict_mode &&
specified_rowsets.size() != _mow_context->rowset_ids.size()) {
// Only when this is a strict mode partial update that missing rowsets here will lead to problems.
// In other case, the missing rowsets will be calculated in later phases(commit phase/publish phase)
LOG(WARNING) << fmt::format(
"[Memtable Flush] some rowsets have been deleted due to "
"compaction(specified_rowsets.size()={}, but rowset_ids.size()={}), reset "
"rowset_ids to the latest value. tablet_id: {}, cur max_version: {}, "
"transaction_id: {}",
specified_rowsets.size(), _mow_context->rowset_ids.size(), tablet->tablet_id(),
"compaction(specified_rowsets.size()={}, but rowset_ids.size()={}) in strict "
"mode partial update. tablet_id: {}, cur max_version: {}, transaction_id: {}",
specified_rowsets.size(), _mow_context->rowset_ids.size(), _tablet->tablet_id(),
_mow_context->max_version, _mow_context->txn_id);
return Status::InternalError<false>(
"[Memtable Flush] some rowsets have been deleted due to compaction");
"[Memtable Flush] some rowsets have been deleted due to "
"compaction in strict mode partial update");
}
}
std::vector<std::unique_ptr<SegmentCacheHandle>> segment_caches(specified_rowsets.size());
Expand Down

0 comments on commit 49eaf0c

Please sign in to comment.