From dd1ca5a3c838c35b2ab95f755e7661fc489fa8b5 Mon Sep 17 00:00:00 2001 From: yiguolei Date: Tue, 8 Apr 2025 16:26:33 +0800 Subject: [PATCH 1/3] [enhancement](memoryfailed) throw exception instead of log fatal during memory allocate failed --- be/src/vec/aggregate_functions/aggregate_function_sort.h | 6 +++++- .../aggregate_functions/aggregate_function_window_funnel.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/be/src/vec/aggregate_functions/aggregate_function_sort.h b/be/src/vec/aggregate_functions/aggregate_function_sort.h index c025c42495cf1b..48eb1c2e15fae2 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_sort.h +++ b/be/src/vec/aggregate_functions/aggregate_function_sort.h @@ -90,7 +90,11 @@ struct AggregateFunctionSortData { PBlock pblock; pblock.ParseFromString(data); auto st = block.deserialize(pblock); - CHECK(st.ok()); + // If memory allocate failed during deserialize, st is not ok, throw exception here to + // stop the query. + if (!st.ok()) { + throw doris::Exception(ErrorCode::INTERNAL_ERROR, status.to_string()); + } } void add(const IColumn** columns, size_t columns_num, size_t row_num) { diff --git a/be/src/vec/aggregate_functions/aggregate_function_window_funnel.h b/be/src/vec/aggregate_functions/aggregate_function_window_funnel.h index efd51444c56560..afc728b24a2b43 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_window_funnel.h +++ b/be/src/vec/aggregate_functions/aggregate_function_window_funnel.h @@ -359,6 +359,8 @@ struct WindowFunnelState { } Block block; auto status = block.deserialize(pblock); + // If memory allocate failed during deserialize, st is not ok, throw exception here to + // stop the query. if (!status.ok()) { throw doris::Exception(ErrorCode::INTERNAL_ERROR, status.to_string()); } From 7b688f71f20283e0a021003d24f43e41e0377a2b Mon Sep 17 00:00:00 2001 From: yiguolei Date: Tue, 8 Apr 2025 16:34:35 +0800 Subject: [PATCH 2/3] f --- be/src/vec/aggregate_functions/aggregate_function_sort.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/be/src/vec/aggregate_functions/aggregate_function_sort.h b/be/src/vec/aggregate_functions/aggregate_function_sort.h index 48eb1c2e15fae2..6812badff7a86b 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_sort.h +++ b/be/src/vec/aggregate_functions/aggregate_function_sort.h @@ -93,7 +93,7 @@ struct AggregateFunctionSortData { // If memory allocate failed during deserialize, st is not ok, throw exception here to // stop the query. if (!st.ok()) { - throw doris::Exception(ErrorCode::INTERNAL_ERROR, status.to_string()); + throw doris::Exception(ErrorCode::INTERNAL_ERROR, st.to_string()); } } From eec0e3391cfba5c24dcceb7f3f3db55cdf897055 Mon Sep 17 00:00:00 2001 From: yiguolei Date: Tue, 8 Apr 2025 19:16:22 +0800 Subject: [PATCH 3/3] f --- be/src/vec/aggregate_functions/aggregate_function_sort.h | 2 +- .../vec/aggregate_functions/aggregate_function_window_funnel.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/be/src/vec/aggregate_functions/aggregate_function_sort.h b/be/src/vec/aggregate_functions/aggregate_function_sort.h index 6812badff7a86b..e7e50ded37815a 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_sort.h +++ b/be/src/vec/aggregate_functions/aggregate_function_sort.h @@ -93,7 +93,7 @@ struct AggregateFunctionSortData { // If memory allocate failed during deserialize, st is not ok, throw exception here to // stop the query. if (!st.ok()) { - throw doris::Exception(ErrorCode::INTERNAL_ERROR, st.to_string()); + throw doris::Exception(st); } } diff --git a/be/src/vec/aggregate_functions/aggregate_function_window_funnel.h b/be/src/vec/aggregate_functions/aggregate_function_window_funnel.h index afc728b24a2b43..781a621b15748d 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_window_funnel.h +++ b/be/src/vec/aggregate_functions/aggregate_function_window_funnel.h @@ -362,7 +362,7 @@ struct WindowFunnelState { // If memory allocate failed during deserialize, st is not ok, throw exception here to // stop the query. if (!status.ok()) { - throw doris::Exception(ErrorCode::INTERNAL_ERROR, status.to_string()); + throw doris::Exception(status); } mutable_block = MutableBlock(std::move(block)); _reset_columns_ptr();