HDFS-4902. Merging changes r1492791 from trunk.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1492800 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jing Zhao 2013-06-13 18:23:26 +00:00
parent e4e8dc1f6c
commit d1058249fb
4 changed files with 12 additions and 5 deletions

View File

@ -860,6 +860,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

@ -99,7 +99,6 @@
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;
@ -2170,11 +2169,11 @@ public void disallowSnapshot(String snapshotRoot) throws IOException {
* 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

@ -1031,7 +1031,7 @@ public void deleteSnapshot(Path snapshotDir, String snapshotName)
*/ */
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

@ -211,6 +211,11 @@ public void testDiffReport() throws Exception {
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")),