szetszwo commented on a change in pull request #567:
URL: https://github.com/apache/ratis/pull/567#discussion_r772171343



##########
File path: 
ratis-test/src/test/java/org/apache/ratis/grpc/TestRaftTakeSnapshotWithGrpc.java
##########
@@ -0,0 +1,28 @@
+/**
+ * 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.grpc;
+
+import org.apache.ratis.server.impl.MiniRaftCluster;
+import org.apache.ratis.statemachine.RaftTakeSnapshotTest;
+
+public class TestRaftTakeSnapshotWithGrpc extends RaftTakeSnapshotTest {

Review comment:
       Please remove rpc test.  We will add it with the rpc change later.

##########
File path: 
ratis-test/src/test/java/org/apache/ratis/netty/TestRaftTakeSnapshotWithNetty.java
##########
@@ -0,0 +1,28 @@
+/**
+ * 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.netty;
+
+import org.apache.ratis.server.impl.MiniRaftCluster;
+import org.apache.ratis.statemachine.RaftTakeSnapshotTest;
+
+public class TestRaftTakeSnapshotWithNetty extends RaftTakeSnapshotTest {

Review comment:
       Please remove rpc test.  We will add it with the rpc change later.

##########
File path: 
ratis-server/src/main/java/org/apache/ratis/server/impl/ServerState.java
##########
@@ -468,6 +472,10 @@ long getLastAppliedIndex() {
     return stateMachineUpdater.getStateMachineLastAppliedIndex();
   }
 
+  StateMachineUpdater getStateMachineUpdater() {
+    return stateMachineUpdater;
+  }

Review comment:
       Remove getStateMachineUpdater() since it is not used.

##########
File path: 
ratis-server/src/main/java/org/apache/ratis/server/impl/StateMachineUpdater.java
##########
@@ -253,7 +260,6 @@ private void 
checkAndTakeSnapshot(MemoizedSupplier<List<CompletableFuture<Messag
       if (futures.isInitialized()) {
         JavaUtils.allOf(futures.get()).get();
       }
-

Review comment:
       Please revert this unrelated change.

##########
File path: 
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
##########
@@ -169,6 +170,7 @@ public long getLastAppliedIndex() {
   private final AtomicLong inProgressInstallSnapshotRequest;
   private final AtomicLong installedSnapshotIndex;
   private final AtomicBoolean isSnapshotNull;
+  private final AtomicBoolean finishSnapshot;

Review comment:
       Remove finishSnapshot and the related methods since finishSnapshot is 
not useful.

##########
File path: 
ratis-hadoop/src/test/java/org/apache/ratis/hadooprpc/TestRaftTakeSnapshotWithHadoopRpc.java
##########
@@ -0,0 +1,29 @@
+/*
+ * 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.hadooprpc;
+
+import org.apache.ratis.server.impl.MiniRaftCluster;
+import org.apache.ratis.statemachine.RaftTakeSnapshotTest;
+
+public class TestRaftTakeSnapshotWithHadoopRpc extends RaftTakeSnapshotTest {

Review comment:
       Please remove rpc test.  We will add it with the rpc change later.

##########
File path: 
ratis-server/src/main/java/org/apache/ratis/server/impl/RaftServerImpl.java
##########
@@ -963,6 +975,49 @@ void finishTransferLeadership() {
     }
   }
 
+  public RaftClientReply takeSnapshot(SnapshotRequest request) throws 
IOException {
+    return waitForReply(request, takeSnapshotAsync(request));
+  }

Review comment:
       Remove takeSnapshot(..) since it is not used.

##########
File path: 
ratis-common/src/main/java/org/apache/ratis/protocol/AdminAsynchronousProtocol.java
##########
@@ -33,4 +33,4 @@
 
   CompletableFuture<RaftClientReply> transferLeadershipAsync(
       TransferLeadershipRequest request) throws IOException;
-}
\ No newline at end of file
+}

Review comment:
       Please revert this unrelated change.

##########
File path: 
ratis-server/src/test/java/org/apache/ratis/statemachine/RaftSnapshotBaseTest.java
##########
@@ -112,7 +112,9 @@ public static void assertLeaderContent(MiniRaftCluster 
cluster) throws Exception
 
   private MiniRaftCluster cluster;
 
-  public abstract MiniRaftCluster.Factory<?> getFactory();
+  public MiniRaftCluster.Factory<?> getFactory() {
+    return null;
+  }

Review comment:
       Please revert this unrelated change.

##########
File path: 
ratis-test/src/test/java/org/apache/ratis/server/simulation/TestRaftTakeSnapshotWithSimulatedRpc.java
##########
@@ -0,0 +1,28 @@
+/*
+ * 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.server.simulation;
+
+import org.apache.ratis.server.impl.MiniRaftCluster;
+import org.apache.ratis.statemachine.RaftTakeSnapshotTest;
+
+public class TestRaftTakeSnapshotWithSimulatedRpc extends RaftTakeSnapshotTest{

Review comment:
       Please remove rpc test.  We will add it with the rpc change later.

##########
File path: 
ratis-server/src/test/java/org/apache/ratis/statemachine/RaftTakeSnapshotTest.java
##########
@@ -0,0 +1,105 @@
+/*
+ * 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.statemachine;
+
+import org.apache.log4j.Level;
+import org.apache.ratis.BaseTest;
+import org.apache.ratis.RaftTestUtil;
+import org.apache.ratis.client.RaftClient;
+import org.apache.ratis.conf.RaftProperties;
+import org.apache.ratis.protocol.RaftClientReply;
+import org.apache.ratis.protocol.RaftPeerId;
+import org.apache.ratis.protocol.SnapshotRequest;
+import org.apache.ratis.rpc.CallId;
+import org.apache.ratis.server.RaftServer;
+import org.apache.ratis.server.RaftServerConfigKeys;
+import org.apache.ratis.server.impl.MiniRaftCluster;
+import org.apache.ratis.server.impl.RaftServerTestUtil;
+import org.apache.ratis.server.raftlog.RaftLog;
+import org.apache.ratis.util.JavaUtils;
+import org.apache.ratis.util.Log4jUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.LongStream;
+
+public abstract class RaftTakeSnapshotTest extends BaseTest {

Review comment:
       Rename it to SnapshotManagementTest.  We will add other new tests later.

##########
File path: 
ratis-server/src/test/java/org/apache/ratis/statemachine/RaftTakeSnapshotTest.java
##########
@@ -0,0 +1,105 @@
+/*
+ * 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.statemachine;
+
+import org.apache.log4j.Level;
+import org.apache.ratis.BaseTest;
+import org.apache.ratis.RaftTestUtil;
+import org.apache.ratis.client.RaftClient;
+import org.apache.ratis.conf.RaftProperties;
+import org.apache.ratis.protocol.RaftClientReply;
+import org.apache.ratis.protocol.RaftPeerId;
+import org.apache.ratis.protocol.SnapshotRequest;
+import org.apache.ratis.rpc.CallId;
+import org.apache.ratis.server.RaftServer;
+import org.apache.ratis.server.RaftServerConfigKeys;
+import org.apache.ratis.server.impl.MiniRaftCluster;
+import org.apache.ratis.server.impl.RaftServerTestUtil;
+import org.apache.ratis.server.raftlog.RaftLog;
+import org.apache.ratis.util.JavaUtils;
+import org.apache.ratis.util.Log4jUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.LongStream;
+
+public abstract class RaftTakeSnapshotTest extends BaseTest {
+
+  {
+    Log4jUtils.setLogLevel(RaftServer.Division.LOG, Level.DEBUG);
+    Log4jUtils.setLogLevel(RaftLog.LOG, Level.INFO);
+    Log4jUtils.setLogLevel(RaftClient.LOG, Level.INFO);
+  }
+
+  static final Logger LOG = 
LoggerFactory.getLogger(RaftTakeSnapshotTest.class);
+  private MiniRaftCluster cluster;
+
+  public MiniRaftCluster.Factory<?> getFactory() {
+    return null;

Review comment:
       Return MiniRaftClusterWithSimulatedRpc.FACTORY for now so that we can 
remove all the subclass.




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