sumitagrawl commented on code in PR #7723:
URL: https://github.com/apache/ozone/pull/7723#discussion_r1948798947


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/ReconTaskControllerImpl.java:
##########
@@ -263,7 +266,7 @@ private void processTasks(
               taskStatusUpdaterManager.getTaskStatusUpdater(taskName);
           if (!result.getRight().getRight()) {
             LOG.error("Task {} failed", taskName);
-            failedTasks.add(new ImmutablePair<>(result.getLeft(), 
result.getRight().getLeft()));
+            failedTasks.add(new ImmutablePair<>(taskName, 
result.getRight().getLeft()));

Review Comment:
   IMO, the result TaskResult as pojo can be create, instead of going multiple 
level pair and other data structure in it. Pojo can be pre-init with 
Collections.emptyMap() to optimize memory.
   This will help in redability and changes to all methods.



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/ReconTaskControllerImpl.java:
##########
@@ -100,23 +100,23 @@ public void registerTask(ReconOmTask task) {
   @Override
   public synchronized void consumeOMEvents(OMUpdateEventBatch events, 
OMMetadataManager omMetadataManager) {
     if (!events.isEmpty()) {
-      Collection<NamedCallableTask<Pair<String, Pair<Integer, Boolean>>>> 
tasks = new ArrayList<>();
-      List<Pair<String, Integer>> failedTasks = new ArrayList<>();
+      Collection<NamedCallableTask<Pair<String, Pair<Map<String, Integer>, 
Boolean>>>> tasks = new ArrayList<>();
+      List<Pair<String, Map<String, Integer>>> failedTasks = new ArrayList<>();
       for (Map.Entry<String, ReconOmTask> taskEntry :
           reconOmTasks.entrySet()) {
         ReconOmTask task = taskEntry.getValue();
         ReconTaskStatusUpdater taskStatusUpdater = 
taskStatusUpdaterManager.getTaskStatusUpdater(task.getTaskName());
         taskStatusUpdater.recordRunStart();
         // events passed to process method is no longer filtered
-        tasks.add(new NamedCallableTask<>(task.getTaskName(), () -> 
task.process(events, 0)));
+        tasks.add(new NamedCallableTask<>(task.getTaskName(), () -> 
task.process(events, new HashMap<>())));

Review Comment:
   it can be Collections.emptyMap() to avoid allocation. Similar can be done at 
different places where new of hashmap is done.



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