joshelser commented on a change in pull request #18: RATIS-523 RATIS-524 
RATIS-525 RATIS-526 RATIS-527 RATIS-533 Lots of cleanup on the LogService
URL: https://github.com/apache/incubator-ratis/pull/18#discussion_r280556374
 
 

 ##########
 File path: 
ratis-logservice/src/main/java/org/apache/ratis/logservice/server/BaseServer.java
 ##########
 @@ -39,6 +45,23 @@ public ServerOpts getServerOpts() {
     return opts;
   }
 
+  /**
+   * Sets common Ratis server properties for both the log and metadata state 
machines.
+   */
+  void setRaftProperties(RaftProperties properties) {
+    // Set the ports for the server
+    GrpcConfigKeys.Server.setPort(properties, opts.getPort());
+    NettyConfigKeys.Server.setPort(properties, opts.getPort());
+
+    // Ozone sets the leader election timeout (min) to 1second.
+    TimeDuration leaderElectionTimeoutMin = TimeDuration.valueOf(1, 
TimeUnit.SECONDS);
+    RaftServerConfigKeys.Rpc.setTimeoutMin(properties, 
leaderElectionTimeoutMin);
+    TimeDuration leaderElectionMaxTimeout = TimeDuration.valueOf(
+        leaderElectionTimeoutMin.toLong(TimeUnit.MILLISECONDS) + 200,
+        TimeUnit.MILLISECONDS);
+    RaftServerConfigKeys.Rpc.setTimeoutMax(properties, 
leaderElectionMaxTimeout);
 
 Review comment:
   This was a copy-paste out of Ozone. I don't have a good understand of why 
they chose these.
   
   Was going for just calling out things we _want_ to set in Ratis, but leaving 
the actual configuration to the work Vlad is going to get to.

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


With regards,
Apache Git Services

Reply via email to