diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java index 7f40ab27fe..29ccf308b1 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java @@ -19,6 +19,9 @@ import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; +import org.apache.ratis.util.TimeDuration; + +import java.util.concurrent.TimeUnit; /** * This class contains constants for configuration keys used in SCM. @@ -62,6 +65,16 @@ public final class ScmConfigKeys { "dfs.container.ratis.segment.preallocated.size"; public static final int DFS_CONTAINER_RATIS_SEGMENT_PREALLOCATED_SIZE_DEFAULT = 128 * 1024 * 1024; + public static final String DFS_RATIS_CLIENT_REQUEST_TIMEOUT_DURATION_KEY = + "dfs.ratis.client.request.timeout.duration"; + public static final TimeDuration + DFS_RATIS_CLIENT_REQUEST_TIMEOUT_DURATION_DEFAULT = + TimeDuration.valueOf(3000, TimeUnit.MILLISECONDS); + public static final String DFS_RATIS_SERVER_REQUEST_TIMEOUT_DURATION_KEY = + "dfs.ratis.server.request.timeout.duration"; + public static final TimeDuration + DFS_RATIS_SERVER_REQUEST_TIMEOUT_DURATION_DEFAULT = + TimeDuration.valueOf(3000, TimeUnit.MILLISECONDS); // TODO : this is copied from OzoneConsts, may need to move to a better place public static final String OZONE_SCM_CHUNK_SIZE_KEY = "ozone.scm.chunk.size"; diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java index 72531a26f1..b8dbd7b4c5 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java @@ -23,6 +23,7 @@ import org.apache.hadoop.hdds.client.ReplicationFactor; import org.apache.hadoop.hdds.client.ReplicationType; import org.apache.hadoop.hdds.scm.ScmConfigKeys; +import org.apache.ratis.util.TimeDuration; /** * This class contains constants for configuration keys used in Ozone. @@ -226,6 +227,16 @@ public final class OzoneConfigKeys { = ScmConfigKeys.OZONE_SCM_CHUNK_MAX_SIZE; public static final String DFS_CONTAINER_RATIS_DATANODE_STORAGE_DIR = "dfs.container.ratis.datanode.storage.dir"; + public static final String DFS_RATIS_CLIENT_REQUEST_TIMEOUT_DURATION_KEY = + ScmConfigKeys.DFS_RATIS_CLIENT_REQUEST_TIMEOUT_DURATION_KEY; + public static final TimeDuration + DFS_RATIS_CLIENT_REQUEST_TIMEOUT_DURATION_DEFAULT = + ScmConfigKeys.DFS_RATIS_CLIENT_REQUEST_TIMEOUT_DURATION_DEFAULT; + public static final String DFS_RATIS_SERVER_REQUEST_TIMEOUT_DURATION_KEY = + ScmConfigKeys.DFS_RATIS_SERVER_REQUEST_TIMEOUT_DURATION_KEY; + public static final TimeDuration + DFS_RATIS_SERVER_REQUEST_TIMEOUT_DURATION_DEFAULT = + ScmConfigKeys.DFS_RATIS_SERVER_REQUEST_TIMEOUT_DURATION_DEFAULT; public static final String OZONE_SCM_WEB_AUTHENTICATION_KERBEROS_PRINCIPAL = "ozone.web.authentication.kerberos.principal"; diff --git a/hadoop-hdds/common/src/main/resources/ozone-default.xml b/hadoop-hdds/common/src/main/resources/ozone-default.xml index cb0ab1859b..774b1b8abb 100644 --- a/hadoop-hdds/common/src/main/resources/ozone-default.xml +++ b/hadoop-hdds/common/src/main/resources/ozone-default.xml @@ -119,6 +119,18 @@ used by Apache Ratis on datanodes.(128 MB by default) + + dfs.ratis.client.request.timeout.duration + 3s + OZONE, RATIS, MANAGEMENT + The timeout duration for ratis client request. + + + dfs.ratis.server.request.timeout.duration + 3s + OZONE, RATIS, MANAGEMENT + The timeout duration for ratis server request. + ozone.container.report.interval 60000ms diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java index 4bd55f1b99..46def09710 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java @@ -29,6 +29,7 @@ .XceiverServerSpi; import org.apache.ratis.RaftConfigKeys; import org.apache.ratis.RatisHelper; +import org.apache.ratis.client.RaftClientConfigKeys; import org.apache.ratis.conf.RaftProperties; import org.apache.ratis.grpc.GrpcConfigKeys; import org.apache.ratis.netty.NettyConfigKeys; @@ -78,11 +79,31 @@ private XceiverServerRatis(DatanodeDetails dd, int port, String storageDir, final int numWriteChunkThreads = conf.getInt( OzoneConfigKeys.DFS_CONTAINER_RATIS_NUM_WRITE_CHUNK_THREADS_KEY, OzoneConfigKeys.DFS_CONTAINER_RATIS_NUM_WRITE_CHUNK_THREADS_DEFAULT); + TimeUnit timeUnit = + OzoneConfigKeys.DFS_RATIS_CLIENT_REQUEST_TIMEOUT_DURATION_DEFAULT + .getUnit(); + long duration = conf.getTimeDuration( + OzoneConfigKeys.DFS_RATIS_CLIENT_REQUEST_TIMEOUT_DURATION_KEY, + OzoneConfigKeys.DFS_RATIS_CLIENT_REQUEST_TIMEOUT_DURATION_DEFAULT + .getDuration(), timeUnit); + final TimeDuration clientRequestTimeout = + TimeDuration.valueOf(duration, timeUnit); + timeUnit = OzoneConfigKeys.DFS_RATIS_SERVER_REQUEST_TIMEOUT_DURATION_DEFAULT + .getUnit(); + duration = conf.getTimeDuration( + OzoneConfigKeys.DFS_RATIS_SERVER_REQUEST_TIMEOUT_DURATION_KEY, + OzoneConfigKeys.DFS_RATIS_SERVER_REQUEST_TIMEOUT_DURATION_DEFAULT + .getDuration(), timeUnit); + final TimeDuration serverRequestTimeout = + TimeDuration.valueOf(duration, timeUnit); Objects.requireNonNull(dd, "id == null"); this.port = port; - RaftProperties serverProperties = newRaftProperties(rpc, port, - storageDir, maxChunkSize, raftSegmentSize, raftSegmentPreallocatedSize); + RaftProperties serverProperties = + newRaftProperties(rpc, port, storageDir, maxChunkSize, raftSegmentSize, + raftSegmentPreallocatedSize); + setRequestTimeout(serverProperties, clientRequestTimeout, + serverRequestTimeout); writeChunkExecutor = new ThreadPoolExecutor(numWriteChunkThreads, numWriteChunkThreads, @@ -99,6 +120,14 @@ private XceiverServerRatis(DatanodeDetails dd, int port, String storageDir, .build(); } + private static void setRequestTimeout(RaftProperties serverProperties, + TimeDuration clientRequestTimeout, TimeDuration serverRequestTimeout) { + RaftClientConfigKeys.Rpc + .setRequestTimeout(serverProperties, clientRequestTimeout); + RaftServerConfigKeys.Rpc + .setRequestTimeout(serverProperties, serverRequestTimeout); + } + private static RaftProperties newRaftProperties( RpcType rpc, int port, String storageDir, int scmChunkSize, int raftSegmentSize, int raftSegmentPreallocatedSize) { diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml index 862a69348f..bcb816e0cb 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -97,7 +97,7 @@ 1.0.0-M33 - 0.1.1-alpha-8fd74ed-SNAPSHOT + 0.1.1-alpha-d7d7061-SNAPSHOT 1.0-alpha-1 3.3.1 2.4.12 @@ -106,7 +106,7 @@ 0.5.1 - 3.1.0 + 3.5.0 1.5.0.Final @@ -880,12 +880,6 @@ - - org.jctools - jctools-core - 1.2.1 - - org.apache.ratis ratis-proto-shaded