This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new f9f1c80dc6 HDDS-12411. Make hdds-client compliant with
FieldDeclarationsShouldBeAtStartOfClass (#7966)
f9f1c80dc6 is described below
commit f9f1c80dc62b5416722e9729e65ce5440b796965
Author: Ivan Zlenko <[email protected]>
AuthorDate: Tue Feb 25 17:07:51 2025 +0500
HDDS-12411. Make hdds-client compliant with
FieldDeclarationsShouldBeAtStartOfClass (#7966)
---
.../apache/hadoop/hdds/scm/OzoneClientConfig.java | 27 +++++++-------
.../hadoop/hdds/scm/XceiverClientCreator.java | 8 ++--
.../apache/hadoop/hdds/scm/XceiverClientRatis.java | 43 +++++++++++-----------
.../hadoop/hdds/scm/client/HddsClientUtils.java | 7 ++--
.../hadoop/hdds/scm/storage/BlockInputStream.java | 10 ++---
5 files changed, 45 insertions(+), 50 deletions(-)
diff --git
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/OzoneClientConfig.java
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/OzoneClientConfig.java
index 9094f98aa7..5a1415268c 100644
---
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/OzoneClientConfig.java
+++
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/OzoneClientConfig.java
@@ -35,20 +35,7 @@
@ConfigGroup(prefix = "ozone.client")
public class OzoneClientConfig {
- private static final Logger LOG =
- LoggerFactory.getLogger(OzoneClientConfig.class);
-
- /**
- * Enum for indicating what mode to use when combining chunk and block
- * checksums to define an aggregate FileChecksum. This should be considered
- * a client-side runtime option rather than a persistent property of any
- * stored metadata, which is why this is not part of ChecksumOpt, which
- * deals with properties of files at rest.
- */
- public enum ChecksumCombineMode {
- MD5MD5CRC, // MD5 of block checksums, which are MD5 over chunk CRCs
- COMPOSITE_CRC // Block/chunk-independent composite CRC
- }
+ private static final Logger LOG =
LoggerFactory.getLogger(OzoneClientConfig.class);
@Config(key = "stream.buffer.flush.size",
defaultValue = "16MB",
@@ -559,4 +546,16 @@ public void setMaxConcurrentWritePerKey(int
maxConcurrentWritePerKey) {
public int getMaxConcurrentWritePerKey() {
return this.maxConcurrentWritePerKey;
}
+
+ /**
+ * Enum for indicating what mode to use when combining chunk and block
+ * checksums to define an aggregate FileChecksum. This should be considered
+ * a client-side runtime option rather than a persistent property of any
+ * stored metadata, which is why this is not part of ChecksumOpt, which
+ * deals with properties of files at rest.
+ */
+ public enum ChecksumCombineMode {
+ MD5MD5CRC, // MD5 of block checksums, which are MD5 over chunk CRCs
+ COMPOSITE_CRC // Block/chunk-independent composite CRC
+ }
}
diff --git
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientCreator.java
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientCreator.java
index 150efd2cb2..49ca3a09e1 100644
---
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientCreator.java
+++
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientCreator.java
@@ -32,10 +32,6 @@
public class XceiverClientCreator implements XceiverClientFactory {
private static ErrorInjector errorInjector;
- public static void enableErrorInjection(ErrorInjector injector) {
- errorInjector = injector;
- }
-
private final ConfigurationSource conf;
private final boolean topologyAwareRead;
private final ClientTrustManager trustManager;
@@ -57,6 +53,10 @@ public XceiverClientCreator(ConfigurationSource conf,
ClientTrustManager trustMa
}
}
+ public static void enableErrorInjection(ErrorInjector injector) {
+ errorInjector = injector;
+ }
+
public boolean isSecurityEnabled() {
return securityEnabled;
}
diff --git
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientRatis.java
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientRatis.java
index a400363fd2..03289e8cac 100644
---
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientRatis.java
+++
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientRatis.java
@@ -70,28 +70,7 @@
* The underlying RPC mechanism can be chosen via the constructor.
*/
public final class XceiverClientRatis extends XceiverClientSpi {
- public static final Logger LOG =
- LoggerFactory.getLogger(XceiverClientRatis.class);
-
- public static XceiverClientRatis newXceiverClientRatis(
- org.apache.hadoop.hdds.scm.pipeline.Pipeline pipeline,
- ConfigurationSource ozoneConf) {
- return newXceiverClientRatis(pipeline, ozoneConf, null, null);
- }
-
- public static XceiverClientRatis newXceiverClientRatis(
- org.apache.hadoop.hdds.scm.pipeline.Pipeline pipeline,
- ConfigurationSource ozoneConf, ClientTrustManager trustManager,
ErrorInjector errorInjector) {
- final String rpcType = ozoneConf
- .get(ScmConfigKeys.HDDS_CONTAINER_RATIS_RPC_TYPE_KEY,
- ScmConfigKeys.HDDS_CONTAINER_RATIS_RPC_TYPE_DEFAULT);
- final RetryPolicy retryPolicy = RatisHelper.createRetryPolicy(ozoneConf);
- final GrpcTlsConfig tlsConfig = RatisHelper.createTlsClientConfig(new
- SecurityConfig(ozoneConf), trustManager);
- return new XceiverClientRatis(pipeline,
- SupportedRpcType.valueOfIgnoreCase(rpcType),
- retryPolicy, tlsConfig, ozoneConf, errorInjector);
- }
+ public static final Logger LOG =
LoggerFactory.getLogger(XceiverClientRatis.class);
private final Pipeline pipeline;
private final RpcType rpcType;
@@ -143,6 +122,26 @@ private XceiverClientRatis(Pipeline pipeline, RpcType
rpcType,
this.errorInjector = errorInjector;
}
+ public static XceiverClientRatis newXceiverClientRatis(
+ org.apache.hadoop.hdds.scm.pipeline.Pipeline pipeline,
+ ConfigurationSource ozoneConf) {
+ return newXceiverClientRatis(pipeline, ozoneConf, null, null);
+ }
+
+ public static XceiverClientRatis newXceiverClientRatis(
+ org.apache.hadoop.hdds.scm.pipeline.Pipeline pipeline,
+ ConfigurationSource ozoneConf, ClientTrustManager trustManager,
ErrorInjector errorInjector) {
+ final String rpcType = ozoneConf
+ .get(ScmConfigKeys.HDDS_CONTAINER_RATIS_RPC_TYPE_KEY,
+ ScmConfigKeys.HDDS_CONTAINER_RATIS_RPC_TYPE_DEFAULT);
+ final RetryPolicy retryPolicy = RatisHelper.createRetryPolicy(ozoneConf);
+ final GrpcTlsConfig tlsConfig = RatisHelper.createTlsClientConfig(new
+ SecurityConfig(ozoneConf), trustManager);
+ return new XceiverClientRatis(pipeline,
+ SupportedRpcType.valueOfIgnoreCase(rpcType),
+ retryPolicy, tlsConfig, ozoneConf, errorInjector);
+ }
+
private long updateCommitInfosMap(RaftClientReply reply,
RaftProtos.ReplicationLevel level) {
return Optional.ofNullable(reply)
.filter(RaftClientReply::isSuccess)
diff --git
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java
index 49e11abb29..ac25033397 100644
---
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java
+++
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java
@@ -48,10 +48,6 @@
@InterfaceAudience.Public
@InterfaceStability.Unstable
public final class HddsClientUtils {
-
- private HddsClientUtils() {
- }
-
private static final List<Class<? extends Exception>> EXCEPTION_LIST =
ImmutableList.<Class<? extends Exception>>builder()
.add(TimeoutException.class)
@@ -64,6 +60,9 @@ private HddsClientUtils() {
.add(NotReplicatedException.class)
.build();
+ private HddsClientUtils() {
+ }
+
private static void doNameChecks(String resName, String resType) {
if (resName == null) {
throw new IllegalArgumentException(resType + " name is null");
diff --git
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java
index 4867a2aa69..4c357f339a 100644
---
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java
+++
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockInputStream.java
@@ -62,8 +62,10 @@
*/
public class BlockInputStream extends BlockExtendedInputStream {
- public static final Logger LOG =
- LoggerFactory.getLogger(BlockInputStream.class);
+ public static final Logger LOG =
LoggerFactory.getLogger(BlockInputStream.class);
+
+ private static final List<Validator> VALIDATORS =
+ ContainerProtocolCalls.toValidatorList((request, response) ->
validate(response));
private final BlockID blockID;
private long length;
@@ -300,10 +302,6 @@ private void setPipeline(Pipeline pipeline) throws
IOException {
pipelineRef.set(readPipeline);
}
- private static final List<Validator> VALIDATORS
- = ContainerProtocolCalls.toValidatorList(
- (request, response) -> validate(response));
-
private static void validate(ContainerCommandResponseProto response)
throws IOException {
if (!response.hasGetBlock()) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]