sanpwc commented on a change in pull request #321:
URL: https://github.com/apache/ignite-3/pull/321#discussion_r704220705



##########
File path: 
modules/raft/src/main/java/org/apache/ignite/raft/jraft/rpc/impl/RaftGroupServiceImpl.java
##########
@@ -397,35 +462,47 @@ private RaftGroupServiceImpl(
                     else
                         fut.completeExceptionally(err);
                 }
-                else if (resp instanceof RaftErrorResponse) {
-                    RaftErrorResponse resp0 = (RaftErrorResponse) resp;
+                else if (resp instanceof RpcRequests.ErrorResponse) {
+                    RpcRequests.ErrorResponse resp0 = 
(RpcRequests.ErrorResponse) resp;
 
-                    if (resp0.errorCode() == null) { // Handle OK response.
-                        leader = peer; // The OK response was received from a 
leader.
+                    if (resp0.errorCode() == RaftError.SUCCESS.getNumber()) { 
// Handle OK response.
+                        leader = PeerId.fromPeer(peer); // The OK response was 
received from a leader.
 
                         fut.complete(null); // Void response.
                     }
-                    else if (resp0.errorCode().equals(NO_LEADER)) {
+                    else if (resp0.errorCode() == 
(RaftError.EBUSY.getNumber()) ||
+                        resp0.errorCode() == (RaftError.EAGAIN.getNumber())) {
                         executor.schedule(() -> {
-                            sendWithRetry(randomNode(), req, stopTime, fut);
+                            sendWithRetry(peer, req, stopTime, fut);
 
                             return null;
                         }, retryDelay, TimeUnit.MILLISECONDS);
                     }
-                    else if (resp0.errorCode().equals(LEADER_CHANGED)) {
-                        leader = resp0.newLeader(); // Update a leader.
+                    else if (resp0.errorCode() == 
(RaftError.EPERM.getNumber())) {

Review comment:
       getNumber() meaningful))




-- 
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]


Reply via email to