You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pinot.apache.org by GitBox <gi...@apache.org> on 2019/01/29 02:37:11 UTC

[GitHub] Jackie-Jiang commented on a change in pull request #3758: Better handle NPE from getting instance config

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pinot.apache.org
For additional commands, e-mail: dev-help@pinot.apache.org