sashidhar 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_r326451410
##########
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:
`locations` already has `@NotEmpty`. This alone should work. But an
IllegalStateException's being thrown when locations is null or empty with an
error message. As an IllegalStateException is being thrown explicitly didn't
want to change this.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]