Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 296A8200D2D for ; Fri, 22 Sep 2017 03:52:49 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 27C901609E5; Fri, 22 Sep 2017 01:52:49 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 750E31609E4 for ; Fri, 22 Sep 2017 03:52:47 +0200 (CEST) Received: (qmail 66192 invoked by uid 500); 22 Sep 2017 01:52:34 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 65296 invoked by uid 99); 22 Sep 2017 01:52:33 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Sep 2017 01:52:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6CDEAF5AAA; Fri, 22 Sep 2017 01:52:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: asuresh@apache.org To: common-commits@hadoop.apache.org Date: Fri, 22 Sep 2017 01:53:08 -0000 Message-Id: <6e43e3cd222d4c0f8cfdc9a670d1ed2b@git.apache.org> In-Reply-To: <9327d97db72a4f4f9bdcf1d2908b30ce@git.apache.org> References: <9327d97db72a4f4f9bdcf1d2908b30ce@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [38/50] hadoop git commit: HDFS-12447. Rename AddECPolicyResponse to AddErasureCodingPolicyResponse. Contributed by SammiChen. archived-at: Fri, 22 Sep 2017 01:52:49 -0000 HDFS-12447. Rename AddECPolicyResponse to AddErasureCodingPolicyResponse. Contributed by SammiChen. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/a12f09ba Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/a12f09ba Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/a12f09ba Branch: refs/heads/YARN-6592 Commit: a12f09ba3c4a3aa4c4558090c5e1b7bcaebe3b94 Parents: ce943eb Author: Andrew Wang Authored: Wed Sep 20 11:51:17 2017 -0700 Committer: Andrew Wang Committed: Wed Sep 20 11:51:17 2017 -0700 ---------------------------------------------------------------------- .../java/org/apache/hadoop/hdfs/DFSClient.java | 10 +-- .../hadoop/hdfs/DistributedFileSystem.java | 4 +- .../apache/hadoop/hdfs/client/HdfsAdmin.java | 4 +- .../hdfs/protocol/AddECPolicyResponse.java | 68 -------------------- .../AddErasureCodingPolicyResponse.java | 68 ++++++++++++++++++++ .../hadoop/hdfs/protocol/ClientProtocol.java | 2 +- .../ClientNamenodeProtocolTranslatorPB.java | 11 ++-- .../hadoop/hdfs/protocolPB/PBHelperClient.java | 22 ++++--- .../src/main/proto/erasurecoding.proto | 2 +- .../src/main/proto/hdfs.proto | 2 +- ...tNamenodeProtocolServerSideTranslatorPB.java | 13 ++-- .../hdfs/server/namenode/FSNamesystem.java | 15 +++-- .../hdfs/server/namenode/NameNodeRpcServer.java | 9 +-- .../org/apache/hadoop/hdfs/tools/ECAdmin.java | 7 +- .../org/apache/hadoop/hdfs/DFSTestUtil.java | 4 +- .../hadoop/hdfs/TestErasureCodingPolicies.java | 7 +- .../hadoop/hdfs/protocolPB/TestPBHelper.java | 25 +++---- .../server/namenode/TestFSEditLogLoader.java | 4 +- .../hdfs/server/namenode/TestFSImage.java | 5 +- 19 files changed, 147 insertions(+), 135 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java index 7e8e95b..8d51a9c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java @@ -102,7 +102,7 @@ import org.apache.hadoop.hdfs.client.impl.DfsClientConf; import org.apache.hadoop.hdfs.client.impl.LeaseRenewer; import org.apache.hadoop.hdfs.net.Peer; import org.apache.hadoop.hdfs.protocol.AclException; -import org.apache.hadoop.hdfs.protocol.AddECPolicyResponse; +import org.apache.hadoop.hdfs.protocol.AddErasureCodingPolicyResponse; import org.apache.hadoop.hdfs.protocol.BlockStoragePolicy; import org.apache.hadoop.hdfs.protocol.CacheDirectiveEntry; import org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo; @@ -2807,13 +2807,14 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory, } } - public AddECPolicyResponse[] addErasureCodingPolicies( + public AddErasureCodingPolicyResponse[] addErasureCodingPolicies( ErasureCodingPolicy[] policies) throws IOException { checkOpen(); try (TraceScope ignored = tracer.newScope("addErasureCodingPolicies")) { return namenode.addErasureCodingPolicies(policies); } catch (RemoteException re) { - throw re.unwrapRemoteException(AccessControlException.class); + throw re.unwrapRemoteException(AccessControlException.class, + SafeModeException.class); } } @@ -2823,7 +2824,8 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory, try (TraceScope ignored = tracer.newScope("removeErasureCodingPolicy")) { namenode.removeErasureCodingPolicy(ecPolicyName); } catch (RemoteException re) { - throw re.unwrapRemoteException(AccessControlException.class); + throw re.unwrapRemoteException(AccessControlException.class, + SafeModeException.class); } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java index f6331cf..c9f4490 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java @@ -64,7 +64,7 @@ import org.apache.hadoop.hdfs.DFSOpsCountStatistics.OpType; import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys; import org.apache.hadoop.hdfs.client.HdfsDataOutputStream; import org.apache.hadoop.hdfs.client.impl.CorruptFileBlockIterator; -import org.apache.hadoop.hdfs.protocol.AddECPolicyResponse; +import org.apache.hadoop.hdfs.protocol.AddErasureCodingPolicyResponse; import org.apache.hadoop.hdfs.protocol.BlockStoragePolicy; import org.apache.hadoop.hdfs.protocol.CacheDirectiveEntry; import org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo; @@ -2650,7 +2650,7 @@ public class DistributedFileSystem extends FileSystem { * @return Return the response list of adding operations. * @throws IOException */ - public AddECPolicyResponse[] addErasureCodingPolicies( + public AddErasureCodingPolicyResponse[] addErasureCodingPolicies( ErasureCodingPolicy[] policies) throws IOException { return dfs.addErasureCodingPolicies(policies); } http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/HdfsAdmin.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/HdfsAdmin.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/HdfsAdmin.java index bfc6010..8dc5810 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/HdfsAdmin.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/HdfsAdmin.java @@ -35,7 +35,7 @@ import org.apache.hadoop.fs.permission.FsAction; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.hdfs.DFSInotifyEventInputStream; import org.apache.hadoop.hdfs.DistributedFileSystem; -import org.apache.hadoop.hdfs.protocol.AddECPolicyResponse; +import org.apache.hadoop.hdfs.protocol.AddErasureCodingPolicyResponse; import org.apache.hadoop.hdfs.protocol.CacheDirectiveEntry; import org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo; import org.apache.hadoop.hdfs.protocol.CachePoolEntry; @@ -562,7 +562,7 @@ public class HdfsAdmin { * @return Return the response list of adding operations. * @throws IOException */ - public AddECPolicyResponse[] addErasureCodingPolicies( + public AddErasureCodingPolicyResponse[] addErasureCodingPolicies( ErasureCodingPolicy[] policies) throws IOException { return dfs.addErasureCodingPolicies(policies); } http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/AddECPolicyResponse.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/AddECPolicyResponse.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/AddECPolicyResponse.java deleted file mode 100644 index 4e55680..0000000 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/AddECPolicyResponse.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.hadoop.hdfs.protocol; - -import org.apache.hadoop.HadoopIllegalArgumentException; - -/** - * A response of add an ErasureCoding policy. - */ -public class AddECPolicyResponse { - private boolean succeed; - private ErasureCodingPolicy policy; - private String errorMsg; - - public AddECPolicyResponse(ErasureCodingPolicy policy) { - this.policy = policy; - this.succeed = true; - } - - public AddECPolicyResponse(ErasureCodingPolicy policy, - String errorMsg) { - this.policy = policy; - this.errorMsg = errorMsg; - this.succeed = false; - } - - public AddECPolicyResponse(ErasureCodingPolicy policy, - HadoopIllegalArgumentException e) { - this(policy, e.getMessage()); - } - - public boolean isSucceed() { - return succeed; - } - - public ErasureCodingPolicy getPolicy() { - return policy; - } - - public String getErrorMsg() { - return errorMsg; - } - - @Override - public String toString() { - if (isSucceed()) { - return "Add ErasureCodingPolicy " + getPolicy().getName() + " succeed."; - } else { - return "Add ErasureCodingPolicy " + getPolicy().getName() + " failed and " - + "error message is " + getErrorMsg(); - } - } -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/AddErasureCodingPolicyResponse.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/AddErasureCodingPolicyResponse.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/AddErasureCodingPolicyResponse.java new file mode 100644 index 0000000..2e8d081 --- /dev/null +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/AddErasureCodingPolicyResponse.java @@ -0,0 +1,68 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hdfs.protocol; + +import org.apache.hadoop.HadoopIllegalArgumentException; + +/** + * A response of add an ErasureCoding policy. + */ +public class AddErasureCodingPolicyResponse { + private boolean succeed; + private ErasureCodingPolicy policy; + private String errorMsg; + + public AddErasureCodingPolicyResponse(ErasureCodingPolicy policy) { + this.policy = policy; + this.succeed = true; + } + + public AddErasureCodingPolicyResponse(ErasureCodingPolicy policy, + String errorMsg) { + this.policy = policy; + this.errorMsg = errorMsg; + this.succeed = false; + } + + public AddErasureCodingPolicyResponse(ErasureCodingPolicy policy, + HadoopIllegalArgumentException e) { + this(policy, e.getMessage()); + } + + public boolean isSucceed() { + return succeed; + } + + public ErasureCodingPolicy getPolicy() { + return policy; + } + + public String getErrorMsg() { + return errorMsg; + } + + @Override + public String toString() { + if (isSucceed()) { + return "Add ErasureCodingPolicy " + getPolicy().getName() + " succeed."; + } else { + return "Add ErasureCodingPolicy " + getPolicy().getName() + " failed and " + + "error message is " + getErrorMsg(); + } + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java index 8d5503f..25f63bd 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java @@ -1584,7 +1584,7 @@ public interface ClientProtocol { * @throws IOException */ @AtMostOnce - AddECPolicyResponse[] addErasureCodingPolicies( + AddErasureCodingPolicyResponse[] addErasureCodingPolicies( ErasureCodingPolicy[] policies) throws IOException; /** http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java index 209eee7..0b443c6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolTranslatorPB.java @@ -50,7 +50,7 @@ import org.apache.hadoop.fs.permission.FsAction; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.hdfs.AddBlockFlag; import org.apache.hadoop.hdfs.inotify.EventBatchList; -import org.apache.hadoop.hdfs.protocol.AddECPolicyResponse; +import org.apache.hadoop.hdfs.protocol.AddErasureCodingPolicyResponse; import org.apache.hadoop.hdfs.protocol.BlockStoragePolicy; import org.apache.hadoop.hdfs.protocol.CacheDirectiveEntry; import org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo; @@ -1718,7 +1718,7 @@ public class ClientNamenodeProtocolTranslatorPB implements } @Override - public AddECPolicyResponse[] addErasureCodingPolicies( + public AddErasureCodingPolicyResponse[] addErasureCodingPolicies( ErasureCodingPolicy[] policies) throws IOException { List protos = Arrays.stream(policies) .map(PBHelperClient::convertErasureCodingPolicy) @@ -1729,9 +1729,10 @@ public class ClientNamenodeProtocolTranslatorPB implements try { AddErasureCodingPoliciesResponseProto rep = rpcProxy .addErasureCodingPolicies(null, req); - AddECPolicyResponse[] responses = rep.getResponsesList().stream() - .map(PBHelperClient::convertAddECPolicyResponse) - .toArray(AddECPolicyResponse[]::new); + AddErasureCodingPolicyResponse[] responses = + rep.getResponsesList().stream() + .map(PBHelperClient::convertAddErasureCodingPolicyResponse) + .toArray(AddErasureCodingPolicyResponse[]::new); return responses; } catch (ServiceException e) { throw ProtobufHelper.getRemoteException(e); http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java index d92d91e..db97031 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelperClient.java @@ -58,7 +58,7 @@ import org.apache.hadoop.hdfs.DFSUtilClient; import org.apache.hadoop.hdfs.inotify.Event; import org.apache.hadoop.hdfs.inotify.EventBatch; import org.apache.hadoop.hdfs.inotify.EventBatchList; -import org.apache.hadoop.hdfs.protocol.AddECPolicyResponse; +import org.apache.hadoop.hdfs.protocol.AddErasureCodingPolicyResponse; import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.hdfs.protocol.BlockStoragePolicy; import org.apache.hadoop.hdfs.protocol.BlockType; @@ -137,7 +137,7 @@ import org.apache.hadoop.hdfs.protocol.proto.EncryptionZonesProtos.ReencryptionS import org.apache.hadoop.hdfs.protocol.proto.EncryptionZonesProtos.ZoneReencryptionStatusProto; import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos; import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.AccessModeProto; -import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.AddECPolicyResponseProto; +import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.AddErasureCodingPolicyResponseProto; import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.BlockProto; import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.BlockStoragePolicyProto; import org.apache.hadoop.hdfs.protocol.proto.HdfsProtos.BlockTypeProto; @@ -2981,10 +2981,11 @@ public class PBHelperClient { return builder.build(); } - public static AddECPolicyResponseProto convertAddECPolicyResponse( - AddECPolicyResponse response) { - AddECPolicyResponseProto.Builder builder = - AddECPolicyResponseProto.newBuilder() + public static AddErasureCodingPolicyResponseProto + convertAddErasureCodingPolicyResponse( + AddErasureCodingPolicyResponse response) { + AddErasureCodingPolicyResponseProto.Builder builder = + AddErasureCodingPolicyResponseProto.newBuilder() .setPolicy(convertErasureCodingPolicy(response.getPolicy())) .setSucceed(response.isSucceed()); if (!response.isSucceed()) { @@ -2993,13 +2994,14 @@ public class PBHelperClient { return builder.build(); } - public static AddECPolicyResponse convertAddECPolicyResponse( - AddECPolicyResponseProto proto) { + public static AddErasureCodingPolicyResponse + convertAddErasureCodingPolicyResponse( + AddErasureCodingPolicyResponseProto proto) { ErasureCodingPolicy policy = convertErasureCodingPolicy(proto.getPolicy()); if (proto.getSucceed()) { - return new AddECPolicyResponse(policy); + return new AddErasureCodingPolicyResponse(policy); } else { - return new AddECPolicyResponse(policy, proto.getErrorMsg()); + return new AddErasureCodingPolicyResponse(policy, proto.getErrorMsg()); } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs-client/src/main/proto/erasurecoding.proto ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/proto/erasurecoding.proto b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/proto/erasurecoding.proto index 9f80350..5f5f66e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/proto/erasurecoding.proto +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/proto/erasurecoding.proto @@ -58,7 +58,7 @@ message AddErasureCodingPoliciesRequestProto { } message AddErasureCodingPoliciesResponseProto { - repeated AddECPolicyResponseProto responses = 1; + repeated AddErasureCodingPolicyResponseProto responses = 1; } message RemoveErasureCodingPolicyRequestProto { http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs-client/src/main/proto/hdfs.proto ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/proto/hdfs.proto b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/proto/hdfs.proto index ddb5566..7769f68 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/proto/hdfs.proto +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/proto/hdfs.proto @@ -390,7 +390,7 @@ message ErasureCodingPolicyProto { optional ErasureCodingPolicyState state = 5 [default = ENABLED]; } -message AddECPolicyResponseProto { +message AddErasureCodingPolicyResponseProto { required ErasureCodingPolicyProto policy = 1; required bool succeed = 2; optional string errorMsg = 3; http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolServerSideTranslatorPB.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolServerSideTranslatorPB.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolServerSideTranslatorPB.java index a79e75f..0527b3b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolServerSideTranslatorPB.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/ClientNamenodeProtocolServerSideTranslatorPB.java @@ -36,7 +36,7 @@ import org.apache.hadoop.fs.CreateFlag; import org.apache.hadoop.fs.FsServerDefaults; import org.apache.hadoop.fs.Options.Rename; import org.apache.hadoop.fs.QuotaUsage; -import org.apache.hadoop.hdfs.protocol.AddECPolicyResponse; +import org.apache.hadoop.hdfs.protocol.AddErasureCodingPolicyResponse; import org.apache.hadoop.hdfs.protocol.BlockStoragePolicy; import org.apache.hadoop.hdfs.protocol.CacheDirectiveEntry; import org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo; @@ -1721,15 +1721,16 @@ public class ClientNamenodeProtocolServerSideTranslatorPB implements ErasureCodingPolicy[] policies = request.getEcPoliciesList().stream() .map(PBHelperClient::convertErasureCodingPolicy) .toArray(ErasureCodingPolicy[]::new); - AddECPolicyResponse[] result = server + AddErasureCodingPolicyResponse[] result = server .addErasureCodingPolicies(policies); - List responseProtos = Arrays - .stream(result).map(PBHelperClient::convertAddECPolicyResponse) - .collect(Collectors.toList()); + List responseProtos = + Arrays.stream(result) + .map(PBHelperClient::convertAddErasureCodingPolicyResponse) + .collect(Collectors.toList()); AddErasureCodingPoliciesResponseProto response = AddErasureCodingPoliciesResponseProto.newBuilder() - .addAllResponses(responseProtos).build(); + .addAllResponses(responseProtos).build(); return response; } catch (IOException e) { throw new ServiceException(e); http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index 029557f..967f26b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -180,7 +180,7 @@ import org.apache.hadoop.hdfs.DFSUtilClient; import org.apache.hadoop.hdfs.HAUtil; import org.apache.hadoop.hdfs.HdfsConfiguration; import org.apache.hadoop.hdfs.UnknownCryptoProtocolVersionException; -import org.apache.hadoop.hdfs.protocol.AddECPolicyResponse; +import org.apache.hadoop.hdfs.protocol.AddErasureCodingPolicyResponse; import org.apache.hadoop.hdfs.protocol.AlreadyBeingCreatedException; import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.hdfs.protocol.BlockType; @@ -7193,12 +7193,13 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, * rebuilding * @return The according result of add operation. */ - AddECPolicyResponse[] addErasureCodingPolicies(ErasureCodingPolicy[] policies, - final boolean logRetryCache) throws IOException { + AddErasureCodingPolicyResponse[] addErasureCodingPolicies( + ErasureCodingPolicy[] policies, final boolean logRetryCache) + throws IOException { final String operationName = "addErasureCodingPolicies"; String addECPolicyName = ""; checkOperation(OperationCategory.WRITE); - List responses = new ArrayList<>(); + List responses = new ArrayList<>(); boolean success = false; writeLock(); try { @@ -7210,13 +7211,13 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, FSDirErasureCodingOp.addErasureCodingPolicy(this, policy, logRetryCache); addECPolicyName = newPolicy.getName(); - responses.add(new AddECPolicyResponse(newPolicy)); + responses.add(new AddErasureCodingPolicyResponse(newPolicy)); } catch (HadoopIllegalArgumentException e) { - responses.add(new AddECPolicyResponse(policy, e)); + responses.add(new AddErasureCodingPolicyResponse(policy, e)); } } success = true; - return responses.toArray(new AddECPolicyResponse[0]); + return responses.toArray(new AddErasureCodingPolicyResponse[0]); } finally { writeUnlock(operationName); if (success) { http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java index d62c0f2..c07b521 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java @@ -85,7 +85,7 @@ import org.apache.hadoop.hdfs.HDFSPolicyProvider; import org.apache.hadoop.hdfs.inotify.EventBatch; import org.apache.hadoop.hdfs.inotify.EventBatchList; import org.apache.hadoop.hdfs.protocol.AclException; -import org.apache.hadoop.hdfs.protocol.AddECPolicyResponse; +import org.apache.hadoop.hdfs.protocol.AddErasureCodingPolicyResponse; import org.apache.hadoop.hdfs.protocol.AlreadyBeingCreatedException; import org.apache.hadoop.hdfs.protocol.BlockListAsLongs; import org.apache.hadoop.hdfs.protocol.BlockStoragePolicy; @@ -2333,17 +2333,18 @@ public class NameNodeRpcServer implements NamenodeProtocols { } @Override - public AddECPolicyResponse[] addErasureCodingPolicies( + public AddErasureCodingPolicyResponse[] addErasureCodingPolicies( ErasureCodingPolicy[] policies) throws IOException { checkNNStartup(); namesystem.checkSuperuserPrivilege(); final CacheEntryWithPayload cacheEntry = RetryCache.waitForCompletion(retryCache, null); if (cacheEntry != null && cacheEntry.isSuccess()) { - return (AddECPolicyResponse[]) cacheEntry.getPayload(); + return (AddErasureCodingPolicyResponse[]) cacheEntry.getPayload(); } boolean success = false; - AddECPolicyResponse[] responses = new AddECPolicyResponse[0]; + AddErasureCodingPolicyResponse[] responses = + new AddErasureCodingPolicyResponse[0]; try { responses = namesystem.addErasureCodingPolicies(policies, cacheEntry != null); http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/ECAdmin.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/ECAdmin.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/ECAdmin.java index 0b4e0c2..652f78a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/ECAdmin.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/ECAdmin.java @@ -21,7 +21,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.DistributedFileSystem; -import org.apache.hadoop.hdfs.protocol.AddECPolicyResponse; +import org.apache.hadoop.hdfs.protocol.AddErasureCodingPolicyResponse; import org.apache.hadoop.hdfs.protocol.ErasureCodingPolicy; import org.apache.hadoop.hdfs.util.ECPolicyLoader; import org.apache.hadoop.io.erasurecode.ErasureCodeConstants; @@ -175,9 +175,10 @@ public class ECAdmin extends Configured implements Tool { List policies = new ECPolicyLoader().loadPolicy(filePath); if (policies.size() > 0) { - AddECPolicyResponse[] responses = dfs.addErasureCodingPolicies( + AddErasureCodingPolicyResponse[] responses = + dfs.addErasureCodingPolicies( policies.toArray(new ErasureCodingPolicy[policies.size()])); - for (AddECPolicyResponse response : responses) { + for (AddErasureCodingPolicyResponse response : responses) { System.out.println(response); } } else { http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java index c6fe1a2..17db352 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java @@ -108,7 +108,7 @@ import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.hdfs.MiniDFSCluster.NameNodeInfo; import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys; import org.apache.hadoop.hdfs.client.HdfsDataInputStream; -import org.apache.hadoop.hdfs.protocol.AddECPolicyResponse; +import org.apache.hadoop.hdfs.protocol.AddErasureCodingPolicyResponse; import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.hdfs.protocol.CacheDirectiveInfo; import org.apache.hadoop.hdfs.protocol.CachePoolInfo; @@ -1472,7 +1472,7 @@ public class DFSTestUtil { ErasureCodingPolicy newPolicy1 = new ErasureCodingPolicy(ErasureCodeConstants.RS_3_2_SCHEMA, 8 * 1024); ErasureCodingPolicy[] policyArray = new ErasureCodingPolicy[] {newPolicy1}; - AddECPolicyResponse[] responses = + AddErasureCodingPolicyResponse[] responses = filesystem.addErasureCodingPolicies(policyArray); newPolicy1 = responses[0].getPolicy(); http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestErasureCodingPolicies.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestErasureCodingPolicies.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestErasureCodingPolicies.java index 4f2040b..2c2b05e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestErasureCodingPolicies.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestErasureCodingPolicies.java @@ -23,7 +23,7 @@ import org.apache.hadoop.fs.CreateFlag; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; -import org.apache.hadoop.hdfs.protocol.AddECPolicyResponse; +import org.apache.hadoop.hdfs.protocol.AddErasureCodingPolicyResponse; import org.apache.hadoop.hdfs.protocol.DirectoryListing; import org.apache.hadoop.hdfs.protocol.SystemErasureCodingPolicies; import org.apache.hadoop.hdfs.protocol.HdfsConstants; @@ -686,7 +686,7 @@ public class TestErasureCodingPolicies { ErasureCodingPolicy newPolicy = new ErasureCodingPolicy(toAddSchema, 128 * 1024); ErasureCodingPolicy[] policyArray = new ErasureCodingPolicy[]{newPolicy}; - AddECPolicyResponse[] responses = + AddErasureCodingPolicyResponse[] responses = fs.addErasureCodingPolicies(policyArray); assertEquals(1, responses.length); assertFalse(responses[0].isSucceed()); @@ -839,7 +839,8 @@ public class TestErasureCodingPolicies { new ErasureCodingPolicy(ErasureCodeConstants.RS_3_2_SCHEMA, 8 * 1024); ErasureCodingPolicy[] policyArray = new ErasureCodingPolicy[] {newPolicy1}; - AddECPolicyResponse[] responses = fs.addErasureCodingPolicies(policyArray); + AddErasureCodingPolicyResponse[] responses = + fs.addErasureCodingPolicies(policyArray); assertEquals(1, responses.length); assertTrue(responses[0].isSucceed()); newPolicy1 = responses[0].getPolicy(); http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocolPB/TestPBHelper.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocolPB/TestPBHelper.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocolPB/TestPBHelper.java index 3559825..da56c15 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocolPB/TestPBHelper.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocolPB/TestPBHelper.java @@ -19,7 +19,7 @@ package org.apache.hadoop.hdfs.protocolPB; import com.google.protobuf.UninitializedMessageException; -import org.apache.hadoop.hdfs.protocol.AddECPolicyResponse; +import org.apache.hadoop.hdfs.protocol.AddErasureCodingPolicyResponse; import org.apache.hadoop.hdfs.protocol.SystemErasureCodingPolicies; import org.apache.hadoop.hdfs.server.protocol.SlowDiskReports; @@ -913,14 +913,15 @@ public class TestPBHelper { // Check conversion of the built-in policies. for (ErasureCodingPolicy policy : SystemErasureCodingPolicies.getPolicies()) { - AddECPolicyResponse response = new AddECPolicyResponse(policy); - HdfsProtos.AddECPolicyResponseProto proto = PBHelperClient - .convertAddECPolicyResponse(response); + AddErasureCodingPolicyResponse response = + new AddErasureCodingPolicyResponse(policy); + HdfsProtos.AddErasureCodingPolicyResponseProto proto = PBHelperClient + .convertAddErasureCodingPolicyResponse(response); // Optional fields should not be set. assertFalse("Unnecessary field is set.", proto.hasErrorMsg()); // Convert proto back to an object and check for equality. - AddECPolicyResponse convertedResponse = PBHelperClient - .convertAddECPolicyResponse(proto); + AddErasureCodingPolicyResponse convertedResponse = PBHelperClient + .convertAddErasureCodingPolicyResponse(proto); assertEquals("Converted policy not equal", response.getPolicy(), convertedResponse.getPolicy()); assertEquals("Converted policy not equal", response.isSucceed(), @@ -929,13 +930,13 @@ public class TestPBHelper { ErasureCodingPolicy policy = SystemErasureCodingPolicies .getPolicies().get(0); - AddECPolicyResponse response = - new AddECPolicyResponse(policy, "failed"); - HdfsProtos.AddECPolicyResponseProto proto = PBHelperClient - .convertAddECPolicyResponse(response); + AddErasureCodingPolicyResponse response = + new AddErasureCodingPolicyResponse(policy, "failed"); + HdfsProtos.AddErasureCodingPolicyResponseProto proto = PBHelperClient + .convertAddErasureCodingPolicyResponse(response); // Convert proto back to an object and check for equality. - AddECPolicyResponse convertedResponse = PBHelperClient - .convertAddECPolicyResponse(proto); + AddErasureCodingPolicyResponse convertedResponse = PBHelperClient + .convertAddErasureCodingPolicyResponse(proto); assertEquals("Converted policy not equal", response.getPolicy(), convertedResponse.getPolicy()); assertEquals("Converted policy not equal", response.getErrorMsg(), http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSEditLogLoader.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSEditLogLoader.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSEditLogLoader.java index ec80bff..14d2e26 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSEditLogLoader.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSEditLogLoader.java @@ -47,7 +47,7 @@ import org.apache.hadoop.hdfs.DistributedFileSystem; import org.apache.hadoop.hdfs.HdfsConfiguration; import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.hadoop.hdfs.StripedFileTestUtil; -import org.apache.hadoop.hdfs.protocol.AddECPolicyResponse; +import org.apache.hadoop.hdfs.protocol.AddErasureCodingPolicyResponse; import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.hdfs.protocol.ErasureCodingPolicy; import org.apache.hadoop.hdfs.protocol.ErasureCodingPolicyState; @@ -735,7 +735,7 @@ public class TestFSEditLogLoader { ErasureCodingPolicy newPolicy = new ErasureCodingPolicy(schema, cellSize, (byte) 0); ErasureCodingPolicy[] policyArray = new ErasureCodingPolicy[]{newPolicy}; - AddECPolicyResponse[] responses = + AddErasureCodingPolicyResponse[] responses = fs.addErasureCodingPolicies(policyArray); assertEquals(1, responses.length); assertTrue(responses[0].isSucceed()); http://git-wip-us.apache.org/repos/asf/hadoop/blob/a12f09ba/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSImage.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSImage.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSImage.java index c9d3255..d316c36 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSImage.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFSImage.java @@ -35,7 +35,7 @@ import java.io.IOException; import java.util.EnumSet; import org.apache.hadoop.hdfs.StripedFileTestUtil; -import org.apache.hadoop.hdfs.protocol.AddECPolicyResponse; +import org.apache.hadoop.hdfs.protocol.AddErasureCodingPolicyResponse; import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.hdfs.protocol.ErasureCodingPolicyState; import org.apache.hadoop.hdfs.protocol.SystemErasureCodingPolicies; @@ -847,7 +847,8 @@ public class TestFSImage { ErasureCodingPolicy newPolicy = new ErasureCodingPolicy(newSchema, 2 * 1024, (byte) 254); ErasureCodingPolicy[] policies = new ErasureCodingPolicy[]{newPolicy}; - AddECPolicyResponse[] ret = fs.addErasureCodingPolicies(policies); + AddErasureCodingPolicyResponse[] ret = + fs.addErasureCodingPolicies(policies); assertEquals(1, ret.length); assertEquals(true, ret[0].isSucceed()); newPolicy = ret[0].getPolicy(); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org