wirybeaver commented on code in PR #9710:
URL: https://github.com/apache/pinot/pull/9710#discussion_r1024597451


##########
pinot-common/src/main/java/org/apache/pinot/common/utils/fetcher/SegmentFetcherFactory.java:
##########
@@ -196,4 +206,21 @@ private void fetchAndDecryptSegmentToLocalInternal(String 
uri, File dest, String
       crypter.decrypt(tempDownloadedFile, dest);
     }
   }
+
+  private void fetchAndDecryptSegmentToLocalInternal(@NonNull List<URI> uris, 
File dest, String crypterName)
+          throws Exception {
+    Preconditions.checkArgument(!uris.isEmpty(), "empty uris passed into the 
fetchAndDecryptSegmentToLocalInternal");
+    URI uri = uris.get(RANDOM.nextInt(uris.size()));

Review Comment:
   I am considering whether we should introduces the strategy pattern here: 
user can either choose to pick up a random or go over all peers. The trade of 
between responsiveness and data reliability can be determined by user. For the 
sake of time, I hide the random implementation inside this function. In the 
future, I think the function signature would be
   ```
   private void fetchAndDecryptSegmentToLocalInternal(@NonNull List<URI> uris, 
File dest, String crypterName, PeerDownloadderStrategy strategy);
   
   interface PeerDownloaderStrategy {
   Response download(List<URI> uris, File dest, Context);
   }
   
   class Context {
    String crypterName;
   }
   ```
   



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

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to