You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "steveloughran (via GitHub)" <gi...@apache.org> on 2024/04/16 20:40:29 UTC
Re: [PR] HDFS-17381. Distcp of EC files should not be limited to DFS. [hadoop]
steveloughran commented on code in PR #6551:
URL: https://github.com/apache/hadoop/pull/6551#discussion_r1567914216
##########
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:
casting is wrong; still hdfs only
--
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: common-issues-unsubscribe@hadoop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org