ArafatKhan2198 commented on code in PR #7796:
URL: https://github.com/apache/ozone/pull/7796#discussion_r1946143826
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/FileSizeCountTask.java:
##########
@@ -76,49 +85,72 @@ public FileSizeCountTask(FileCountBySizeDao
fileCountBySizeDao,
*/
@Override
public Pair<String, Boolean> reprocess(OMMetadataManager omMetadataManager) {
- // Map to store the count of files based on file size
- Map<FileSizeCountKey, Long> fileSizeCountMap = new HashMap<>();
+ LOG.info("Starting reprocess of FileSizeCountTask...");
+ long startTime = System.currentTimeMillis();
- // Delete all records from FILE_COUNT_BY_SIZE table
+ // Truncate table first
int execute = dslContext.delete(FILE_COUNT_BY_SIZE).execute();
- LOG.debug("Deleted {} records from {}", execute, FILE_COUNT_BY_SIZE);
-
- // Call reprocessBucket method for FILE_SYSTEM_OPTIMIZED bucket layout
- boolean statusFSO =
- reprocessBucketLayout(BucketLayout.FILE_SYSTEM_OPTIMIZED,
- omMetadataManager,
- fileSizeCountMap);
- // Call reprocessBucket method for LEGACY bucket layout
- boolean statusOBS =
- reprocessBucketLayout(BucketLayout.LEGACY, omMetadataManager,
- fileSizeCountMap);
- if (!statusFSO && !statusOBS) {
- return new ImmutablePair<>(getTaskName(), false);
+ LOG.info("Cleared {} existing records from {}", execute,
FILE_COUNT_BY_SIZE);
+
+ List<Future<Boolean>> futures = new ArrayList<>();
+
+ futures.add(executorService.submit(() ->
+ reprocessBucketLayout(BucketLayout.FILE_SYSTEM_OPTIMIZED,
omMetadataManager)));
+ futures.add(executorService.submit(() ->
+ reprocessBucketLayout(BucketLayout.LEGACY, omMetadataManager)));
+
+ executorService.shutdown();
Review Comment:
@adoroszlai
Originally, we shut down the executor after each run because we were
creating a brand-new executor just for that single run. Once the tasks were
finished, we shut it down to clean up the resources.
But I guess I will remove this shutdown from the reprocess otherwise there
is no point of keeping the executor in the constructor for shairing.
--
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]