szetszwo commented on a change in pull request #308:
URL: https://github.com/apache/incubator-ratis/pull/308#discussion_r532617176
##########
File path:
ratis-netty/src/main/java/org/apache/ratis/netty/server/DataStreamManagement.java
##########
@@ -61,11 +64,12 @@
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors;
-import java.util.stream.Stream;
public class DataStreamManagement {
public static final Logger LOG =
LoggerFactory.getLogger(DataStreamManagement.class);
+ private Map<RaftGroupId, RaftClient> clientMap = new ConcurrentHashMap<>();
Review comment:
clientMap is unused.
##########
File path:
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
##########
@@ -145,6 +152,16 @@
getMemberId(), () -> commitInfoCache::get, () -> retryCache);
this.startComplete = new AtomicBoolean(false);
+
+ this.raftClient = JavaUtils.memoize(() -> {
+ final RaftProperties p = new RaftProperties();
+ RaftConfigKeys.Rpc.setType(p, SupportedRpcType.GRPC);
Review comment:
It should call getRaftServer().getProperties(). Then, it will use all
the existing settings. We don't have to set RPC type.
```
this.raftClient = JavaUtils.memoize(() -> RaftClient.newBuilder()
.setRaftGroup(group)
.setProperties(getRaftServer().getProperties())
.build());
```
##########
File path: ratis-proto/src/main/proto/Raft.proto
##########
@@ -73,6 +73,7 @@ message StateMachineLogEntryProto {
enum Type {
WRITE = 0;
DATASTREAM = 1;
+ FORWARD = 2;
Review comment:
It seems not needed since StateMachine only sees DATASTREAM requests but
not FORWARD requests.
##########
File path:
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
##########
@@ -719,10 +749,16 @@ public void stepDownOnJvmPause() {
} else {
final RetryCache.CacheEntry cacheEntry = previousResult.getEntry();
+ RaftClientRequest dataStreamRequest = null;
+ if (request.is(TypeCase.FORWARD)) {
+ dataStreamRequest = getDataStreamRaftClientRequest(request);
Review comment:
Just use
```
request = getDataStreamRaftClientRequest(request);
```
##########
File path: ratis-client/src/main/java/org/apache/ratis/client/api/AsyncApi.java
##########
@@ -40,6 +40,8 @@
*/
CompletableFuture<RaftClientReply> send(Message message);
+ CompletableFuture<RaftClientReply> sendForward(Message message);
Review comment:
Similar to DataStreamRpcApi, we should add an AsyncRpcApi so that the
new method could be hidden from users.
The parameter should be a RaftClientRequest.
```
public CompletableFuture<RaftClientReply> sendForward(RaftClientRequest
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.
For queries about this service, please contact Infrastructure at:
[email protected]