Copilot commented on code in PR #61856:
URL: https://github.com/apache/doris/pull/61856#discussion_r3009329256
##########
be/src/storage/index/bloom_filter/bloom_filter_index_writer.cpp:
##########
@@ -179,7 +179,13 @@ Status
PrimaryKeyBloomFilterIndexWriterImpl::add_values(const void* values, size
const auto* v = (const Slice*)values;
for (int i = 0; i < count; ++i) {
Slice new_value;
- RETURN_IF_CATCH_EXCEPTION(_type_info->deep_copy(&new_value, v,
_arena));
+ new_value.size = v->size;
+ if (v->size > 0) {
+ new_value.data = _arena.alloc(v->size);
+ memcpy(new_value.data, v->data, v->size);
+ } else {
+ new_value.data = nullptr;
+ }
Review Comment:
`PrimaryKeyBloomFilterIndexWriterImpl::add_values` used to wrap the
deep-copy path in `RETURN_IF_CATCH_EXCEPTION(...)`, which converts
allocation/oom exceptions (e.g., from `Arena::alloc`) into a returned `Status`.
The new manual copy path allocates via `_arena.alloc` without this wrapper, so
`std::bad_alloc`/tracker exceptions can escape and violate the method contract
(“return error when memory is exhausted”), potentially crashing the writer on
OOM. Wrap the allocation+memcpy logic (or the whole loop body) in
`RETURN_IF_CATCH_EXCEPTION` and return the resulting error `Status` on
exception.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]