HDDS-814. dfs.ratis.leader.election.minimum.timeout.duration should not be read by client. Contributed by chencan.
This commit is contained in:
parent
5fe1dbf195
commit
f207e30142
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue