You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by um...@apache.org on 2022/04/12 23:23:36 UTC
[ozone] branch HDDS-3816-ec updated: HDDS-6209. EC: [Forward compatibility issue] New client to older server could fail due to the unavailability for client default replication config (#3267)
This is an automated email from the ASF dual-hosted git repository.
umamahesh pushed a commit to branch HDDS-3816-ec
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/HDDS-3816-ec by this push:
new 6c6b740a47 HDDS-6209. EC: [Forward compatibility issue] New client to older server could fail due to the unavailability for client default replication config (#3267)
6c6b740a47 is described below
commit 6c6b740a47f875fa046ec67c08e6f41fd2d8e83e
Author: Istvan Fajth <pi...@cloudera.com>
AuthorDate: Wed Apr 13 01:23:30 2022 +0200
HDDS-6209. EC: [Forward compatibility issue] New client to older server could fail due to the unavailability for client default replication config (#3267)
---
.../apache/hadoop/ozone/OzoneManagerVersion.java | 2 +
...lockLocationProtocolClientSideTranslatorPB.java | 3 +
.../scm/cli/pipeline/CreatePipelineSubcommand.java | 9 ++-
.../apache/hadoop/ozone/client/rpc/RpcClient.java | 66 +++++++++++++++++++++-
...OzoneManagerProtocolClientSideTranslatorPB.java | 1 -
5 files changed, 78 insertions(+), 3 deletions(-)
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneManagerVersion.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneManagerVersion.java
index ff3d1123fb..c6872f286a 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneManagerVersion.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneManagerVersion.java
@@ -32,6 +32,8 @@ public enum OzoneManagerVersion implements ComponentVersion {
DEFAULT_VERSION(0, "Initial version"),
S3G_PERSISTENT_CONNECTIONS(1,
"New S3G persistent connection support is present in OM."),
+ ERASURE_CODED_STORAGE_SUPPORT(2, "OzoneManager version that supports"
+ + "ECReplicationConfig"),
FUTURE_VERSION(-1, "Used internally in the client when the server side is "
+ " newer and an unknown server version has arrived to the client.");
diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/ScmBlockLocationProtocolClientSideTranslatorPB.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/ScmBlockLocationProtocolClientSideTranslatorPB.java
index fa878aed10..eb19e46b7a 100644
--- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/ScmBlockLocationProtocolClientSideTranslatorPB.java
+++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/ScmBlockLocationProtocolClientSideTranslatorPB.java
@@ -172,6 +172,9 @@ public final class ScmBlockLocationProtocolClientSideTranslatorPB
((RatisReplicationConfig) replicationConfig).getReplicationFactor());
break;
case EC:
+ // We do not check for server support here, as this call is used only
+ // from OM which has the same software version as SCM.
+ // TODO: Rolling upgrade support needs to change this.
requestBuilder.setEcReplicationConfig(
((ECReplicationConfig)replicationConfig).toProto());
break;
diff --git a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/CreatePipelineSubcommand.java b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/CreatePipelineSubcommand.java
index faea21e2c6..86299eec2d 100644
--- a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/CreatePipelineSubcommand.java
+++ b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/pipeline/CreatePipelineSubcommand.java
@@ -55,7 +55,14 @@ public class CreatePipelineSubcommand extends ScmSubcommand {
@Override
public void execute(ScmClient scmClient) throws IOException {
- if (type == HddsProtos.ReplicationType.CHAINED) {
+ // Once we support creating EC containers/pipelines from the client, the
+ // client should check if SCM is able to fulfil the request, and
+ // understands an EcReplicationConfig. For that we also need to have SCM's
+ // version here from ScmInfo response.
+ // As I see there is no way to specify ECReplicationConfig properly here
+ // so failing the request if type is EC, seems to be safe.
+ if (type == HddsProtos.ReplicationType.CHAINED
+ || type == HddsProtos.ReplicationType.EC) {
throw new IllegalArgumentException(type.name()
+ " is not supported yet.");
}
diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
index 33c668de14..01d9e91ef6 100644
--- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
+++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
@@ -190,6 +190,7 @@ public class RpcClient implements ClientProtocol {
private final boolean getLatestVersionLocation;
private final ByteBufferPool byteBufferPool;
private final BlockInputStreamFactory blockInputStreamFactory;
+ private final OzoneManagerVersion omVersion;
private volatile ExecutorService ecReconstructExecutor;
/**
@@ -221,8 +222,9 @@ public class RpcClient implements ClientProtocol {
OzoneManagerClientProtocol.class, conf);
dtService = omTransport.getDelegationTokenService();
List<X509Certificate> x509Certificates = null;
+ ServiceInfoEx serviceInfoEx = ozoneManagerClient.getServiceInfo();
+ omVersion = getOmVersion(serviceInfoEx);
if (OzoneSecurityUtil.isSecurityEnabled(conf)) {
- ServiceInfoEx serviceInfoEx = ozoneManagerClient.getServiceInfo();
// If the client is authenticating using S3 style auth, all future
// requests serviced by this client will need S3 Auth set.
boolean isS3 = conf.getBoolean(S3Auth.S3_AUTH_CHECK, false);
@@ -316,6 +318,21 @@ public class RpcClient implements ClientProtocol {
return xceiverClientManager;
}
+ private OzoneManagerVersion getOmVersion(ServiceInfoEx info) {
+ OzoneManagerVersion version = OzoneManagerVersion.CURRENT;
+ for (ServiceInfo si : info.getServiceInfoList()) {
+ if (si.getNodeType() == HddsProtos.NodeType.OM) {
+ OzoneManagerVersion current =
+ OzoneManagerVersion.fromProtoValue(si.getProtobuf().getOMVersion());
+ if (version.compareTo(current) > 0) {
+ version = current;
+ }
+ }
+ }
+ LOG.trace("Ozone Manager version is {}", version.name());
+ return version;
+ }
+
static boolean validateOmVersion(OzoneManagerVersion minimumVersion,
List<ServiceInfo> serviceInfoList) {
if (minimumVersion == OzoneManagerVersion.FUTURE_VERSION) {
@@ -554,6 +571,16 @@ public class RpcClient implements ClientProtocol {
Preconditions.checkNotNull(bucketArgs);
verifyCountsQuota(bucketArgs.getQuotaInNamespace());
verifySpaceQuota(bucketArgs.getQuotaInBytes());
+ if (omVersion
+ .compareTo(OzoneManagerVersion.ERASURE_CODED_STORAGE_SUPPORT) < 0) {
+ if (bucketArgs.getDefaultReplicationConfig() != null &&
+ bucketArgs.getDefaultReplicationConfig().getType()
+ == ReplicationType.EC) {
+ throw new IOException("Can not set the default replication of the"
+ + " bucket to Erasure Coded replication, as OzoneManager does"
+ + " not support Erasure Coded replication.");
+ }
+ }
String owner = bucketArgs.getOwner() == null ?
ugi.getShortUserName() : bucketArgs.getOwner();
@@ -793,6 +820,15 @@ public class RpcClient implements ClientProtocol {
verifyVolumeName(volumeName);
verifyBucketName(bucketName);
Preconditions.checkNotNull(replicationConfig);
+ if (omVersion
+ .compareTo(OzoneManagerVersion.ERASURE_CODED_STORAGE_SUPPORT) < 0) {
+ if (replicationConfig.getReplicationType()
+ == HddsProtos.ReplicationType.EC) {
+ throw new IOException("Can not set the default replication of the"
+ + " bucket to Erasure Coded replication, as OzoneManager does"
+ + " not support Erasure Coded replication.");
+ }
+ }
OmBucketArgs.Builder builder = OmBucketArgs.newBuilder();
builder.setVolumeName(volumeName)
.setBucketName(bucketName)
@@ -899,6 +935,16 @@ public class RpcClient implements ClientProtocol {
HddsClientUtils.verifyKeyName(keyName);
}
HddsClientUtils.checkNotNull(keyName);
+ if (omVersion
+ .compareTo(OzoneManagerVersion.ERASURE_CODED_STORAGE_SUPPORT) < 0) {
+ if (replicationConfig != null &&
+ replicationConfig.getReplicationType()
+ == HddsProtos.ReplicationType.EC) {
+ throw new IOException("Can not set the replication of the key to"
+ + " Erasure Coded replication, as OzoneManager does not support"
+ + " Erasure Coded replication.");
+ }
+ }
String requestId = UUID.randomUUID().toString();
OmKeyArgs.Builder builder = new OmKeyArgs.Builder()
@@ -1195,6 +1241,15 @@ public class RpcClient implements ClientProtocol {
verifyVolumeName(volumeName);
verifyBucketName(bucketName);
HddsClientUtils.checkNotNull(keyName);
+ if (omVersion
+ .compareTo(OzoneManagerVersion.ERASURE_CODED_STORAGE_SUPPORT) < 0) {
+ if (replicationConfig.getReplicationType()
+ == HddsProtos.ReplicationType.EC) {
+ throw new IOException("Can not set the replication of the file to"
+ + " Erasure Coded replication, as OzoneManager does not support"
+ + " Erasure Coded replication.");
+ }
+ }
OmKeyArgs keyArgs = new OmKeyArgs.Builder()
.setVolumeName(volumeName)
.setBucketName(bucketName)
@@ -1434,6 +1489,15 @@ public class RpcClient implements ClientProtocol {
public OzoneOutputStream createFile(String volumeName, String bucketName,
String keyName, long size, ReplicationConfig replicationConfig,
boolean overWrite, boolean recursive) throws IOException {
+ if (omVersion
+ .compareTo(OzoneManagerVersion.ERASURE_CODED_STORAGE_SUPPORT) < 0) {
+ if (replicationConfig.getReplicationType()
+ == HddsProtos.ReplicationType.EC) {
+ throw new IOException("Can not set the replication of the file to"
+ + " Erasure Coded replication, as OzoneManager does not support"
+ + " Erasure Coded replication.");
+ }
+ }
OmKeyArgs keyArgs = new OmKeyArgs.Builder()
.setVolumeName(volumeName)
.setBucketName(bucketName)
diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java
index e687df6786..10ca155b13 100644
--- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java
+++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java
@@ -221,7 +221,6 @@ public final class OzoneManagerProtocolClientSideTranslatorPB
* @param cmdType type of the request
*/
private OMRequest.Builder createOMRequest(Type cmdType) {
-
return OMRequest.newBuilder()
.setCmdType(cmdType)
.setVersion(ClientVersion.CURRENT_VERSION)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org