Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import java.util.stream.Collectors;

import com.google.common.base.Optional;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Lists;
import org.apache.hadoop.conf.Configuration;
Expand Down Expand Up @@ -1899,17 +1898,14 @@ public void updatePeerList(List<String> newPeers) {
}
RaftPeer leader = omRatisServer.getLeader();
if (Objects.nonNull(leader)) {
// If we have any leader information, its id cannot be null.
String leaderId = leader.getId().toString();

// If leaderId is empty, then leader is undefined
// and current OM is neither leader nor follower.
// OMHAMetrics shouldn't be registered in that case.
if (!Strings.isNullOrEmpty(leaderId)) {
omHAMetricsInit(leaderId);
} else {
// unregister, to get rid of stale metrics
OMHAMetrics.unRegister();
}
omHAMetricsInit(leaderId);
} else {
LOG.error("OzoneManagerRatisServer leader is null, " +
"unregistering OMHAMetrics.");
// Unregister, to get rid of stale metrics
OMHAMetrics.unRegister();
}
}

Expand Down