vagetablechicken commented on a change in pull request #3143: Non blocking 
OlapTableSink
URL: https://github.com/apache/incubator-doris/pull/3143#discussion_r399037164
 
 

 ##########
 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:
   I want the consumer to have global observation,  sum() is the simplest way 
to do it.
   And maybe we can add more status(>0) to let consumer know more infos about 
channels. 
   But I think the preliminary design should be simple.
   So current design of status value is "0-channel stopped; 1-still working".

----------------------------------------------------------------
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

Reply via email to