neils-dev commented on code in PR #3409:
URL: https://github.com/apache/ozone/pull/3409#discussion_r1103497908
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerRatisServer.java:
##########
@@ -807,6 +810,57 @@ public RaftPeerId getRaftPeerId() {
return this.raftPeerId;
}
+ @VisibleForTesting
+ public RaftPeerId getRaftLeaderId() {
+ return this.getRaftLeader() == null ? null : this.getRaftLeader().getId();
+ }
+
+ @VisibleForTesting
+ public String getRaftLeaderAddress() {
+ if (this.getRaftLeader() == null) {
+ return null;
+ }
+ InetAddress leaderInetAddress = null;
+ try {
+ Optional<String> hostname =
+ HddsUtils.getHostName(getRaftLeader().getAddress());
+ if (hostname.isPresent()) {
+ leaderInetAddress = InetAddress.getByName(hostname.get());
+ }
+ } catch (IOException ex) {
+ LOG.error("OM Ratis LeaderInetAddress {} is unresolvable",
+ getRaftLeader().getAddress());
+ }
+ return leaderInetAddress == null ? null :
+ leaderInetAddress.toString();
+ }
+
+ @VisibleForTesting
+ public RaftPeer getRaftLeader() {
+ RaftPeerId leaderId = null;
Review Comment:
Can we either reuse `OzoneManagerRatisServer.getLeader()` or replace
`getLeader()` with `getRaftLeader()`? Do we need both?
--
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]