devabhishekpal commented on code in PR #7517:
URL: https://github.com/apache/ozone/pull/7517#discussion_r1870832277


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/ReconTaskControllerImpl.java:
##########
@@ -173,21 +178,27 @@ public synchronized void reInitializeTasks(
       for (Map.Entry<String, ReconOmTask> taskEntry :
           reconOmTasks.entrySet()) {
         ReconOmTask task = taskEntry.getValue();
+        taskStatusMap.get(task.getTaskName()).setCurrentTaskRunStatus(1);
         tasks.add(() -> task.reprocess(omMetadataManager));
       }
       List<Future<Pair<String, Boolean>>> results =
           executorService.invokeAll(tasks);
       for (Future<Pair<String, Boolean>> f : results) {
         String taskName = f.get().getLeft();
+        ReconTaskStatus reconTaskStatusRecord = taskStatusMap.get(taskName);
+        
reconTaskStatusRecord.setLastUpdatedSeqNumber(omMetadataManager.getLastSequenceNumberFromDB());
+        
reconTaskStatusRecord.setLastUpdatedTimestamp(System.currentTimeMillis());
         if (!f.get().getRight()) {
           LOG.info("Init failed for task {}.", taskName);
+          reconTaskStatusRecord.setLastTaskRunStatus(-1);
+          taskStatusCounter.updateCounter(taskName, false);
         } else {
           //store the timestamp for the task
-          ReconTaskStatus reconTaskStatusRecord = new ReconTaskStatus(taskName,
-              System.currentTimeMillis(),
-              omMetadataManager.getLastSequenceNumberFromDB());
-          reconTaskStatusDao.update(reconTaskStatusRecord);
+          reconTaskStatusRecord.setLastTaskRunStatus(1);
+          taskStatusCounter.updateCounter(taskName, true);
         }
+        reconTaskStatusRecord.setCurrentTaskRunStatus(0);
+        reconTaskStatusDao.update(reconTaskStatusRecord);
       }
     } catch (ExecutionException e) {
       LOG.error("Unexpected error : ", e);

Review Comment:
   For this the ExecutionException is originating from the Future result 
instance when we call `f.get()`. Now since all the tasks are being updated via 
a loop we do not have a way to store reference of the task which threw the 
exception.
   Might be possible to parse the exception message to get the task class but 
that seems more like a hacky solution.
   
   In this scenario we would need to shift the update to the individual task 
implementation to handle the error



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