szetszwo commented on a change in pull request #264:
URL: https://github.com/apache/incubator-ratis/pull/264#discussion_r520225210



##########
File path: 
ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyServerStreamRpc.java
##########
@@ -247,13 +248,13 @@ public void addRaftPeers(Collection<RaftPeer> newPeers) {
     proxies.addPeers(newPeers);
   }
 
-  private StreamInfo newStreamInfo(ByteBuf buf) {
+  private StreamInfo newStreamInfo(ByteBuf buf, boolean isPrimary) {
     try {
       final RaftClientRequest request = ClientProtoUtils.toRaftClientRequest(
           RaftClientRequestProto.parseFrom(buf.nioBuffer()));
       final StateMachine stateMachine = 
server.getStateMachine(request.getRaftGroupId());
       return new StreamInfo(request, stateMachine.data().stream(request),
-          proxies.getDataStreamOutput(request));
+          isPrimary ? proxies.getDataStreamOutput(request) : 
Collections.EMPTY_LIST);

Review comment:
       It is a good idea.   We may use
   ```
         final List<DataStreamOutputRpc> outs = 
server.getId().equals(request.getServerId())?  
             proxies.getDataStreamOutput(request): Collections.emptyList();
         return new StreamInfo(request, stateMachine.data().stream(request), 
outs);
   ```
   Note that request is RaftClientRequest.
   




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to