You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by GitBox <gi...@apache.org> on 2022/12/09 09:58:05 UTC

[GitHub] [ratis] szetszwo commented on a diff in pull request #797: RATIS-1758. Add linearizable read in Counter example

szetszwo commented on code in PR #797:
URL: https://github.com/apache/ratis/pull/797#discussion_r1044275482


##########
ratis-examples/src/main/java/org/apache/ratis/examples/counter/server/CounterServer.java:
##########
@@ -80,35 +90,46 @@ public void close() throws IOException {
 
   public static void main(String[] args) {
     try {
-      //get peerIndex from the arguments
-      if (args.length != 1) {
-        throw new IllegalArgumentException("Invalid argument number: expected to be 1 but actual is " + args.length);
+      //get peerIndex & simulatedSlowness from the arguments
+      if (args.length != 1 && args.length != 2) {
+        throw new IllegalArgumentException("Invalid argument number: expected to be 1 or 2 but actual is "
+            + args.length);
       }
       final int peerIndex = Integer.parseInt(args[0]);
       if (peerIndex < 0 || peerIndex > 2) {
         throw new IllegalArgumentException("The server index must be 0, 1 or 2: peerIndex=" + peerIndex);
       }
+      TimeDuration simulatedSlowness = TimeDuration.ZERO;
+      if (args.length == 2) {
+        final int slowness = Integer.parseInt(args[1]);

Review Comment:
   Use  `TimeDuration.valueOf(String timeString, TimeUnit defaultUnit)`.
   



##########
ratis-examples/src/main/resources/conf.properties:
##########
@@ -15,4 +15,5 @@
 # limitations under the License.
 
 raft.server.address.list=127.0.0.1:10024,127.0.0.1:10124,127.0.0.1:11124
-# raft.server.root.storage.path
\ No newline at end of file
+# raft.server.root.storage.path
+# raft.server.priority.list=1,0,0

Review Comment:
   How about adding slowness list here instead of passing it in CLI?
   ```
   # raft.server.simulated-slowness.list=0,1s,0
   ```



-- 
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: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org