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 7e8e95ba15..8d51a9c0d3 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.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 Map getErasureCodingCodecs() throws IOException { } } - 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 void removeErasureCodingPolicy(String ecPolicyName) try (TraceScope ignored = tracer.newScope("removeErasureCodingPolicy")) { namenode.removeErasureCodingPolicy(ecPolicyName); } catch (RemoteException re) { - throw re.unwrapRemoteException(AccessControlException.class); + throw re.unwrapRemoteException(AccessControlException.class, + SafeModeException.class); } } 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 f6331cf90d..c9f4490a7c 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.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 Map getAllErasureCodingCodecs() * @return Return the response list of adding operations. * @throws IOException */ - public AddECPolicyResponse[] addErasureCodingPolicies( + public AddErasureCodingPolicyResponse[] addErasureCodingPolicies( ErasureCodingPolicy[] policies) throws IOException { return dfs.addErasureCodingPolicies(policies); } 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 bfc6010f4a..8dc5810211 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.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 void unsetErasureCodingPolicy(final Path path) throws IOException { * @return Return the response list of adding operations. * @throws IOException */ - public AddECPolicyResponse[] addErasureCodingPolicies( + public AddErasureCodingPolicyResponse[] addErasureCodingPolicies( ErasureCodingPolicy[] policies) throws IOException { return dfs.addErasureCodingPolicies(policies); } 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/AddErasureCodingPolicyResponse.java similarity index 81% rename from hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/AddECPolicyResponse.java rename to hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/AddErasureCodingPolicyResponse.java index 4e55680ed4..2e8d081c19 100644 --- 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/AddErasureCodingPolicyResponse.java @@ -22,25 +22,25 @@ /** * A response of add an ErasureCoding policy. */ -public class AddECPolicyResponse { +public class AddErasureCodingPolicyResponse { private boolean succeed; private ErasureCodingPolicy policy; private String errorMsg; - public AddECPolicyResponse(ErasureCodingPolicy policy) { + public AddErasureCodingPolicyResponse(ErasureCodingPolicy policy) { this.policy = policy; this.succeed = true; } - public AddECPolicyResponse(ErasureCodingPolicy policy, - String errorMsg) { + public AddErasureCodingPolicyResponse(ErasureCodingPolicy policy, + String errorMsg) { this.policy = policy; this.errorMsg = errorMsg; this.succeed = false; } - public AddECPolicyResponse(ErasureCodingPolicy policy, - HadoopIllegalArgumentException e) { + public AddErasureCodingPolicyResponse(ErasureCodingPolicy policy, + HadoopIllegalArgumentException e) { this(policy, e.getMessage()); } 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 8d5503f9ab..25f63bd783 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 @@ void setErasureCodingPolicy(String src, String ecPolicyName) * @throws IOException */ @AtMostOnce - AddECPolicyResponse[] addErasureCodingPolicies( + AddErasureCodingPolicyResponse[] addErasureCodingPolicies( ErasureCodingPolicy[] policies) throws IOException; /** 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 209eee7b50..0b443c6e90 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.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 EventBatchList getEditsFromTxid(long txid) throws IOException { } @Override - public AddECPolicyResponse[] addErasureCodingPolicies( + public AddErasureCodingPolicyResponse[] addErasureCodingPolicies( ErasureCodingPolicy[] policies) throws IOException { List protos = Arrays.stream(policies) .map(PBHelperClient::convertErasureCodingPolicy) @@ -1729,9 +1729,10 @@ public AddECPolicyResponse[] addErasureCodingPolicies( 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); 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 d92d91ea2f..db97031b07 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.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.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 static CodecProto convertErasureCodingCodec(String codec, 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 static AddECPolicyResponseProto convertAddECPolicyResponse( 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()); } } 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 9f803503c3..5f5f66e1ad 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 { 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 ddb556650c..7769f6833d 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; 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 a79e75f39d..0527b3bc60 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.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 AddErasureCodingPoliciesResponseProto addErasureCodingPolicies( 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); 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 029557f248..967f26b448 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.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 @@ void setErasureCodingPolicy(final String srcArg, final String ecPolicyName, * 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 @@ AddECPolicyResponse[] addErasureCodingPolicies(ErasureCodingPolicy[] policies, 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) { 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 d62c0f2dcc..c07b521f7f 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.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 void unsetErasureCodingPolicy(String src) throws IOException { } @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); 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 0b4e0c2be8..652f78a854 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.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 int run(Configuration conf, List args) throws IOException { 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 { 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 c6fe1a23b7..17db352c54 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.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 static void runOperations(MiniDFSCluster cluster, 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(); 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 4f2040b60f..2c2b05e386 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.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 void testAddErasureCodingPolicies() throws Exception { 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 void testDifferentErasureCodingPolicyCellSize() throws Exception { 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(); 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 3559825556..da56c15397 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 @@ 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 void testConvertAddingECPolicyResponse() throws Exception { // 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 void testConvertAddingECPolicyResponse() throws Exception { 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(), 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 ec80bff3e0..14d2e26d86 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.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 void testErasureCodingPolicyOperations() throws IOException { 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()); 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 c9d3255a31..d316c36d78 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.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 void testSaveAndLoadErasureCodingPolicies() throws IOException{ 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();