wutiangan commented on a change in pull request #4125:
URL: https://github.com/apache/incubator-doris/pull/4125#discussion_r457892910
##########
File path: be/src/runtime/stream_load/stream_load_pipe.h
##########
@@ -85,30 +87,14 @@ class StreamLoadPipe : public MessageBodySink, public
FileReader {
}
Status read_one_message(uint8_t** data, size_t* length) override {
- std::unique_lock<std::mutex> l(_lock);
- while (!_cancelled && !_finished && _buf_queue.empty()) {
- _get_cond.wait(l);
+ if (_total_length == -1) {
+ return Status::InternalError("invalid call");
}
- // cancelled
- if (_cancelled) {
- return Status::InternalError("cancelled");
- }
- // finished
- if (_buf_queue.empty()) {
- DCHECK(_finished);
- *data = nullptr;
- *length = 0;
- return Status::OK();
- }
- auto buf = _buf_queue.front();
- *length = buf->remaining();
- *data = new uint8_t[*length];
- buf->get_bytes((char*)(*data) , *length);
-
- _buf_queue.pop_front();
- _buffered_bytes -= buf->limit;
- _put_cond.notify_one();
- return Status::OK();
+ *data = new uint8_t[_total_length];
Review comment:
what about if _total_lenght == 0?
if total_legth = 0, there may be a memory leak.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]