Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -57,6 +53,10 @@ public XceiverClientCreator(ConfigurationSource conf, ClientTrustManager trustMa
}
}

public static void enableErrorInjection(ErrorInjector injector) {
errorInjector = injector;
}

public boolean isSecurityEnabled() {
return securityEnabled;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()) {
Expand Down