FangzuoZhang commented on code in PR #3484:
URL: https://github.com/apache/brpc/pull/3484#discussion_r3891277566


##########
src/brpc/input_messenger.cpp:
##########
@@ -301,9 +454,20 @@ int InputMessenger::ProcessNewMessage(
     // not in the bthread where the polling bthread is located, because the
     // method for processing messages may call synchronization primitives,
     // causing the polling bthread to be scheduled out.
-    if (m->_socket_mode == SOCKET_MODE_RDMA || m->_socket_mode == 
SOCKET_MODE_UBRING) {
+    if (batch_process) {
+        QueueInputMessageBatch(m, &input_batch, &num_bthread_created);
+    }
+    if (m->_socket_mode == SOCKET_MODE_RDMA ||
+        m->_socket_mode == SOCKET_MODE_UBRING) {
         m->_transport->QueueMessage(last_msg, &num_bthread_created, true);
     }

Review Comment:
   Addressed in commit 95368dbd.
   
   When batching is enabled, the final `last_msg` is now appended to the 
current `InputMessageBatch` before the batch is scheduled. It is therefore 
processed sequentially with the preceding messages in that batch instead of 
being scheduled separately.
   
   When batching is disabled, the existing RDMA/UBRing last-message 
optimization is preserved. Progressive-read messages also remain on the 
original individual-message path.
   
   The `batching_consumes_the_last_message` unit test verifies that the final 
message is consumed by the current batch, processed in parsing order, and no 
longer remains in `InputMessageClosure`.



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