Jackie-Jiang commented on a change in pull request #3758: Better handle NPE
from getting instance config
URL: https://github.com/apache/incubator-pinot/pull/3758#discussion_r251672911
##########
File path:
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
##########
@@ -284,8 +285,13 @@ public HelixAdmin getHelixAdmin() {
* @return Helix instance config
*/
@Nonnull
- public InstanceConfig getHelixInstanceConfig(@Nonnull String instanceId) {
+ public InstanceConfig getHelixInstanceConfig(@Nonnull String instanceId)
throws InstanceNotFoundException {
ZNRecord znRecord = _cacheInstanceConfigsDataAccessor.get("/" +
instanceId, null, AccessOption.PERSISTENT);
+ if (znRecord == null) {
Review comment:
I prefer returning `null` if instance does not exist, and the caller can
handle null value accordingly (similar to Map.get() behavior).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]