Skip to content

Commit

Permalink
HDFS-15916. DistCp: Backward compatibility: Distcp fails from Hadoop …
Browse files Browse the repository at this point in the history
…3 to Hadoop 2 for snapshotdiff. (#2863). Contributed by Ayush Saxena.

Signed-off-by: Wei-Chiu Chuang <weichiu@apache.org>
(cherry picked from commit c6539e3)

 Conflicts:
	hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java
  • Loading branch information
ayushtkn authored and jojochuang committed May 26, 2021
1 parent 745a2f5 commit 705efa2
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -19,6 +19,7 @@
package org.apache.hadoop.hdfs;


import org.apache.hadoop.ipc.RpcNoSuchMethodException;
import org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.thirdparty.com.google.common.base.Preconditions;
import org.apache.hadoop.thirdparty.com.google.common.collect.Lists;
Expand Down Expand Up @@ -2314,8 +2315,15 @@ private SnapshotDiffReport getSnapshotDiffReportInternal(
List<DiffReportListingEntry> deletedList = new ChunkedArrayList<>();
SnapshotDiffReportListing report;
do {
report = dfs.getSnapshotDiffReportListing(snapshotDir, fromSnapshot,
toSnapshot, startPath, index);
try {
report = dfs.getSnapshotDiffReportListing(snapshotDir, fromSnapshot,
toSnapshot, startPath, index);
} catch (RpcNoSuchMethodException e) {
// In case the server doesn't support getSnapshotDiffReportListing,
// fallback to getSnapshotDiffReport.
DFSClient.LOG.warn("Falling back to getSnapshotDiffReport {}", e.getMessage());
return dfs.getSnapshotDiffReport(snapshotDir, fromSnapshot, toSnapshot);
}
startPath = report.getLastPath();
index = report.getLastIndex();
modifiedList.addAll(report.getModifyList());
Expand Down

0 comments on commit 705efa2

Please sign in to comment.