From 8aa6c4f079fd38a3230bc070c2ce837fefbc5301 Mon Sep 17 00:00:00 2001 From: Wei-Chiu Chuang Date: Thu, 30 Aug 2018 11:44:20 -0700 Subject: [PATCH] Revert "HDFS-13838. WebHdfsFileSystem.getFileStatus() won't return correct "snapshot enabled" status. Contributed by Siyao Meng." This reverts commit 26c2a97c566969f50eb8e8432009724c51152a98. --- .../org/apache/hadoop/hdfs/web/JsonUtilClient.java | 4 ---- .../java/org/apache/hadoop/hdfs/web/TestWebHDFS.java | 12 ------------ 2 files changed, 16 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/JsonUtilClient.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/JsonUtilClient.java index a685573f8f..9bb1846fc6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/JsonUtilClient.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/JsonUtilClient.java @@ -133,7 +133,6 @@ static HdfsFileStatus toFileStatus(final Map json, Boolean aclBit = (Boolean) m.get("aclBit"); Boolean encBit = (Boolean) m.get("encBit"); Boolean erasureBit = (Boolean) m.get("ecBit"); - Boolean snapshotEnabledBit = (Boolean) m.get("snapshotEnabled"); EnumSet f = EnumSet.noneOf(HdfsFileStatus.Flags.class); if (aclBit != null && aclBit) { @@ -145,9 +144,6 @@ static HdfsFileStatus toFileStatus(final Map json, if (erasureBit != null && erasureBit) { f.add(HdfsFileStatus.Flags.HAS_EC); } - if (snapshotEnabledBit != null && snapshotEnabledBit) { - f.add(HdfsFileStatus.Flags.SNAPSHOT_ENABLED); - } Map ecPolicyObj = (Map) m.get("ecPolicyObj"); ErasureCodingPolicy ecPolicy = null; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHDFS.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHDFS.java index 9152636622..cbc428a469 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHDFS.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHDFS.java @@ -482,9 +482,6 @@ public void testWebHdfsAllowandDisallowSnapshots() throws Exception { // allow snapshots on /bar using webhdfs webHdfs.allowSnapshot(bar); - // check if snapshot status is enabled - assertTrue(dfs.getFileStatus(bar).isSnapshotEnabled()); - assertTrue(webHdfs.getFileStatus(bar).isSnapshotEnabled()); webHdfs.createSnapshot(bar, "s1"); final Path s1path = SnapshotTestHelper.getSnapshotRoot(bar, "s1"); Assert.assertTrue(webHdfs.exists(s1path)); @@ -494,24 +491,15 @@ public void testWebHdfsAllowandDisallowSnapshots() throws Exception { assertEquals(bar, snapshottableDirs[0].getFullPath()); dfs.deleteSnapshot(bar, "s1"); dfs.disallowSnapshot(bar); - // check if snapshot status is disabled - assertFalse(dfs.getFileStatus(bar).isSnapshotEnabled()); - assertFalse(webHdfs.getFileStatus(bar).isSnapshotEnabled()); snapshottableDirs = dfs.getSnapshottableDirListing(); assertNull(snapshottableDirs); // disallow snapshots on /bar using webhdfs dfs.allowSnapshot(bar); - // check if snapshot status is enabled, again - assertTrue(dfs.getFileStatus(bar).isSnapshotEnabled()); - assertTrue(webHdfs.getFileStatus(bar).isSnapshotEnabled()); snapshottableDirs = dfs.getSnapshottableDirListing(); assertEquals(1, snapshottableDirs.length); assertEquals(bar, snapshottableDirs[0].getFullPath()); webHdfs.disallowSnapshot(bar); - // check if snapshot status is disabled, again - assertFalse(dfs.getFileStatus(bar).isSnapshotEnabled()); - assertFalse(webHdfs.getFileStatus(bar).isSnapshotEnabled()); snapshottableDirs = dfs.getSnapshottableDirListing(); assertNull(snapshottableDirs); try {