chungen0126 commented on code in PR #11893:
URL: https://github.com/apache/ozone/pull/11893#discussion_r4463423593
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerRatisServer.java:
##########
@@ -405,15 +408,27 @@ private void updateRatisConfiguration(List<RaftPeer>
followers, List<RaftPeer> l
SetConfigurationRequest request = new SetConfigurationRequest(clientId,
server.getId(), raftGroupId, nextCallId(), followers, listeners);
- RaftClientReply raftClientReply = server.setConfiguration(request);
- if (raftClientReply.isSuccess()) {
+ try {
+ RaftClientReply raftClientReply = server.setConfiguration(request);
+ if (!raftClientReply.isSuccess()) {
+ // Allow bootstrap to retry after leadership loss.
+ NotLeaderException ex = raftClientReply.getNotLeaderException();
+ if (ex != null) {
+ throw OMNotLeaderException.convertToOMNotLeaderException(
+ ex, getRaftPeerId()
+ );
Review Comment:
Maybe we should add some logs here.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerRatisServer.java:
##########
@@ -405,15 +408,27 @@ private void updateRatisConfiguration(List<RaftPeer>
followers, List<RaftPeer> l
SetConfigurationRequest request = new SetConfigurationRequest(clientId,
server.getId(), raftGroupId, nextCallId(), followers, listeners);
- RaftClientReply raftClientReply = server.setConfiguration(request);
- if (raftClientReply.isSuccess()) {
+ try {
+ RaftClientReply raftClientReply = server.setConfiguration(request);
+ if (!raftClientReply.isSuccess()) {
+ // Allow bootstrap to retry after leadership loss.
+ NotLeaderException ex = raftClientReply.getNotLeaderException();
+ if (ex != null) {
+ throw OMNotLeaderException.convertToOMNotLeaderException(
+ ex, getRaftPeerId()
+ );
+ }
+
+ LOG.error("Failed to {} OM {} in Ratis group {}. Ratis " +
+ "SetConfiguration reply: {}", operation.toLowerCase(), nodeId,
raftGroupId,
+ raftClientReply);
+ throw new IOException("Failed to " + operation.toLowerCase() + " OM "
+ nodeId + " in " +
+ "Ratis ring.");
+ }
+
LOG.info("{} OM {} in Ratis group {}.", operation, nodeId, raftGroupId);
- } else {
- LOG.error("Failed to {} OM {} in Ratis group {}. Ratis " +
- "SetConfiguration reply: {}", operation.toLowerCase(), nodeId,
raftGroupId,
- raftClientReply);
- throw new IOException("Failed to " + operation.toLowerCase() + " OM " +
nodeId + " in " +
- "Ratis ring.");
+ } catch (ReconfigurationInProgressException ex) {
+ throw new OMLeaderNotReadyException(ex.getMessage());
}
Review Comment:
Maybe we should also add some logs here.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerRatisServer.java:
##########
@@ -405,15 +408,27 @@ private void updateRatisConfiguration(List<RaftPeer>
followers, List<RaftPeer> l
SetConfigurationRequest request = new SetConfigurationRequest(clientId,
server.getId(), raftGroupId, nextCallId(), followers, listeners);
- RaftClientReply raftClientReply = server.setConfiguration(request);
- if (raftClientReply.isSuccess()) {
+ try {
+ RaftClientReply raftClientReply = server.setConfiguration(request);
+ if (!raftClientReply.isSuccess()) {
+ // Allow bootstrap to retry after leadership loss.
+ NotLeaderException ex = raftClientReply.getNotLeaderException();
+ if (ex != null) {
+ throw OMNotLeaderException.convertToOMNotLeaderException(
+ ex, getRaftPeerId()
+ );
Review Comment:
Maybe we should add some log here.
--
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]