This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 55569261057 [Bug](cherry-pick) Fix exception-unsafe in aggregation
node #28483 (#28981)
55569261057 is described below
commit 55569261057662903123029ea45db25defe8f596
Author: xy720 <[email protected]>
AuthorDate: Mon Dec 25 23:09:30 2023 +0800
[Bug](cherry-pick) Fix exception-unsafe in aggregation node #28483 (#28981)
---
be/src/vec/exec/vaggregation_node.h | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/be/src/vec/exec/vaggregation_node.h
b/be/src/vec/exec/vaggregation_node.h
index 6615166d7dd..2eafe03fd50 100644
--- a/be/src/vec/exec/vaggregation_node.h
+++ b/be/src/vec/exec/vaggregation_node.h
@@ -758,12 +758,26 @@ public:
private:
void _expand() {
_index_in_sub_container = 0;
- _current_keys = _arena_pool.alloc(_size_of_key *
SUB_CONTAINER_CAPACITY);
- _key_containers.emplace_back(_current_keys);
-
- _current_agg_data =
(AggregateDataPtr)_arena_pool.alloc(_size_of_aggregate_states *
-
SUB_CONTAINER_CAPACITY);
- _value_containers.emplace_back(_current_agg_data);
+ _current_keys = nullptr;
+ _current_agg_data = nullptr;
+ try {
+ _current_keys = _arena_pool.alloc(_size_of_key *
SUB_CONTAINER_CAPACITY);
+ _key_containers.emplace_back(_current_keys);
+
+ _current_agg_data =
(AggregateDataPtr)_arena_pool.alloc(_size_of_aggregate_states *
+
SUB_CONTAINER_CAPACITY);
+ _value_containers.emplace_back(_current_agg_data);
+ } catch (...) {
+ if (_current_keys) {
+ _key_containers.pop_back();
+ _current_keys = nullptr;
+ }
+ if (_current_agg_data) {
+ _value_containers.pop_back();
+ _current_agg_data = nullptr;
+ }
+ throw;
+ }
}
static constexpr uint32_t SUB_CONTAINER_CAPACITY = 8192;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]