apache / apache/pinot

throw exception in `BaseBrokerStarter#getDefaultBrokerId()`

Open
#10,965 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
6.1k
Forks
1.5k
Avg merge
1d 21h
Merged PRs (30d)
189

Description

`brokerId` is assigned as below:([code](https://github.com/apache/pinot/blob/24c5d8fe8521b91e68dd07294a3f57b067c0d525/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/BaseBrokerStarter.java#L280))
```
String brokerId = _brokerConf.getProperty(Broker.CONFIG_OF_BROKER_ID, getDefaultBrokerId());
```

A valid value for `brokerId` is important in many components, for example it's required in v2 engine to guarantee an unique requestId. It's preferred to throw an exception to stop broker starter instead of return an empty string.
```
private String getDefaultBrokerId() {
try {
return InetAddress.getLocalHost().getHostName();
} catch (Exception e) {
LOGGER.error("Caught exception while getting default broker Id", e);
return "";
}
}
```

cc @jackjlli

Contributor guide

Open the contributing guide

Research direction

Read the linked BaseBrokerStarter.java location and inspect getDefaultBrokerId() together with the brokerId assignment. Verify the broker startup behavior when InetAddress.getLocalHost().getHostName() fails, and confirm that a valid configured broker ID remains unaffected. Done means startup no longer proceeds with an empty default broker ID.

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
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.