[Bug] Proxy gRPC queryAssignment can set a null master broker
- Dominant language
- Java
- Stars
- 22.6k
- Forks
- 12k
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 27
Description
### Problem
`RouteActivity#queryAssignment` assumes every broker map contains the master broker id:
```java
Broker broker = brokerIdMap.get(MixAll.MASTER_ID);
...
.setBroker(broker)
```
If route metadata only has non-master broker entries, `broker` is null and the protobuf builder can fail while building the assignment.
### Expected behavior
A queue row without a master broker should be skipped. If no assignment can be built after skipping invalid rows, the existing `FORBIDDEN` / `no readable queue` response should be returned instead of failing the request exceptionally.
### Impact
Malformed or partial route metadata can make Proxy gRPC `QueryAssignment` fail instead of returning a controlled response. This affects the Proxy/gRPC client assignment path.
### Suggested fix
- Add a null check after `brokerIdMap.get(MixAll.MASTER_ID)`.
- Continue to the next queue row when the master broker is absent.
- Add regression coverage for a broker map that contains only a non-master broker id.
Contributor guide
Research direction
Start at RouteActivity#queryAssignment and trace the Proxy gRPC QueryAssignment assignment-building path. Add regression coverage for a broker map containing only a non-master broker id; done means that row is skipped and an otherwise empty result returns the existing FORBIDDEN / no readable queue response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grpc, java
- Domain
- api, backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 73/100