[Bug] Proxy ordered route selector should skip malformed orderTopicConf entries
- Dominant language
- Java
- Stars
- 22.6k
- Forks
- 12k
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 27
Description
### Bug description
`MessageQueueSelector.buildWrite` parses ordered topic route data from `TopicRouteWrapper.getOrderTopicConf()` as `brokerName:queueNum` entries separated by `;`.
The current implementation assumes every entry has both parts and that `queueNum` is numeric:
```java
String[] item = broker.split(":");
String brokerName = item[0];
int nums = Integer.parseInt(item[1]);
```
If the route data contains a malformed entry such as `broker-a`, `broker-a:not-a-number`, or an empty broker name, queue selector construction can throw `ArrayIndexOutOfBoundsException` or `NumberFormatException`. This makes one bad ordered-route fragment break the whole proxy write queue selection path.
### Expected behavior
The proxy should tolerate malformed ordered-route fragments. Invalid fragments should be skipped with a diagnostic warning, while valid fragments in the same `orderTopicConf` should still be used to build write queues.
### Affected area
`proxy` module, route selection for ordered topic write queues.
### Suggested fix
- Validate each `orderTopicConf` fragment before parsing.
- Skip entries with missing broker name, missing queue count, or non-numeric queue count.
- Keep existing behavior for valid `brokerName:queueNum` entries.
- Add unit tests for mixed valid and invalid ordered-route fragments.
Contributor guide
Research direction
Start in the proxy module at MessageQueueSelector.buildWrite and inspect how TopicRouteWrapper.getOrderTopicConf() fragments are parsed. Add unit tests covering mixed valid and malformed brokerName:queueNum entries, then verify that valid fragments still build write queues while invalid ones produce warnings and do not throw.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100