Skip to content

[ISSUE #10924] Fix gRPC FIFO batch send ordering - #10926

Draft
qianye1001 wants to merge 2 commits into
apache:developfrom
qianye1001:codex/fix-grpc-fifo-batch-send
Draft

[ISSUE #10924] Fix gRPC FIFO batch send ordering#10926
qianye1001 wants to merge 2 commits into
apache:developfrom
qianye1001:codex/fix-grpc-fifo-batch-send

Conversation

@qianye1001

@qianye1001 qianye1001 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What changed

  • select a gRPC FIFO batch queue using its shared message group, so consecutive batches in the same FIFO stream use the same queue;
  • validate batch constraints from the converted message list: supported and consistent type, FIFO message group, encoded size, and message count;
  • reject a gRPC batch when any message explicitly uses bodyEncoding=GZIP; IDENTITY and ENCODING_UNSPECIFIED remain valid as uncompressed input;
  • pass the complete message list through one Proxy send invocation, which the lower client encodes into one SEND_BATCH_MESSAGE request;
  • expand a single Broker batch result into ordered per-message gRPC result entries;
  • add activity-level and protocol-level regression coverage.

Why

For requests containing more than one message, SendMessageQueueSelector ignored messageGroup and used the normal queue-selection pipeline. Consecutive FIFO batches for the same message group could therefore select different queues and lose ordering.

The batch validation also did not explicitly enforce the constraints required by one Broker batch request at the gRPC boundary. A compressed body cannot be put into MessageBatch safely with the current Broker batch protocol, so compressed gRPC batches are rejected before the Broker invocation.

Fixes #10924.

Validation

JDK 8:

mvn -pl proxy -DskipITs -Dspotbugs.skip=true -Dcheckstyle.skip=true -Djacoco.skip=true \
  -Dtest=SendMessageActivityTest \
  -Dsurefire.failIfNoSpecifiedTests=false test

The gRPC activity test passed 16/16; all selected tests passed 17/17.

The protocol-level MQClientAPIExtTest#testSendMessageListAsync also passed and verifies one remoting invocation with request code SEND_BATCH_MESSAGE containing the complete batch.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.81013% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.37%. Comparing base (7eee0fc) to head (e963385).

Files with missing lines Patch % Lines
...mq/proxy/grpc/v2/producer/SendMessageActivity.java 84.00% 6 Missing and 6 partials ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10926      +/-   ##
=============================================
- Coverage      48.45%   48.37%   -0.09%     
+ Complexity     13588    13573      -15     
=============================================
  Files           1380     1380              
  Lines         101196   101242      +46     
  Branches       13130    13140      +10     
=============================================
- Hits           49038    48974      -64     
- Misses         46190    46272      +82     
- Partials        5968     5996      +28     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] gRPC FIFO batch sends ignore the message group when selecting a queue

2 participants