sanpwc commented on a change in pull request #321:
URL: https://github.com/apache/ignite-3/pull/321#discussion_r704058164
##########
File path:
modules/raft/src/main/java/org/apache/ignite/raft/jraft/rpc/impl/ActionRequestProcessor.java
##########
@@ -165,25 +161,17 @@ private void sendError(RpcContext ctx, RaftErrorCode
errorCode, String msg) {
private void sendError(RpcContext ctx, Status status, Node node) {
RaftError raftError = status.getRaftError();
- RaftErrorCode raftErrorCode = RaftErrorCode.ILLEGAL_STATE;
-
PeerId newLeader = null;
if (raftError == RaftError.EPERM) {
Review comment:
excessive {} for one-liner
##########
File path:
modules/raft/src/main/java/org/apache/ignite/raft/jraft/rpc/impl/ActionRequestProcessor.java
##########
@@ -165,25 +161,17 @@ private void sendError(RpcContext ctx, RaftErrorCode
errorCode, String msg) {
private void sendError(RpcContext ctx, Status status, Node node) {
RaftError raftError = status.getRaftError();
- RaftErrorCode raftErrorCode = RaftErrorCode.ILLEGAL_STATE;
-
PeerId newLeader = null;
if (raftError == RaftError.EPERM) {
newLeader = node.getLeaderId();
- PeerId myId = node.getNodeId().getPeerId();
-
- raftErrorCode = newLeader == null || myId.equals(newLeader) ?
- RaftErrorCode.NO_LEADER : RaftErrorCode.LEADER_CHANGED;
}
- else if (status.getRaftError() == RaftError.ESTATEMACHINE)
- raftErrorCode = RaftErrorCode.STATE_MACHINE;
- RaftErrorResponseBuilder resp =
-
factory.raftErrorResponse().errorCode(raftErrorCode).errorMessage(status.getErrorMsg());
+ ErrorResponseBuilder resp =
Review comment:
Is it possible to use
org.apache.ignite.raft.jraft.rpc.RpcResponseFactory#newResponse() 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]