morningman commented on a change in pull request #3143: Non blocking OlapTableSink URL: https://github.com/apache/incubator-doris/pull/3143#discussion_r398612691
########## File path: be/src/exec/tablet_sink.cpp ########## @@ -186,80 +267,89 @@ void NodeChannel::cancel() { closure->ref(); closure->cntl.set_timeout_ms(_rpc_timeout_ms); - _stub->tablet_writer_cancel(&closure->cntl, - &request, - &closure->result, - closure); + _stub->tablet_writer_cancel(&closure->cntl, &request, &closure->result, closure); request.release_id(); - // reset batch - _batch.reset(); + // Beware of the destruct sequence. RowBatches will use mem_trackers(include ancestors). + // Delete RowBatches here is a better choice to reduce the potential of dtor errors. + { + std::lock_guard<std::mutex> lg(_pending_batches_lock); + std::queue<AddBatchReq> empty; + std::swap(_pending_batches, empty); + _cur_batch.reset(); + } } -Status NodeChannel::_wait_in_flight_packet() { - if (!_has_in_flight_packet) { - return Status::OK(); +int NodeChannel::try_send_and_fetch_status() { Review comment: Why not using bool as return value? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org