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
commit 91b75063ac40b357f1ac0794432235df907e6858 Author: airborne12 <airborn...@gmail.com> AuthorDate: Thu Apr 11 21:26:00 2024 +0800 [Fix](inverted index) fix build index error status when batch_next (#33532) --- be/src/olap/task/index_builder.cpp | 6 ++++++ .../fault_injection_p0/test_build_index_fault.out | 6 ++++++ .../test_build_index_fault.groovy | 24 ++++++++++++++++++---- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/be/src/olap/task/index_builder.cpp b/be/src/olap/task/index_builder.cpp index 062a6880578..0e6abc2c1b1 100644 --- a/be/src/olap/task/index_builder.cpp +++ b/be/src/olap/task/index_builder.cpp @@ -27,6 +27,7 @@ #include "olap/segment_loader.h" #include "olap/storage_engine.h" #include "olap/tablet_schema.h" +#include "util/debug_points.h" #include "util/trace.h" namespace doris { @@ -395,6 +396,10 @@ Status IndexBuilder::handle_single_rowset(RowsetMetaSharedPtr output_rowset_meta output_rowset_schema->create_block(return_columns)); while (true) { auto status = iter->next_batch(block.get()); + DBUG_EXECUTE_IF("IndexBuilder::handle_single_rowset", { + status = Status::Error<ErrorCode::SCHEMA_CHANGE_INFO_INVALID>( + "next_batch fault injection"); + }); if (!status.ok()) { if (status.is<ErrorCode::END_OF_FILE>()) { break; @@ -402,6 +407,7 @@ Status IndexBuilder::handle_single_rowset(RowsetMetaSharedPtr output_rowset_meta LOG(WARNING) << "failed to read next block when schema change for inverted index." << ", err=" << status.to_string(); + return status; } // write inverted index data diff --git a/regression-test/data/fault_injection_p0/test_build_index_fault.out b/regression-test/data/fault_injection_p0/test_build_index_fault.out index 543ca7ae5ff..3d5d60cfcaa 100644 --- a/regression-test/data/fault_injection_p0/test_build_index_fault.out +++ b/regression-test/data/fault_injection_p0/test_build_index_fault.out @@ -17,3 +17,9 @@ -- !count6 -- 1000000 +-- !count7 -- +1000000 + +-- !count8 -- +1000000 + diff --git a/regression-test/suites/fault_injection_p0/test_build_index_fault.groovy b/regression-test/suites/fault_injection_p0/test_build_index_fault.groovy index 796a7b03443..368314cc1af 100644 --- a/regression-test/suites/fault_injection_p0/test_build_index_fault.groovy +++ b/regression-test/suites/fault_injection_p0/test_build_index_fault.groovy @@ -189,7 +189,7 @@ suite("test_build_index_fault", "inverted_index, nonConcurrent,p2"){ // BUILD INDEX and expect state is FINISHED sql """ BUILD INDEX idx_comment ON ${tableName}; """ state = wait_for_last_build_index_on_table_finish(tableName, timeout) - assertEquals(state, "FINISHED") + assertEquals("FINISHED", state) // check data qt_count3 """ SELECT COUNT() from ${tableName}; """ @@ -206,7 +206,7 @@ suite("test_build_index_fault", "inverted_index, nonConcurrent,p2"){ // BUILD INDEX again and expect state is FINISHED sql """ BUILD INDEX idx_comment ON ${tableName}; """ state = wait_for_last_build_index_on_table_finish(tableName, timeout) - assertEquals(state, "FINISHED") + assertEquals("FINISHED", state) // check data qt_count4 """ SELECT COUNT() from ${tableName}; """ @@ -216,7 +216,7 @@ suite("test_build_index_fault", "inverted_index, nonConcurrent,p2"){ GetDebugPoint().enableDebugPointForAllBEs("fault_inject::BetaRowset::link_files_to::_link_inverted_index_file") sql """ BUILD INDEX idx_title ON ${tableName}; """ state = wait_for_last_build_index_on_table_finish(tableName, timeout) - assertEquals(state, "wait_timeout") + assertEquals("wait_timeout", state) // check data qt_count5 """ SELECT COUNT() from ${tableName}; """ @@ -224,7 +224,23 @@ suite("test_build_index_fault", "inverted_index, nonConcurrent,p2"){ GetDebugPoint().disableDebugPointForAllBEs("fault_inject::BetaRowset::link_files_to::_link_inverted_index_file") // timeout * 10 for possible fe schedule delay state = wait_for_last_build_index_on_table_finish(tableName, timeout * 10) - assertEquals(state, "FINISHED") + assertEquals("FINISHED", state) // check data qt_count6 """ SELECT COUNT() from ${tableName}; """ + + // BUILD INDEX with error injection + sql """ ALTER TABLE ${tableName} ADD INDEX idx_url (`url`) USING INVERTED """ + GetDebugPoint().enableDebugPointForAllBEs("IndexBuilder::handle_single_rowset") + sql """ BUILD INDEX idx_url ON ${tableName}; """ + state = wait_for_last_build_index_on_table_finish(tableName, timeout) + assertEquals("wait_timeout", state) + // check data + qt_count7 """ SELECT COUNT() from ${tableName}; """ + + GetDebugPoint().disableDebugPointForAllBEs("IndexBuilder::handle_single_rowset") + // timeout * 10 for possible fe schedule delay + state = wait_for_last_build_index_on_table_finish(tableName, timeout * 10) + assertEquals("FINISHED", state) + // check data + qt_count8 """ SELECT COUNT() from ${tableName}; """ } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org