sadanand48 commented on code in PR #6551:
URL: https://github.com/apache/hadoop/pull/6551#discussion_r1738970299
##########
hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/RetriableDirectoryCreateCommand.java:
##########
@@ -67,31 +67,13 @@ protected Object doExecute(Object... arguments) throws
Exception {
boolean preserveEC = getFileAttributeSettings(context)
.contains(DistCpOptions.FileAttribute.ERASURECODINGPOLICY);
- if (preserveEC && sourceStatus.isErasureCoded()) {
- ErasureCodingPolicy ecPolicy = null;
- if (sourceFs instanceof DistributedFileSystem) {
- ecPolicy = ((HdfsFileStatus) sourceStatus).getErasureCodingPolicy();
- } else {
- try {
- String ecPolicyName = (String) getErasureCodingPolicyMethod(
- sourceFs).invoke(sourceFs,sourceStatus);
- ecPolicy = SystemErasureCodingPolicies.getByName(ecPolicyName);
- } catch (NoSuchMethodException exception){
- return false;
- }
- }
-
- if (targetFS instanceof DistributedFileSystem) {
- DistributedFileSystem dfs = (DistributedFileSystem) targetFS;
- dfs.setErasureCodingPolicy(target, ecPolicy.getName());
- } else {
- try {
- setErasureCodingPolicyMethod(targetFS).invoke(targetFS,
- ecPolicy.getName());
- } catch (NoSuchMethodException exception) {
- return false;
- }
- }
+ if (preserveEC && sourceStatus.isErasureCoded()
+ && targetFS instanceof WithErasureCoding) {
+ ErasureCodingPolicy ecPolicy = SystemErasureCodingPolicies.getByName(
+ ((WithErasureCoding) sourceFs).getErasureCodingPolicyName(
+ sourceStatus));
+ WithErasureCoding ecFs = (DistributedFileSystem) targetFS;
Review Comment:
fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]