Skip to content

Commit

Permalink
[fix](inverted index) base compaction failed after restore indexes (#…
Browse files Browse the repository at this point in the history
…43962)

### What problem does this PR solve?
**Problem:**
after restore from other cluster, then rowsets got different index_id,
and make index compaction in base compaction always failed.

**Fix:**
On master branch, this pr: #41625
already fix it.
Here pick it to branch-2.1
  • Loading branch information
cambyzju authored Nov 16, 2024
1 parent 75d4e2c commit b3022df
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions be/src/olap/compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,15 @@ Status Compaction::do_compaction_impl(int64_t permits) {
std::optional<std::map<std::string, std::string>> first_properties;
for (const auto& rowset : _input_rowsets) {
const auto* tablet_index = rowset->tablet_schema()->get_inverted_index(col);
// no inverted index or index id is different from current index id
if (tablet_index == nullptr ||
tablet_index->index_id() != index_meta->index_id()) {
error_handler(index_meta->index_id(), column_uniq_id);
status = Status::Error<INVERTED_INDEX_COMPACTION_ERROR>(
"index ids are different, skip index compaction");
is_continue = true;
break;
}
const auto& properties = tablet_index->properties();
if (!first_properties.has_value()) {
first_properties = properties;
Expand Down

0 comments on commit b3022df

Please sign in to comment.