ankitsultana commented on code in PR #12960: URL: https://github.com/apache/pinot/pull/12960#discussion_r1605604062
########## pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/BaseTaskExecutor.java: ########## @@ -101,4 +109,33 @@ 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, () -> { Review Comment: @tibrewalpratik17 : I merged the PR, but want to call out that we are not decrypting the segment here. You can use `fetchAndDecryptSegmentToLocal` instead in a follow-up PR? -- 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