You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by sz...@apache.org on 2023/05/15 03:14:03 UTC
[hadoop] branch SnapshotDiffSubtrees created (now f7be6b6886c)
This is an automated email from the ASF dual-hosted git repository.
szetszwo pushed a change to branch SnapshotDiffSubtrees
in repository https://gitbox.apache.org/repos/asf/hadoop.git
at f7be6b6886c add testSubtrees.
This branch includes the following new commits:
new f7be6b6886c add testSubtrees.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[hadoop] 01/01: add testSubtrees.
Posted by sz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
szetszwo pushed a commit to branch SnapshotDiffSubtrees
in repository https://gitbox.apache.org/repos/asf/hadoop.git
commit f7be6b6886c44cd724bd37ce4c728e78edd82d04
Author: Tsz-Wo Nicholas Sze <sz...@apache.org>
AuthorDate: Mon May 15 11:13:39 2023 +0800
add testSubtrees.
---
.../namenode/snapshot/TestSnapshotDiffReport.java | 33 ++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDiffReport.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDiffReport.java
index 1d50e50d426..a8724559bcc 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDiffReport.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDiffReport.java
@@ -50,6 +50,8 @@ import org.apache.hadoop.hdfs.protocol.SnapshotDiffReport.DiffReportEntry;
import org.apache.hadoop.hdfs.protocol.SnapshotDiffReport.DiffType;
import org.apache.hadoop.hdfs.protocol.SnapshotDiffReportListing;
import org.apache.hadoop.hdfs.protocol.SnapshotException;
+import org.apache.hadoop.hdfs.protocol.SnapshotStatus;
+import org.apache.hadoop.hdfs.protocol.SnapshottableDirectoryStatus;
import org.apache.hadoop.hdfs.server.namenode.INodeDirectory;
import org.apache.hadoop.hdfs.server.namenode.NameNode;
import org.apache.hadoop.hdfs.server.namenode.NameNodeAdapter;
@@ -70,6 +72,10 @@ import org.slf4j.LoggerFactory;
public class TestSnapshotDiffReport {
private static final Logger LOG =
LoggerFactory.getLogger(TestSnapshotDiffReport.class);
+
+ {
+ SnapshotTestHelper.disableLogs();
+ }
private static final long SEED = 0;
private static final short REPLICATION = 3;
private static final short REPLICATION_1 = 2;
@@ -1603,4 +1609,31 @@ public class TestSnapshotDiffReport {
+ "supported for snapshotDiffReport between two snapshots"));
}
}
+
+ @Test
+ public void testSubtrees() throws Exception {
+ final Path root = new Path("/");
+ final Path foo = new Path(root, "foo");
+ final Path bar = new Path(foo, "bar");
+ hdfs.mkdirs(bar);
+ modifyAndCreateSnapshot(bar, new Path[]{root});
+
+ cluster.getNamesystem().getFSDirectory().getRoot().dumpTreeRecursively(System.out);
+ for (SnapshottableDirectoryStatus s : hdfs.getSnapshottableDirListing()) {
+ LOG.info("Snapshottable {}: #snapshots={}", s.getFullPath(), s.getSnapshotNumber());
+ }
+ for (SnapshotStatus s : hdfs.getSnapshotListing(root)) {
+ LOG.info("Snapshot #{}: {}", s.getSnapshotID(), s.getFullPath());
+ }
+
+ diff(root, "s0", "s2");
+ diff(foo, "s0", "s2");
+ diff(bar, "s0", "s2");
+ }
+
+ void diff(Path path, String from, String to) throws Exception {
+ final SnapshotDiffReport diff = hdfs.getSnapshotDiffReport(path, from, to);
+ LOG.info("DIFF {} from {} to {}", path, from, to);
+ LOG.info("{}", diff);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org