diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 13c4094a1e..2def995564 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -2228,6 +2228,9 @@ Release 2.8.0 - UNRELEASED HDFS-9289. Make DataStreamer#block thread safe and verify genStamp in commitBlock. (Chang Li via zhz) + HDFS-9351. checkNNStartup() need to be called when fsck calls + FSNamesystem.getSnapshottableDirs(). (Xiao Chen via Yongjun Zhang) + Release 2.7.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index 65b40c87ff..734e3ba2fe 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -6364,26 +6364,6 @@ List listCorruptFileBlocksWithSnapshot(String path, return list; } - /** - * Get the list of snapshottable directories. - * @return The list of all the current snapshottable directories - * @see #getSnapshottableDirListing() - * @throws IOException - */ - List getSnapshottableDirs() throws IOException { - List snapshottableDirs = new ArrayList(); - final FSPermissionChecker pc = getFSDirectory().getPermissionChecker(); - final String user = pc.isSuperUser() ? null : pc.getUser(); - final SnapshottableDirectoryStatus[] snapDirs = - snapshotManager.getSnapshottableDirListing(user); - if (snapDirs != null) { - for (SnapshottableDirectoryStatus sds : snapDirs) { - snapshottableDirs.add(sds.getFullPath().toString()); - } - } - return snapshottableDirs; - } - @Override //NameNodeMXBean public int getDistinctVersionCount() { return blockManager.getDatanodeManager().getDatanodesSoftwareVersions() diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java index 0b2a53b3a0..9d4edb5420 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java @@ -60,6 +60,7 @@ import org.apache.hadoop.hdfs.protocol.HdfsFileStatus; import org.apache.hadoop.hdfs.protocol.LocatedBlock; import org.apache.hadoop.hdfs.protocol.LocatedBlocks; +import org.apache.hadoop.hdfs.protocol.SnapshottableDirectoryStatus; import org.apache.hadoop.hdfs.protocol.datatransfer.sasl.DataEncryptionKeyFactory; import org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier; import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey; @@ -345,7 +346,13 @@ public void fsck() { namenode.getNamesystem().logFsckEvent(path, remoteAddress); if (snapshottableDirs != null) { - snapshottableDirs = namenode.getNamesystem().getSnapshottableDirs(); + SnapshottableDirectoryStatus[] snapshotDirs = + namenode.getRpcServer().getSnapshottableDirListing(); + if (snapshotDirs != null) { + for (SnapshottableDirectoryStatus dir : snapshotDirs) { + snapshottableDirs.add(dir.getFullPath().toString()); + } + } } final HdfsFileStatus file = namenode.getRpcServer().getFileInfo(path);