somandal commented on code in PR #12297: URL: https://github.com/apache/pinot/pull/12297#discussion_r1463557078
########## pinot-core/src/main/java/org/apache/pinot/core/data/manager/BaseTableDataManager.java: ########## @@ -223,8 +224,12 @@ protected void releaseAndRemoveAllSegments() { segmentDataManagers = new ArrayList<>(_segmentDataManagerMap.values()); _segmentDataManagerMap.clear(); } - for (SegmentDataManager segmentDataManager : segmentDataManagers) { - releaseSegment(segmentDataManager); + if (!segmentDataManagers.isEmpty()) { + ExecutorService stopExecutorService = Executors.newFixedThreadPool(segmentDataManagers.size()); + for (SegmentDataManager segmentDataManager : segmentDataManagers) { + stopExecutorService.submit(() -> releaseSegment(segmentDataManager)); + } + stopExecutorService.shutdown(); Review Comment: +1 to Sidd's comment here. We are calling shutdown here, and then adding a try catch to await termination for up to 10 minutes. based on the shutdown documentation: ``` * Initiates an orderly shutdown in which previously submitted * tasks are executed, but no new tasks will be accepted. * Invocation has no additional effect if already shut down. * * <p>This method does not wait for previously submitted tasks to * complete execution. Use {@link #awaitTermination awaitTermination} * to do that. ``` -- 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