diff --git a/be/src/olap/wal/wal_table.cpp b/be/src/olap/wal/wal_table.cpp index aed180c86a3244..a7bb2eba5d64a5 100644 --- a/be/src/olap/wal/wal_table.cpp +++ b/be/src/olap/wal/wal_table.cpp @@ -243,6 +243,8 @@ Status WalTable::_handle_stream_load(int64_t wal_id, const std::string& wal, RETURN_IF_ERROR(_construct_sql_str(wal, label, sql_str)); std::shared_ptr ctx = std::make_shared(_exec_env); ctx->sql_str = sql_str; + ctx->db_id = _db_id; + ctx->table_id = _table_id; ctx->wal_id = wal_id; ctx->label = label; ctx->need_commit_self = false; @@ -253,6 +255,8 @@ Status WalTable::_handle_stream_load(int64_t wal_id, const std::string& wal, ctx->load_src_type = TLoadSourceType::RAW; ctx->max_filter_ratio = 1; auto st = _http_stream_action->process_put(nullptr, ctx); + DBUG_EXECUTE_IF("WalTable::_handle_stream_load.fail", + { st = Status::InternalError("WalTable::_handle_stream_load.fail"); }); if (st.ok()) { // wait stream load finish RETURN_IF_ERROR(ctx->future.get()); diff --git a/regression-test/suites/insert_p0/group_commit/test_group_commit_replay_wal.groovy b/regression-test/suites/insert_p0/group_commit/test_group_commit_replay_wal.groovy index 0fbc3ec0a8d90a..856515b3350528 100644 --- a/regression-test/suites/insert_p0/group_commit/test_group_commit_replay_wal.groovy +++ b/regression-test/suites/insert_p0/group_commit/test_group_commit_replay_wal.groovy @@ -100,7 +100,23 @@ suite("test_group_commit_replay_wal", "nonConcurrent") { sleep(100) } + // replay wal fail + GetDebugPoint().enableDebugPointForAllBEs("WalTable::_handle_stream_load.fail") GetDebugPoint().clearDebugPointsForAllFEs() + getRowCount(4) + + int expectedRowCount = 8 + for (int i = 0; i < 30; i++) { + def result = sql "select count(*) from ${tableName}" + logger.info("table: ${tableName}, rowCount: ${result}, i: ${i}") + if (result[0][0] == expectedRowCount) { + break + } + sleep(1000) + if (i >= 4) { + GetDebugPoint().disableDebugPointForAllBEs("WalTable::_handle_stream_load.fail") + } + } getRowCount(8) // check wal count is 0 } catch (Exception e) {