Skip to content

[ISSUE #10770] Skip queryAssignment queues without master broker - #10771

Open
Aias00 wants to merge 1 commit into
apache:developfrom
Aias00:fix/proxy-query-assignment-missing-master
Open

[ISSUE #10770] Skip queryAssignment queues without master broker#10771
Aias00 wants to merge 1 commit into
apache:developfrom
Aias00:fix/proxy-query-assignment-missing-master

Conversation

@Aias00

@Aias00 Aias00 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What changed

This PR makes Proxy gRPC RouteActivity#queryAssignment skip queue rows that do not have a master broker entry in the broker map.

Previously, the code passed a possibly-null master Broker into the protobuf MessageQueue builder, which could fail the request exceptionally when route metadata only had non-master broker ids.

Why

Malformed or partial route metadata should produce a controlled assignment response. If no valid assignment can be built after skipping invalid rows, the existing FORBIDDEN / no readable queue response is returned.

Fixes #10770.

Verification

mvn -pl proxy -Dtest=RouteActivityTest test

Result: BUILD SUCCESS. RouteActivityTest ran 8 tests with 0 failures/errors/skips. Checkstyle and SpotBugs also passed in the Maven run.

Copilot AI review requested due to automatic review settings August 3, 2026 06:40

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

This PR hardens Proxy gRPC RouteActivity#queryAssignment against malformed/partial route metadata by skipping queue rows that don’t have a master broker entry, avoiding exceptional failures during protobuf MessageQueue construction and instead returning the existing controlled FORBIDDEN response when no valid assignments remain.

Changes:

  • Skip queue rows where brokerIdMap.get(MixAll.MASTER_ID) returns null in RouteActivity#queryAssignment.
  • Add a regression test covering route metadata that only contains non-master broker IDs.

Reviewed changes

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

File Description
proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/route/RouteActivity.java Skips queue rows lacking a master broker to prevent null broker usage when building assignments.
proxy/src/test/java/org/apache/rocketmq/proxy/grpc/v2/route/RouteActivityTest.java Adds coverage for the “missing master broker” route-metadata scenario, asserting a controlled FORBIDDEN response with no assignments.

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

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.23%. Comparing base (eddb235) to head (609f468).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10771      +/-   ##
=============================================
- Coverage      48.24%   48.23%   -0.01%     
+ Complexity     13496    13492       -4     
=============================================
  Files           1380     1380              
  Lines         101104   101106       +2     
  Branches       13107    13108       +1     
=============================================
- Hits           48773    48770       -3     
- Misses         46350    46354       +4     
- Partials        5981     5982       +1     

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

Review by github-manager-bot

Summary

Adds null check for broker after brokerIdMap.get(MixAll.MASTER_ID) in DefaultConsumerAssignor.queryAssignment(), preventing NullPointerException when the master broker is missing from the route result.

Findings

  • [Info] The fix is correct and minimal. Returning a FORBIDDEN result when the master broker is unavailable is the right behavior — the client should not proceed with assignment from an incomplete route.
  • [Info] Test coverage verifies that a missing master broker results in FORBIDDEN with no assignments.

Suggestions

  • None. Clean, targeted fix.

LGTM.


Automated review by github-manager-bot

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 gRPC queryAssignment can set a null master broker

4 participants