HDDS-814. dfs.ratis.leader.election.minimum.timeout.duration should not be read by client. Contributed by chencan.

This commit is contained in:
Mukul Kumar Singh 2018-11-22 10:45:32 +05:30
parent 5fe1dbf195
commit f207e30142
1 changed files with 0 additions and 29 deletions

View File

@ -35,7 +35,6 @@ import org.apache.ratis.retry.RetryPolicy;
import org.apache.ratis.rpc.RpcType;
import org.apache.ratis.thirdparty.com.google.protobuf.ByteString;
import org.apache.ratis.proto.RaftProtos;
import org.apache.ratis.util.Preconditions;
import org.apache.ratis.util.SizeInBytes;
import org.apache.ratis.util.TimeDuration;
import org.slf4j.Logger;
@ -51,9 +50,6 @@ import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static org.apache.hadoop.ozone.OzoneConfigKeys.DFS_RATIS_LEADER_ELECTION_MINIMUM_TIMEOUT_DURATION_DEFAULT;
import static org.apache.hadoop.ozone.OzoneConfigKeys.DFS_RATIS_LEADER_ELECTION_MINIMUM_TIMEOUT_DURATION_KEY;
/**
* Ratis helper methods.
*/
@ -175,31 +171,6 @@ public interface RatisHelper {
DFS_RATIS_CLIENT_REQUEST_RETRY_INTERVAL_KEY, OzoneConfigKeys.
DFS_RATIS_CLIENT_REQUEST_RETRY_INTERVAL_DEFAULT
.toInt(TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS);
long leaderElectionTimeout = conf.getTimeDuration(
DFS_RATIS_LEADER_ELECTION_MINIMUM_TIMEOUT_DURATION_KEY,
DFS_RATIS_LEADER_ELECTION_MINIMUM_TIMEOUT_DURATION_DEFAULT
.toInt(TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS);
long clientRequestTimeout = conf.getTimeDuration(
OzoneConfigKeys.DFS_RATIS_CLIENT_REQUEST_TIMEOUT_DURATION_KEY,
OzoneConfigKeys.DFS_RATIS_CLIENT_REQUEST_TIMEOUT_DURATION_DEFAULT
.toInt(TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS);
long retryCacheTimeout = conf.getTimeDuration(
OzoneConfigKeys.DFS_RATIS_SERVER_RETRY_CACHE_TIMEOUT_DURATION_KEY,
OzoneConfigKeys.DFS_RATIS_SERVER_RETRY_CACHE_TIMEOUT_DURATION_DEFAULT
.toInt(TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS);
Preconditions
.assertTrue(maxRetryCount * retryInterval > 5 * leaderElectionTimeout,
"Please make sure dfs.ratis.client.request.max.retries * "
+ "dfs.ratis.client.request.retry.interval > "
+ "5 * dfs.ratis.leader.election.minimum.timeout.duration");
Preconditions.assertTrue(
maxRetryCount * (retryInterval + clientRequestTimeout)
< retryCacheTimeout,
"Please make sure "
+ "(dfs.ratis.client.request.max.retries * "
+ "(dfs.ratis.client.request.retry.interval + "
+ "dfs.ratis.client.request.timeout.duration)) "
+ "< dfs.ratis.server.retry-cache.timeout.duration");
TimeDuration sleepDuration =
TimeDuration.valueOf(retryInterval, TimeUnit.MILLISECONDS);
RetryPolicy retryPolicy = RetryPolicies