[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
This commit is contained in:
hui lai
2024-09-24 16:01:52 +08:00
committed by GitHub
parent 602275d1fe
commit d7659ff34d

View File

@ -113,7 +113,7 @@ Status StreamLoadPipe::read_one_message(std::unique_ptr<uint8_t[]>* 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);