suneet-s commented on a change in pull request #10363:
URL: https://github.com/apache/druid/pull/10363#discussion_r485188552



##########
File path: 
server/src/main/java/org/apache/druid/segment/loading/LeastBytesUsedStorageLocationSelectorStrategy.java
##########
@@ -36,7 +38,13 @@
 
   private List<StorageLocation> storageLocations;
 
-  public LeastBytesUsedStorageLocationSelectorStrategy(List<StorageLocation> 
storageLocations)
+  @JsonCreator
+  public LeastBytesUsedStorageLocationSelectorStrategy()
+  {
+  }
+
+  @VisibleForTesting
+  LeastBytesUsedStorageLocationSelectorStrategy(List<StorageLocation> 
storageLocations)

Review comment:
       I think this approach is brittle and might break when a new 
implementation of `StorageLocationSelectorStrategy` is added. Instead, I think 
we should make `List<StorageLocation> storageLocations` injectable instead via 
a module, something like
   
   ```
   @Provides
   @Singleton
   public List<StorageLocation> provideStorageLocations(SegmentLoaderConfig 
config)
   {
     this.locations = new ArrayList<>();
     for (StorageLocationConfig locationConfig : config.getLocations()) {
       locations.add(
           new StorageLocation(
               locationConfig.getPath(),
               locationConfig.getMaxSize(),
               locationConfig.getFreeSpacePercent()
           )
       );
   return locations;
   }
   ```




----------------------------------------------------------------
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to