tibrewalpratik17 commented on code in PR #12960:
URL: https://github.com/apache/pinot/pull/12960#discussion_r1605566937


##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/BaseTaskExecutor.java:
##########
@@ -101,4 +106,29 @@ private void addTaskMeterMetrics(MinionMeter meter, long 
unitCount, String table
     _minionMetrics.addMeteredTableValue(tableName, meter, unitCount);
     _minionMetrics.addMeteredTableValue(tableName, taskType, meter, unitCount);
   }
+
+  protected void downloadSegmentToLocal(String tableNameWithType, String 
segmentName, String deepstoreURL,
+      String taskType, File tarredSegmentFile, String crypterName)
+      throws Exception {
+    LOGGER.info("Downloading segment from {} to {}", deepstoreURL, 
tarredSegmentFile.getAbsolutePath());
+    try {
+      // download from deepstore first
+      SegmentFetcherFactory.fetchAndDecryptSegmentToLocal(deepstoreURL, 
tarredSegmentFile, crypterName);
+    } catch (Exception e) {
+      LOGGER.error("Segment download failed from deepstore for {}, 
crypter:{}", deepstoreURL, crypterName, e);
+      TableConfig tableConfig = getTableConfig(tableNameWithType);
+      String peerDownloadScheme = 
tableConfig.getValidationConfig().getPeerSegmentDownloadScheme();
+      if (MinionTaskUtils.extractMinionAllowDownloadFromServer(tableConfig, 
taskType) && peerDownloadScheme != null) {
+        LOGGER.info("Trying to download from servers for segment {} post 
deepstore download failed", segmentName);
+        SegmentFetcherFactory.getSegmentFetcher(
+                
getTableConfig(tableNameWithType).getValidationConfig().getPeerSegmentDownloadScheme())
+            .fetchSegmentToLocal(segmentName, () ->
+                
PeerServerSegmentFinder.getPeerServerURIs(MINION_CONTEXT.getHelixManager(),

Review Comment:
   yeah makes sense! Updated.



-- 
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: [email protected]

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