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 wh...@apache.org on 2015/11/12 19:22:58 UTC
[46/50] [abbrv] hadoop git commit: HDFS-9396. Total files and
directories on jmx and web UI on standby is uninitialized. Contributed by
Kihwal Lee.
HDFS-9396. Total files and directories on jmx and web UI on standby is uninitialized. Contributed by Kihwal Lee.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/a2a104f3
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/a2a104f3
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/a2a104f3
Branch: refs/heads/HDFS-8707
Commit: a2a104f3d30182953db6690304146f0a582ed241
Parents: 6351d3f
Author: Kihwal Lee <ki...@apache.org>
Authored: Wed Nov 11 15:22:36 2015 -0600
Committer: Kihwal Lee <ki...@apache.org>
Committed: Wed Nov 11 15:24:43 2015 -0600
----------------------------------------------------------------------
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 ++
.../hdfs/server/namenode/FSDirectory.java | 8 +--
.../hdfs/server/namenode/ha/TestHAMetrics.java | 56 ++++++++++++++++++++
3 files changed, 60 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a2a104f3/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 53d20cc..e6a5b71 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -2293,6 +2293,9 @@ Release 2.8.0 - UNRELEASED
HDFS-9245. Fix findbugs warnings in hdfs-nfs/WriteCtx.
(Mingliang Liu via xyao)
+ HDFS-9396. Total files and directories on jmx and web UI on standby is
+ uninitialized. (kihwal)
+
Release 2.7.3 - UNRELEASED
INCOMPATIBLE CHANGES
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a2a104f3/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
index cb1ac05..0f3011a 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
@@ -1218,13 +1218,7 @@ public class FSDirectory implements Closeable {
}
long totalInodes() {
- readLock();
- try {
- return rootDir.getDirectoryWithQuotaFeature().getSpaceConsumed()
- .getNameSpace();
- } finally {
- readUnlock();
- }
+ return getInodeMapSize();
}
/**
http://git-wip-us.apache.org/repos/asf/hadoop/blob/a2a104f3/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestHAMetrics.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestHAMetrics.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestHAMetrics.java
index 6f9fc6e..432f7df 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestHAMetrics.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/TestHAMetrics.java
@@ -24,8 +24,10 @@ import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.DFSTestUtil;
+import org.apache.hadoop.hdfs.DistributedFileSystem;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.hadoop.hdfs.MiniDFSNNTopology;
+import org.apache.hadoop.hdfs.protocol.HdfsConstants.SafeModeAction;
import org.apache.hadoop.hdfs.server.namenode.FSNamesystem;
import org.apache.hadoop.io.IOUtils;
import org.junit.Test;
@@ -119,4 +121,58 @@ public class TestHAMetrics {
cluster.shutdown();
}
}
+
+ @Test
+ public void testHAInodeCount() throws Exception {
+ Configuration conf = new Configuration();
+ conf.setInt(DFSConfigKeys.DFS_HA_TAILEDITS_PERIOD_KEY, 1);
+ conf.setInt(DFSConfigKeys.DFS_HA_LOGROLL_PERIOD_KEY, Integer.MAX_VALUE);
+
+ MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf)
+ .nnTopology(MiniDFSNNTopology.simpleHATopology()).numDataNodes(1)
+ .build();
+ FileSystem fs = null;
+ try {
+ cluster.waitActive();
+
+ FSNamesystem nn0 = cluster.getNamesystem(0);
+ FSNamesystem nn1 = cluster.getNamesystem(1);
+
+ cluster.transitionToActive(0);
+ fs = HATestUtil.configureFailoverFs(cluster, conf);
+ DFSTestUtil.createFile(fs, new Path("/testHAInodeCount1"),
+ 10, (short)1, 1L);
+ DFSTestUtil.createFile(fs, new Path("/testHAInodeCount2"),
+ 10, (short)1, 1L);
+ DFSTestUtil.createFile(fs, new Path("/testHAInodeCount3"),
+ 10, (short)1, 1L);
+ DFSTestUtil.createFile(fs, new Path("/testHAInodeCount4"),
+ 10, (short)1, 1L);
+
+ // 1 dir and 4 files
+ assertEquals(5, nn0.getFilesTotal());
+ // The SBN still has one dir, which is "/".
+ assertEquals(1, nn1.getFilesTotal());
+
+ // Save fsimage so that nn does not build up namesystem by replaying
+ // edits, but load from the image.
+ ((DistributedFileSystem)fs).setSafeMode(SafeModeAction.SAFEMODE_ENTER);
+ ((DistributedFileSystem)fs).saveNamespace();
+
+ // Flip the two namenodes and restart the standby, which will load
+ // the fsimage.
+ cluster.transitionToStandby(0);
+ cluster.transitionToActive(1);
+ cluster.restartNameNode(0);
+ assertEquals(nn0.getHAState(), "standby");
+
+ // The restarted standby should report the correct count
+ nn0 = cluster.getNamesystem(0);
+ assertEquals(5, nn0.getFilesTotal());
+ } finally {
+ IOUtils.cleanup(LOG, fs);
+ cluster.shutdown();
+ }
+
+ }
}