Skip to content

Commit

Permalink
5
Browse files Browse the repository at this point in the history
  • Loading branch information
Yukang-Lian committed Jul 12, 2023
1 parent 75ef84d commit 09a6dc3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
20 changes: 9 additions & 11 deletions be/src/olap/compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -722,21 +722,19 @@ Status Compaction::check_version_continuity(const std::vector<RowsetSharedPtr>&

Status Compaction::check_all_version(const std::vector<RowsetSharedPtr>& rowsets) {
if (rowsets.empty()) {
return Status::Error<FULL_MISS_VERSION>();
return Status::Error<FULL_MISS_VERSION>("There is no input rowset when do full compaction");
}
const RowsetSharedPtr& last_rowset = rowsets.back();
const RowsetSharedPtr& first_rowset = rowsets.front();
if (last_rowset->version() != _tablet->max_version() || first_rowset->version().first != 0) {
LOG(WARNING)
<< "Full compaction rowsets' versions not equal to all exist rowsets' versions. "
<< "full compaction rowsets max version=" << last_rowset->start_version() << "-"
<< last_rowset->end_version()
<< ", current rowsets max version=" << _tablet->max_version().first << "-"
<< _tablet->max_version().second
<< "full compaction rowsets min version=" << first_rowset->start_version() << "-"
<< first_rowset->end_version() << ", current rowsets min version="
<< "0-1";
return Status::Error<FULL_MISS_VERSION>();
return Status::Error<FULL_MISS_VERSION>(
"Full compaction rowsets' versions not equal to all exist rowsets' versions. "
"full compaction rowsets max version={}-{}"
", current rowsets max version={}-{}"
"full compaction rowsets min version={}-{}, current rowsets min version=0-1",
last_rowset->start_version(), last_rowset->end_version(),
_tablet->max_version().first, _tablet->max_version().second,
first_rowset->start_version(), first_rowset->end_version());
}
return Status::OK();
}
Expand Down
8 changes: 4 additions & 4 deletions be/src/olap/full_compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ FullCompaction::~FullCompaction() {}

Status FullCompaction::prepare_compact() {
if (!_tablet->init_succeeded()) {
return Status::Error<INVALID_ARGUMENT>();
return Status::Error<INVALID_ARGUMENT>("Full compaction init failed");
}

std::unique_lock<std::mutex> full_lock(_tablet->get_full_compaction_lock());
Expand All @@ -67,7 +67,7 @@ Status FullCompaction::execute_compact_impl() {
// for compaction may change. In this case, current compaction task should not be executed.
if (_tablet->get_clone_occurred()) {
_tablet->set_clone_occurred(false);
return Status::Error<BE_CLONE_OCCURRED>();
return Status::Error<BE_CLONE_OCCURRED>("get_clone_occurred failed");
}

SCOPED_ATTACH_TASK(_mem_tracker);
Expand All @@ -94,13 +94,13 @@ Status FullCompaction::pick_rowsets_to_compact() {
RETURN_IF_ERROR(check_version_continuity(_input_rowsets));
RETURN_IF_ERROR(check_all_version(_input_rowsets));
if (_input_rowsets.size() <= 1) {
return Status::Error<FULL_NO_SUITABLE_VERSION>();
return Status::Error<FULL_NO_SUITABLE_VERSION>("There is no suitable version");
}

if (_input_rowsets.size() == 2 && _input_rowsets[0]->end_version() == 1) {
// the tablet is with rowset: [0-1], [2-y]
// and [0-1] has no data. in this situation, no need to do full compaction.
return Status::Error<FULL_NO_SUITABLE_VERSION>();
return Status::Error<FULL_NO_SUITABLE_VERSION>("There is no suitable version");
}

return Status::OK();
Expand Down

0 comments on commit 09a6dc3

Please sign in to comment.