smengcl commented on a change in pull request #137: HDDS-2455. Implement
MiniOzoneHAClusterImpl#getOMLeader
URL: https://github.com/apache/hadoop-ozone/pull/137#discussion_r348906923
##########
File path:
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneHAClusterImpl.java
##########
@@ -118,6 +118,19 @@ public OzoneManager getOzoneManager(String omNodeId) {
return this.ozoneManagerMap.get(omNodeId);
}
+ /**
+ * Get OzoneManager leader object.
+ * @return OzoneManager object, could return null if there isn't a leader.
+ */
+ public OzoneManager getOMLeader() {
+ for (OzoneManager ozoneManager : this.ozoneManagers) {
+ if (ozoneManager.isLeader()) {
+ return ozoneManager;
+ }
Review comment:
Indeed this could be a problem. I talked to Arpit about this. It turns out
there could be two OMs asserting themselves are both leaders in a short while,
or there could be no leader. I will update this method to handle those two
cases to some extent.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]