You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ratis.apache.org by GitBox <gi...@apache.org> on 2020/10/27 07:51:08 UTC

[GitHub] [incubator-ratis] szetszwo commented on a change in pull request #233: RATIS-1107. Add submitClientRequestAsync in NettyServerStreamRpc

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



##########
File path: ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyServerStreamRpc.java
##########
@@ -166,6 +181,11 @@ public void addRaftPeers(Collection<RaftPeer> newPeers) {
     }
   }
 
+  @VisibleForTesting
+  public CompletableFuture<RaftClientReply> submitClientRequestAsync(RaftClientRequest request) throws IOException {

Review comment:
       Let remove this method (and also TestDataStreamWithCluster; see below) since it is not useful to invoke submitClientRequestAsync() from DataStreamServerRpc.

##########
File path: ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerProxy.java
##########
@@ -324,6 +338,7 @@ public void close() {
 
       try {
         getServerRpc().close();
+        getDataStreamServerRpc().close();

Review comment:
       It should have its own try-catch so that getDataStreamServerRpc() will be closed if getServerRpc().close() throws an exception.

##########
File path: ratis-common/src/main/java/org/apache/ratis/rpc/SupportedRpcType.java
##########
@@ -23,6 +23,7 @@
 /** The RPC types supported. */
 public enum SupportedRpcType implements RpcType {
   NETTY("org.apache.ratis.netty.NettyFactory"),
+  NETTY_DATA_STREAM("org.apache.ratis.netty.NettyDataStreamFactory"),

Review comment:
       We already have SupportedDataStreamType.  I guess we don't need this?

##########
File path: ratis-test/src/test/java/org/apache/ratis/datastream/TestDataStreamWithCluster.java
##########
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ratis.datastream;
+
+import org.apache.ratis.MiniRaftCluster;
+import org.apache.ratis.RaftTestUtil;
+import org.apache.ratis.client.RaftClientConfigKeys;
+import org.apache.ratis.conf.RaftProperties;
+import org.apache.ratis.grpc.MiniRaftClusterWithGrpc;
+import org.apache.ratis.netty.server.NettyServerStreamRpc;
+import org.apache.ratis.protocol.ClientId;
+import org.apache.ratis.protocol.RaftClientReply;
+import org.apache.ratis.protocol.RaftClientRequest;
+import org.apache.ratis.server.impl.RaftServerImpl;
+import org.apache.ratis.statemachine.SimpleStateMachine4Testing;
+import org.apache.ratis.statemachine.StateMachine;
+import org.apache.ratis.util.TimeDuration;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
+
+public class TestDataStreamWithCluster implements MiniRaftClusterWithGrpc.FactoryGet {

Review comment:
       This test is not yet very useful since it just invokes submitClientRequestAsync() from serverStreamRpc.  Let's skip it for now and add a test when Streaming becomes working?

##########
File path: ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyServerStreamRpc.java
##########
@@ -116,6 +121,7 @@ void close() {
     }
   }
 
+  private final RaftServer server;

Review comment:
       This can be removed since it is only used for the test.




----------------------------------------------------------------
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:
users@infra.apache.org