hemantk-12 commented on code in PR #4490:
URL: https://github.com/apache/ozone/pull/4490#discussion_r1167202843


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotDiffManager.java:
##########
@@ -167,8 +158,19 @@ public SnapshotDiffManager(ManagedRocksDB db,
         new ThreadPoolExecutor.CallerRunsPolicy()
     );
 
-    // TODO: [SNAPSHOT] Load jobs only if it is leader node.
-    //  It could a event-triggered form OM when node is leader and up.
+    // Ideally, loadJobsOnStartUp should run only on OM node, since SnapDiff
+    // is not HA currently and running this on all the nodes would be
+    // inefficient. Especially, when OM node restarts and loses its leadership.
+    // However, it is hard to determine if node is leader node because 
consensus
+    // happens inside Ratis. We can add something like Awaitility.wait() here
+    // but that is not full proof either.

Review Comment:
   As discussed offline, it is possible that node is in `LEADER_AND_NOT_READY` 
state. In that case, response `OzoneManager#isLeaderReady`  will be `false` but 
in actual it is leader but not ready. Hence we have to do polling.
   
   We can't simple use `omRatisServer.checkLeaderStatus() != NOT_LEADER` to 
know if node is leader, because  it could be the case that leader node loses 
its leadership in getting ready phase.



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