Skip to content

[ISSUE #10797] Propagate proxy end transaction result - #10798

Open
Aias00 wants to merge 3 commits into
apache:developfrom
Aias00:fix/proxy-end-transaction-10797
Open

[ISSUE #10797] Propagate proxy end transaction result#10798
Aias00 wants to merge 3 commits into
apache:developfrom
Aias00:fix/proxy-end-transaction-10797

Conversation

@Aias00

@Aias00 Aias00 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Fixes #10797

Brief Description

  • Stop returning success before Proxy remoting end-transaction operations complete
  • Write the success response only after messagingProcessor.endTransaction(...) completes
  • Route async failures through the existing remoting error response mapping
  • Add regression tests for success and broker-exception failure responses

How Did You Test This Change?

  • mvn -pl proxy -Dtest=TransactionActivityTest test

The target test passed: 2 tests, 0 failures, 0 errors. The Maven run completed with BUILD SUCCESS; the output still includes existing Jacoco/JDK17 instrumentation warnings.

Copilot AI review requested due to automatic review settings August 3, 2026 14:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Propagates the async result of proxy end-transaction operations to the remoting response, ensuring success is only returned after the underlying endTransaction(...) future completes (and failures map to the appropriate error response).

Changes:

  • Make TransactionActivity write the response asynchronously after messagingProcessor.endTransaction(...) completes.
  • Route async failures through the existing remoting error response mapping.
  • Add regression tests for success and broker-exception failure responses.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/TransactionActivity.java Defers success response until the end-transaction future completes; maps async failures to error responses.
proxy/src/test/java/org/apache/rocketmq/proxy/remoting/activity/TransactionActivityTest.java Adds unit coverage for async success and async failure response behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +80 to +84
@Test
public void testEndTransactionWritesSuccessAfterFutureCompletes() throws Exception {
when(messagingProcessor.endTransaction(any(), eq("topic"), eq("transactionId"), eq("msgId"),
eq("producerGroup"), eq(TransactionStatus.COMMIT), eq(false)))
.thenReturn(CompletableFuture.completedFuture(null));
@codecov-commenter

codecov-commenter commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 48.51%. Comparing base (293f588) to head (e10c126).

Files with missing lines Patch % Lines
...q/proxy/remoting/activity/TransactionActivity.java 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10798      +/-   ##
=============================================
- Coverage      48.60%   48.51%   -0.10%     
+ Complexity     13690    13653      -37     
=============================================
  Files           1381     1381              
  Lines         101464   101469       +5     
  Branches       13187    13187              
=============================================
- Hits           49318    49228      -90     
- Misses         46158    46222      +64     
- Partials        5988     6019      +31     

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

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Propagates the end-transaction result from the proxy to the caller instead of silently discarding it. Ensures transaction status is correctly communicated. Clean change with proper error handling.

LGTM.


Automated review by github-manager-bot

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — defensive improvement with proper error handling and test coverage.


Automated review by github-manager-bot

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Defensive fix with proper validation and test coverage. LGTM.


Automated review by github-manager-bot

@Aias00

Aias00 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the review comments. The asynchronous failure path now unwraps CompletionException before the existing remoting error mapper runs, so MQBrokerException response codes and remarks are retained.

The existing test suite already returns a completed ChannelFuture and verifies that no success response is written before the pending endTransaction future completes.

Verified with:

mvn -q -pl proxy -am -Dtest=TransactionActivityTest -Dsurefire.failIfNoSpecifiedTests=false test

@Aias00
Aias00 force-pushed the fix/proxy-end-transaction-10797 branch from 70960ba to e10c126 Compare August 14, 2026 13:20
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] Proxy remoting end transaction ignores async failures

4 participants