[ https://issues.apache.org/jira/browse/HDFS-17381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17878169#comment-17878169 ]
ASF GitHub Bot commented on HDFS-17381: --------------------------------------- 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. > Distcp of EC files should not be limited to DFS. > ------------------------------------------------ > > Key: HDFS-17381 > URL: https://issues.apache.org/jira/browse/HDFS-17381 > Project: Hadoop HDFS > Issue Type: Bug > Components: distcp > Reporter: Sadanand Shenoy > Assignee: Sadanand Shenoy > Priority: Major > Labels: pull-request-available > > Currently EC file support in distcp is limited to DFS and the code checks if > the given FS instance is DistributedFileSystem, In Ozone, EC is supported > now, and this limitation can be removed and a general contract for any > filesystem that supports EC files should be allowed by implementing few > interfaces/methods. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org