Repository: hadoop Updated Branches: refs/heads/branch-2 4f29f5d19 -> 0b61ccaec
HDFS-9351. checkNNStartup() need to be called when fsck calls FSNamesystem.getSnapshottableDirs(). (Xiao Chen via Yongjun Zhang) (cherry picked from commit 194251c85250fcbe80a6ffee88b2cd4689334be3) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/0b61ccae Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0b61ccae Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0b61ccae Branch: refs/heads/branch-2 Commit: 0b61ccaecaeeeca2a29f48f22026cf1515e107b7 Parents: 4f29f5d Author: Yongjun Zhang <[email protected]> Authored: Tue Nov 3 17:16:17 2015 -0800 Committer: Yongjun Zhang <[email protected]> Committed: Tue Nov 3 17:27:14 2015 -0800 ---------------------------------------------------------------------- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hdfs/server/namenode/FSNamesystem.java | 20 -------------------- .../hdfs/server/namenode/NamenodeFsck.java | 9 ++++++++- 3 files changed, 11 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/0b61ccae/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 071b9f1..b9b153c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1385,6 +1385,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 http://git-wip-us.apache.org/repos/asf/hadoop/blob/0b61ccae/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java ---------------------------------------------------------------------- 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 5966a36..741a41b 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 @@ -6290,26 +6290,6 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, return list; } - /** - * Get the list of snapshottable directories. - * @return The list of all the current snapshottable directories - * @see #getSnapshottableDirListing() - * @throws IOException - */ - List<String> getSnapshottableDirs() throws IOException { - List<String> snapshottableDirs = new ArrayList<String>(); - 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() http://git-wip-us.apache.org/repos/asf/hadoop/blob/0b61ccae/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java ---------------------------------------------------------------------- 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 279016c..19eade4 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.HdfsConstants; 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; @@ -337,7 +338,13 @@ public class NamenodeFsck implements DataEncryptionKeyFactory { 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);
