amaliujia commented on a change in pull request #213:
URL: https://github.com/apache/incubator-ratis/pull/213#discussion_r508125067
##########
File path:
ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyServerStreamRpc.java
##########
@@ -58,51 +63,55 @@
private final StateMachine stateMachine;
private final ConcurrentMap<Long, CompletableFuture<DataStream>> streams =
new ConcurrentHashMap<>();
+ private final ConcurrentMap<Long, List<DataStreamOutput>> peersStreamOutput
= new ConcurrentHashMap<>();
+
+ private List<DataStreamClient> clients = new ArrayList<>();
public NettyServerStreamRpc(RaftPeer server, StateMachine stateMachine) {
this.raftServer = server;
this.stateMachine = stateMachine;
this.channelFuture = buildChannel();
}
- private CompletableFuture<DataStream> getDataStreamFuture(ByteBuf buf,
AtomicBoolean released) {
+ public NettyServerStreamRpc(
+ RaftPeer server, List<RaftPeer> otherPeers,
+ StateMachine stateMachine, RaftProperties properties){
+ this(server, stateMachine);
+ setupClient(otherPeers, properties);
+ }
+
+ private List<DataStreamOutput> getDataStreamOutput() {
+ return clients.stream().map(client ->
client.stream()).collect(Collectors.toList());
Review comment:
This is a very good point. Right now indeed it only keeps a consistent
mapping between stream ids. There might be a case that these stream id are
different.
However, I am thinking even have a consistent stream ids for all servers, it
might not be good enough for debugging. Ideally, we need a way to logging the
path of a request, e.g. from client to server, then to other servers, and
stream id mappings, and where is wrong. And then the best is aggregate such
information and send back to the client.
https://issues.apache.org/jira/browse/RATIS-1098 is partially related to
this goal, meanwhile we might can extend RATIS-1098 or have another Jira to
fully achieve this goal.
There are still some open problems that are not handled. For example, what
if a request in the middle of a stream failed (meanwhile the stream is
ordered), what should we do? How to debug and how to retry or fail the stream.
----------------------------------------------------------------
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]