|
@@ -813,6 +813,24 @@ public class TestSnapshotDiffReport {
|
|
|
new DiffReportEntry(DiffType.DELETE, DFSUtil.string2Bytes("subsub1")));
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testDiffReportWithQuota() throws Exception {
|
|
|
+ final Path testdir = new Path(sub1, "testdir1");
|
|
|
+ hdfs.mkdirs(testdir);
|
|
|
+ hdfs.allowSnapshot(testdir);
|
|
|
+ // Set quota BEFORE creating the snapshot
|
|
|
+ hdfs.setQuota(testdir, 10, 10);
|
|
|
+ hdfs.createSnapshot(testdir, "s0");
|
|
|
+ final SnapshotDiffReport report =
|
|
|
+ hdfs.getSnapshotDiffReport(testdir, "s0", "");
|
|
|
+ // The diff should be null. Snapshot dir inode should keep the quota.
|
|
|
+ Assert.assertEquals(0, report.getDiffList().size());
|
|
|
+ // Cleanup
|
|
|
+ hdfs.deleteSnapshot(testdir, "s0");
|
|
|
+ hdfs.disallowSnapshot(testdir);
|
|
|
+ hdfs.delete(testdir, true);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Rename a directory to its prior descendant, and verify the diff report.
|
|
|
*/
|
|
@@ -1005,7 +1023,6 @@ public class TestSnapshotDiffReport {
|
|
|
|
|
|
// we always put modification on the file before rename
|
|
|
verifyDiffReport(root, "s1", "",
|
|
|
- new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes("")),
|
|
|
new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes("foo2")),
|
|
|
new DiffReportEntry(DiffType.RENAME, DFSUtil.string2Bytes("foo2/bar"),
|
|
|
DFSUtil.string2Bytes("foo2/bar-new")));
|
|
@@ -1091,8 +1108,7 @@ public class TestSnapshotDiffReport {
|
|
|
new DiffReportEntry(DiffType.MODIFY,
|
|
|
DFSUtil.string2Bytes(flumeFileName)));
|
|
|
|
|
|
- verifyDiffReport(level0A, flumeSnap2Name, "",
|
|
|
- new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes("")));
|
|
|
+ verifyDiffReport(level0A, flumeSnap2Name, "");
|
|
|
|
|
|
verifyDiffReport(level0A, flumeSnap1Name, flumeSnap2Name,
|
|
|
new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes("")),
|
|
@@ -1128,7 +1144,6 @@ public class TestSnapshotDiffReport {
|
|
|
DFSUtil.string2Bytes(flumeFileName)));
|
|
|
|
|
|
verifyDiffReport(level0A, flumeSnap2Name, "",
|
|
|
- new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes("")),
|
|
|
new DiffReportEntry(DiffType.MODIFY,
|
|
|
DFSUtil.string2Bytes(flumeFileName)));
|
|
|
|