github-actions[bot] commented on code in PR #62661:
URL: https://github.com/apache/doris/pull/62661#discussion_r3417519029


##########
be/src/exec/sink/writer/vtablet_writer.cpp:
##########
@@ -1322,14 +1461,25 @@ void VNodeChannel::mark_close(bool hang_wait) {
         return;
     }
 
-    _cur_add_block_request->set_eos(true);
-    _cur_add_block_request->set_hang_wait(hang_wait);
+    bool need_receiver_side_random_bucket_eos =
+            _cur_add_block_request->is_receiver_side_random_bucket();
     {
         std::lock_guard<std::mutex> l(_pending_batches_lock);
         if (!_cur_mutable_block) [[unlikely]] {
             // never had a block arrived. add a dummy block
             _cur_mutable_block = MutableBlock::create_unique();
         }
+        if (need_receiver_side_random_bucket_eos && _cur_mutable_block->rows() 
> 0) {
+            _cur_add_block_request->set_eos(false);
+            auto tmp_add_block_request =
+                    
std::make_shared<PTabletWriterAddBlockRequest>(*_cur_add_block_request);
+            _pending_blocks.emplace(std::move(_cur_mutable_block), 
tmp_add_block_request);
+            _pending_batches_num++;
+            _cur_add_block_request->clear_partition_ids();
+            _cur_mutable_block = MutableBlock::create_unique();

Review Comment:
   When adaptive close splits a final non-empty block from the EOS request, 
this request still contains the compatibility `tablet_ids` added in 
`add_block()`. The split enqueues the data block, clears only `partition_ids`, 
and then reuses `_cur_add_block_request` for an empty EOS block. 
`try_send_pending_block()` validates EOS requests against `tablet_ids_size()`, 
so a normal small adaptive load whose final block did not reach `_batch_size` 
will see `block.rows() == 0` and `request_rows == N`, cancel the channel 
locally, and never send EOS. Clear the compatibility tablet ids here as well. 
This is distinct from the existing EOS `partition_ids` thread because it is 
caused by the newly retained rolling-upgrade `tablet_ids` payload.
   
   ```suggestion
               _cur_add_block_request->clear_tablet_ids();
               _cur_add_block_request->clear_partition_ids();
   ```



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to