From ccc5019e102e2eb9ca53100b02f2b3758633c919 Mon Sep 17 00:00:00 2001 From: Jianliang Qi Date: Mon, 2 Sep 2024 15:24:13 +0800 Subject: [PATCH] [fix](index compaction)Fix core when having multiple dest segments --- be/src/olap/compaction.cpp | 6 +++--- .../index_compaction/test_index_compaction_dup_keys.groovy | 2 ++ .../index_compaction/test_index_compaction_null.groovy | 3 +++ .../test_index_compaction_unique_keys.groovy | 2 ++ .../test_index_compaction_with_multi_index_segments.groovy | 2 ++ 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/be/src/olap/compaction.cpp b/be/src/olap/compaction.cpp index 1fed2253b69fbf..963b885a26b4ad 100644 --- a/be/src/olap/compaction.cpp +++ b/be/src/olap/compaction.cpp @@ -686,9 +686,9 @@ Status Compaction::do_inverted_index_compaction() { << st; return st; } - for (const auto& writer : inverted_index_file_writers) { - writer->set_file_writer_opts(ctx.get_file_writer_options()); - } + } + for (const auto& writer : inverted_index_file_writers) { + writer->set_file_writer_opts(ctx.get_file_writer_options()); } // use tmp file dir to store index files diff --git a/regression-test/suites/inverted_index_p0/index_compaction/test_index_compaction_dup_keys.groovy b/regression-test/suites/inverted_index_p0/index_compaction/test_index_compaction_dup_keys.groovy index 1de813a310bdeb..ce6a7e7c6a355c 100644 --- a/regression-test/suites/inverted_index_p0/index_compaction/test_index_compaction_dup_keys.groovy +++ b/regression-test/suites/inverted_index_p0/index_compaction/test_index_compaction_dup_keys.groovy @@ -24,6 +24,7 @@ suite("test_index_compaction_dup_keys", "nonConcurrent") { def backendId_to_backendHttpPort = [:] getBackendIpHttpPort(backendId_to_backendIP, backendId_to_backendHttpPort); + sql """ set global enable_match_without_inverted_index = false """ boolean disableAutoCompaction = false def set_be_config = { key, value -> @@ -240,5 +241,6 @@ suite("test_index_compaction_dup_keys", "nonConcurrent") { if (has_update_be_config) { set_be_config.call("inverted_index_compaction_enable", invertedIndexCompactionEnable.toString()) } + sql """ set global enable_match_without_inverted_index = true """ } } diff --git a/regression-test/suites/inverted_index_p0/index_compaction/test_index_compaction_null.groovy b/regression-test/suites/inverted_index_p0/index_compaction/test_index_compaction_null.groovy index 8a77c2dbf7d441..f882cda1522004 100644 --- a/regression-test/suites/inverted_index_p0/index_compaction/test_index_compaction_null.groovy +++ b/regression-test/suites/inverted_index_p0/index_compaction/test_index_compaction_null.groovy @@ -24,6 +24,7 @@ suite("test_index_compaction_null", "nonConcurrent") { def backendId_to_backendHttpPort = [:] getBackendIpHttpPort(backendId_to_backendIP, backendId_to_backendHttpPort); + sql """ set global enable_match_without_inverted_index = false """ boolean disableAutoCompaction = false def set_be_config = { key, value -> @@ -317,5 +318,7 @@ suite("test_index_compaction_null", "nonConcurrent") { if (has_update_be_config) { set_be_config.call("inverted_index_compaction_enable", invertedIndexCompactionEnable.toString()) } + + sql """ set global enable_match_without_inverted_index = true """ } } diff --git a/regression-test/suites/inverted_index_p0/index_compaction/test_index_compaction_unique_keys.groovy b/regression-test/suites/inverted_index_p0/index_compaction/test_index_compaction_unique_keys.groovy index 5afd6bada192ac..87996687b93950 100644 --- a/regression-test/suites/inverted_index_p0/index_compaction/test_index_compaction_unique_keys.groovy +++ b/regression-test/suites/inverted_index_p0/index_compaction/test_index_compaction_unique_keys.groovy @@ -24,6 +24,7 @@ suite("test_index_compaction_unique_keys", "nonConcurrent") { def backendId_to_backendHttpPort = [:] getBackendIpHttpPort(backendId_to_backendIP, backendId_to_backendHttpPort); + sql """ set global enable_match_without_inverted_index = false """ boolean disableAutoCompaction = false def set_be_config = { key, value -> @@ -246,5 +247,6 @@ suite("test_index_compaction_unique_keys", "nonConcurrent") { if (has_update_be_config) { set_be_config.call("inverted_index_compaction_enable", invertedIndexCompactionEnable.toString()) } + sql """ set global enable_match_without_inverted_index = true """ } } diff --git a/regression-test/suites/inverted_index_p0/index_compaction/test_index_compaction_with_multi_index_segments.groovy b/regression-test/suites/inverted_index_p0/index_compaction/test_index_compaction_with_multi_index_segments.groovy index e9cc3300212050..edcf41db13c877 100644 --- a/regression-test/suites/inverted_index_p0/index_compaction/test_index_compaction_with_multi_index_segments.groovy +++ b/regression-test/suites/inverted_index_p0/index_compaction/test_index_compaction_with_multi_index_segments.groovy @@ -24,6 +24,7 @@ suite("test_index_compaction_with_multi_index_segments", "nonConcurrent") { def backendId_to_backendHttpPort = [:] getBackendIpHttpPort(backendId_to_backendIP, backendId_to_backendHttpPort); + sql """ set global enable_match_without_inverted_index = false """ boolean disableAutoCompaction = false def set_be_config = { key, value -> @@ -401,5 +402,6 @@ suite("test_index_compaction_with_multi_index_segments", "nonConcurrent") { set_be_config.call("inverted_index_compaction_enable", invertedIndexCompactionEnable.toString()) set_be_config.call("inverted_index_max_buffered_docs", invertedIndexMaxBufferedDocs.toString()) } + sql """ set global enable_match_without_inverted_index = true """ } }