szetszwo commented on code in PR #1490:
URL: https://github.com/apache/ratis/pull/1490#discussion_r3525318505


##########
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java:
##########
@@ -168,9 +168,6 @@ class RaftServerImpl implements RaftServer.Division,
   static final String START_LEADER_ELECTION = CLASS_NAME + 
".startLeaderElection";
   static final String START_COMPLETE = CLASS_NAME + ".startComplete";
 
-  static final CompletableFuture<RaftClientReply> DUMMY_SUCCESS_REPLY
-      = 
CompletableFuture.completedFuture(RaftClientReply.newBuilder().setSuccess().build());

Review Comment:
   I tried to build the dummySuccessReply by setting the required fields.  It 
seems working.
   ```diff
   @@ -260,6 +261,8 @@ class RaftServerImpl implements RaftServer.Division,
      private final ExecutorService clientExecutor;
      private final ThreadGroup threadGroup;
    
   +  private final CompletableFuture<RaftClientReply> dummySuccessReply;
   +
      RaftServerImpl(RaftGroup group, StateMachine stateMachine, 
RaftServerProxy proxy, RaftStorage.StartupOption option)
          throws IOException {
        final RaftPeerId id = proxy.getId();
   @@ -303,6 +306,13 @@ class RaftServerImpl implements RaftServer.Division,
            RaftServerConfigKeys.ThreadPool.clientSize(properties),
            id + "-client");
        this.threadGroup = new ThreadGroup(proxy.getThreadGroup(), 
getMemberId().toString());
   +
   +    this.dummySuccessReply = 
CompletableFuture.completedFuture(RaftClientReply.newBuilder()
   +        .setClientId(ClientId.emptyClientId())
   +        .setServerId(id)
   +        .setGroupId(group.getGroupId())
   +        .setSuccess()
   +        .build());
      }
   ```
   ```diff
   @@ -1183,6 +1199,9 @@ class RaftServerImpl implements RaftServer.Division,
      }
    
      CompletableFuture<RaftClientReply> queryStateMachine(RaftClientRequest 
request) {
   +    if (request.getType().getRead().getDummy()) {
   +      return dummySuccessReply;
   +    }
        return processQueryFuture(stateMachine.query(request.getMessage()), 
request);
      }
   ```
   



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