[fix](partial update) report error directly if missing rowsets during doing alignment when flushing memtable due to compaction (#28677)

This commit is contained in:
bobhan1
2023-12-20 11:49:11 +08:00
committed by GitHub
parent fe184e322a
commit afd55123ea
3 changed files with 34 additions and 0 deletions

View File

@ -182,6 +182,18 @@ 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,

View File

@ -412,6 +412,17 @@ 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()) {
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(),
_mow_context->max_version, _mow_context->txn_id);
return Status::InternalError<false>(
"[Memtable Flush] some rowsets have been deleted due to compaction");
}
}
std::vector<std::unique_ptr<SegmentCacheHandle>> segment_caches(specified_rowsets.size());
// locate rows in base data

View File

@ -346,6 +346,17 @@ 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()) {
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(),
_mow_context->max_version, _mow_context->txn_id);
return Status::InternalError<false>(
"[Memtable Flush] some rowsets have been deleted due to compaction");
}
}
std::vector<std::unique_ptr<SegmentCacheHandle>> segment_caches(specified_rowsets.size());
// locate rows in base data