From d7659ff34d6049d0bc6bbe2e0ecd5a40e38d59e8 Mon Sep 17 00:00:00 2001 From: hui lai <1353307710@qq.com> Date: Tue, 24 Sep 2024 16:01:52 +0800 Subject: [PATCH] [fix](bytebuffer) fix allocate size improper in append_and_flush (#40613) (#41133) pick (#40613) fix allocate size improper in append_and_flush introduced by https://github.com/apache/doris/pull/38960 --- be/src/io/fs/stream_load_pipe.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/be/src/io/fs/stream_load_pipe.cpp b/be/src/io/fs/stream_load_pipe.cpp index 392125e6fc..45c81971b1 100644 --- a/be/src/io/fs/stream_load_pipe.cpp +++ b/be/src/io/fs/stream_load_pipe.cpp @@ -113,7 +113,7 @@ Status StreamLoadPipe::read_one_message(std::unique_ptr* data, size_t Status StreamLoadPipe::append_and_flush(const char* data, size_t size, size_t proto_byte_size) { SCOPED_ATTACH_TASK(ExecEnv::GetInstance()->stream_load_pipe_tracker()); ByteBufferPtr buf; - RETURN_IF_ERROR(ByteBuffer::allocate(128 * 1024, &buf)); + RETURN_IF_ERROR(ByteBuffer::allocate(BitUtil::RoundUpToPowerOfTwo(size + 1), &buf)); buf->put_bytes(data, size); buf->flip(); return _append(buf, proto_byte_size);