himanshug commented on a change in pull request #8038: Making optimal usage of 
multiple segment cache locations
URL: https://github.com/apache/incubator-druid/pull/8038#discussion_r326289833
 
 

 ##########
 File path: 
server/src/main/java/org/apache/druid/segment/loading/SegmentLoaderConfig.java
 ##########
 @@ -88,19 +92,32 @@ public int getNumBootstrapThreads()
     return numBootstrapThreads == null ? numLoadingThreads : 
numBootstrapThreads;
   }
 
+  public StorageLocationSelectorStrategy 
getStorageLocationSelectorStrategy(List<StorageLocation> storageLocations)
+  {
+    if (locationSelectorStrategy == null) {
+      checkLocationConfigForNull();
+      // default strategy if no strategy is specified in the config
+      locationSelectorStrategy = new 
LeastBytesUsedStorageLocationSelectorStrategy(storageLocations);
+    }
+    return locationSelectorStrategy;
+  }
+
   public File getInfoDir()
   {
     if (infoDir == null) {
-
-      if (locations == null || locations.size() == 0) {
-        throw new ISE("You have no segment cache locations defined. Please 
configure druid.segmentCache.locations to use one or more locations.");
-      }
+      checkLocationConfigForNull();
       infoDir = new File(locations.get(0).getPath(), "info_dir");
     }
-
     return infoDir;
   }
 
+  private void checkLocationConfigForNull()
 
 Review comment:
   can you check if putting `@NotNull` on `locations` automatically does that ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to