Skip to content
Merged
Show file tree
Hide file tree
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 @@ -378,7 +378,7 @@ public void testFailoverWithSuggestedLeader() throws Exception {
}
}
assertNotNull(followerOM);
assertSame(followerOM.getOmRatisServer().checkLeaderStatus(),
assertSame(followerOM.getOmRatisServer().getLeaderStatus(),
OzoneManagerRatisServer.RaftServerStatus.NOT_LEADER);

OzoneManagerProtocolProtos.OMRequest writeRequest =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3051,7 +3051,7 @@ public List<List<String>> getRatisRoles() {
if (null == omRatisServer) {
return getRatisRolesException("Server is shutting down");
}
String leaderReadiness = omRatisServer.checkLeaderStatus().name();
String leaderReadiness = omRatisServer.getLeaderStatus().name();
final RaftPeerId leaderId = omRatisServer.getLeaderId();
if (leaderId == null) {
LOG.error(NO_LEADER_ERROR_MESSAGE);
Expand Down Expand Up @@ -4214,7 +4214,7 @@ public long getMaxUserVolumeCount() {
*/
public boolean isLeaderReady() {
final OzoneManagerRatisServer ratisServer = omRatisServer;
return ratisServer != null && ratisServer.checkLeaderStatus() == LEADER_AND_READY;
return ratisServer != null && ratisServer.getLeaderStatus() == LEADER_AND_READY;
}

/**
Expand All @@ -4225,7 +4225,7 @@ public boolean isLeaderReady() {
public void checkLeaderStatus() throws OMNotLeaderException,
OMLeaderNotReadyException {
OzoneManagerRatisServer.RaftServerStatus raftServerStatus =
omRatisServer.checkLeaderStatus();
omRatisServer.getLeaderStatus();
RaftPeerId raftPeerId = omRatisServer.getRaftPeerId();

switch (raftServerStatus) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ public void addOMToRatisRing(OMNodeDetails newOMNode) throws IOException {
final List<RaftPeer> newPeersList = new ArrayList<>(raftPeerMap.values());
newPeersList.add(newRaftPeer);

checkLeaderStatus();
SetConfigurationRequest request = new SetConfigurationRequest(clientId,
server.getId(), raftGroupId, nextCallId(), newPeersList);

Expand Down Expand Up @@ -390,7 +389,6 @@ public void removeOMFromRatisRing(OMNodeDetails removeOMNode)
.map(Map.Entry::getValue)
.collect(Collectors.toList());

checkLeaderStatus();
SetConfigurationRequest request = new SetConfigurationRequest(clientId,
server.getId(), raftGroupId, nextCallId(), newPeersList);

Expand Down Expand Up @@ -829,7 +827,7 @@ public enum RaftServerStatus {
*
* @return RaftServerStatus.
*/
public RaftServerStatus checkLeaderStatus() {
public RaftServerStatus getLeaderStatus() {
final RaftServer.Division division = getServerDivision();
if (division == null) {
return RaftServerStatus.NOT_LEADER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public OMRequest getLastRequestToSubmit() {
private OMResponse submitReadRequestToOM(OMRequest request)
throws ServiceException {
// Check if this OM is the leader.
RaftServerStatus raftServerStatus = omRatisServer.checkLeaderStatus();
RaftServerStatus raftServerStatus = omRatisServer.getLeaderStatus();
if (raftServerStatus == LEADER_AND_READY ||
request.getCmdType().equals(PrepareStatus)) {
return handler.handleReadRequest(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public OmTestManagers(OzoneConfiguration conf,
"scmTopologyClient", scmTopologyClient);

om.start();
waitFor(() -> om.getOmRatisServer().checkLeaderStatus() == RaftServerStatus.LEADER_AND_READY,
waitFor(() -> om.getOmRatisServer().getLeaderStatus() == RaftServerStatus.LEADER_AND_READY,
10, 10_000);

rpcClient = OzoneClientFactory.getRpcClient(conf);
Expand Down