void setRaftProperties()

in ratis-logservice/src/main/java/org/apache/ratis/logservice/server/LogServer.java [73:103]


    void setRaftProperties(RaftProperties properties) {
      super.setRaftProperties(properties);

      // Increase the client timeout
      long rpcTimeout = getConfig().getLong(Constants.LOG_SERVICE_RPC_TIMEOUT_KEY,
        Constants.DEFAULT_RPC_TIMEOUT);
      RaftClientConfigKeys.Rpc.setRequestTimeout(properties,
        TimeDuration.valueOf(rpcTimeout, TimeUnit.MILLISECONDS));

      // Increase the segment size to avoid rolling so quickly
      long segmentSize = getConfig().getLong(Constants.RATIS_RAFT_SEGMENT_SIZE_KEY,
        Constants.DEFAULT_RATIS_RAFT_SEGMENT_SIZE);
      SizeInBytes segmentSizeBytes = SizeInBytes.valueOf(segmentSize);
      String archiveLocation = getConfig().get(Constants.LOG_SERVICE_ARCHIVAL_LOCATION_KEY);
      if (archiveLocation != null) {
        properties.set(Constants.LOG_SERVICE_ARCHIVAL_LOCATION_KEY, archiveLocation);
      }
      heartbeatInterval = getConfig().getLong(Constants.LOG_SERVICE_HEARTBEAT_INTERVAL_KEY,
        Constants.DEFAULT_HEARTBEAT_INTERVAL);
      if(heartbeatInterval <= 0) {
          LOG.warn("Heartbeat interval configuration is invalid." +
                  " Setting default value "+ Constants.DEFAULT_HEARTBEAT_INTERVAL);
          heartbeatInterval = Constants.DEFAULT_HEARTBEAT_INTERVAL;
      }
      RaftServerConfigKeys.Log.setSegmentSizeMax(properties, segmentSizeBytes);
      RaftServerConfigKeys.Log.setPreallocatedSize(properties, segmentSizeBytes);

      // TODO this seems to cause errors, not sure if pushing Ratis too hard?
      // SizeInBytes writeBufferSize = SizeInBytes.valueOf("128KB");
      // RaftServerConfigKeys.Log.setWriteBufferSize(properties, writeBufferSize);
    }