This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new b3022df7169 [fix](inverted index) base compaction failed after restore 
indexes (#43962)
b3022df7169 is described below

commit b3022df7169708d4bf6a9988f0ef8512f6f473f1
Author: camby <[email protected]>
AuthorDate: Sat Nov 16 16:01:13 2024 +0800

    [fix](inverted index) base compaction failed after restore indexes (#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: https://github.com/apache/doris/pull/41625
    already fix it.
    Here pick it to branch-2.1
---
 be/src/olap/compaction.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/be/src/olap/compaction.cpp b/be/src/olap/compaction.cpp
index 50edafec1c2..afda4153b60 100644
--- a/be/src/olap/compaction.cpp
+++ b/be/src/olap/compaction.cpp
@@ -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;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to