HDFS-4902. DFSClient#getSnapshotDiffReport should use string path rather than o.a.h.fs.Path. Contributed by Binglin Chang.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1492791 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jing Zhao 2013-06-13 18:11:42 +00:00
parent 686ac311c9
commit 7e1744ccf9
4 changed files with 12 additions and 5 deletions

View File

@ -1075,6 +1075,9 @@ Release 2.1.0-beta - UNRELEASED
HDFS-4819. Update Snapshot doc to clarify that nested snapshots are not HDFS-4819. Update Snapshot doc to clarify that nested snapshots are not
allowed. (szetszwo) allowed. (szetszwo)
HDFS-4902. DFSClient.getSnapshotDiffReport should use string path rather
than o.a.h.fs.Path. (Binglin Chang via jing9)
Release 2.0.5-alpha - 06/06/2013 Release 2.0.5-alpha - 06/06/2013
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -97,7 +97,6 @@ import org.apache.hadoop.fs.MD5MD5CRC32GzipFileChecksum;
import org.apache.hadoop.fs.Options; import org.apache.hadoop.fs.Options;
import org.apache.hadoop.fs.Options.ChecksumOpt; import org.apache.hadoop.fs.Options.ChecksumOpt;
import org.apache.hadoop.fs.ParentNotDirectoryException; import org.apache.hadoop.fs.ParentNotDirectoryException;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.UnresolvedLinkException; import org.apache.hadoop.fs.UnresolvedLinkException;
import org.apache.hadoop.fs.VolumeId; import org.apache.hadoop.fs.VolumeId;
import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.fs.permission.FsPermission;
@ -2143,11 +2142,11 @@ public class DFSClient implements java.io.Closeable {
* current tree of a directory. * current tree of a directory.
* @see ClientProtocol#getSnapshotDiffReport(String, String, String) * @see ClientProtocol#getSnapshotDiffReport(String, String, String)
*/ */
public SnapshotDiffReport getSnapshotDiffReport(Path snapshotDir, public SnapshotDiffReport getSnapshotDiffReport(String snapshotDir,
String fromSnapshot, String toSnapshot) throws IOException { String fromSnapshot, String toSnapshot) throws IOException {
checkOpen(); checkOpen();
try { try {
return namenode.getSnapshotDiffReport(snapshotDir.toString(), return namenode.getSnapshotDiffReport(snapshotDir,
fromSnapshot, toSnapshot); fromSnapshot, toSnapshot);
} catch(RemoteException re) { } catch(RemoteException re) {
throw re.unwrapRemoteException(); throw re.unwrapRemoteException();

View File

@ -987,7 +987,7 @@ public class DistributedFileSystem extends FileSystem {
*/ */
public SnapshotDiffReport getSnapshotDiffReport(Path snapshotDir, public SnapshotDiffReport getSnapshotDiffReport(Path snapshotDir,
String fromSnapshot, String toSnapshot) throws IOException { String fromSnapshot, String toSnapshot) throws IOException {
return dfs.getSnapshotDiffReport(snapshotDir, fromSnapshot, toSnapshot); return dfs.getSnapshotDiffReport(getPathName(snapshotDir), fromSnapshot, toSnapshot);
} }
/** /**

View File

@ -210,7 +210,12 @@ public class TestSnapshotDiffReport {
report = hdfs.getSnapshotDiffReport(subsubsub1, "s0", "s2"); report = hdfs.getSnapshotDiffReport(subsubsub1, "s0", "s2");
System.out.println(report); System.out.println(report);
assertEquals(0, report.getDiffList().size()); assertEquals(0, report.getDiffList().size());
// test path with scheme also works
report = hdfs.getSnapshotDiffReport(hdfs.makeQualified(subsubsub1), "s0", "s2");
System.out.println(report);
assertEquals(0, report.getDiffList().size());
verifyDiffReport(sub1, "s0", "s2", verifyDiffReport(sub1, "s0", "s2",
new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes("")), new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes("")),
new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes("file15")), new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes("file15")),