Repository: hadoop Updated Branches: refs/heads/branch-2 5ce7e7214 -> c07fab5f6
HDFS-9024. Deprecate the TotalFiles metric. Contributed by Akira Ahisaka. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/c07fab5f Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/c07fab5f Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/c07fab5f Branch: refs/heads/branch-2 Commit: c07fab5f6f2ea02298e7e6d41053e1bfeb016ff3 Parents: 5ce7e72 Author: Haohui Mai <whe...@apache.org> Authored: Sun Nov 22 23:02:50 2015 -0800 Committer: Haohui Mai <whe...@apache.org> Committed: Sun Nov 22 23:03:05 2015 -0800 ---------------------------------------------------------------------- .../hadoop-common/src/site/markdown/Metrics.md | 2 +- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 2 ++ .../java/org/apache/hadoop/hdfs/server/namenode/FSImage.java | 2 +- .../org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 2 ++ .../org/apache/hadoop/hdfs/server/namenode/NameNodeMXBean.java | 5 ++++- 5 files changed, 10 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/c07fab5f/hadoop-common-project/hadoop-common/src/site/markdown/Metrics.md ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/site/markdown/Metrics.md b/hadoop-common-project/hadoop-common/src/site/markdown/Metrics.md index b684062..ebba811 100644 --- a/hadoop-common-project/hadoop-common/src/site/markdown/Metrics.md +++ b/hadoop-common-project/hadoop-common/src/site/markdown/Metrics.md @@ -231,7 +231,7 @@ Each metrics record contains tags such as HAState and Hostname as additional inf | `MillisSinceLastLoadedEdits` | (HA-only) Time in milliseconds since the last time standby NameNode load edit log. In active NameNode, set to 0 | | `BlockCapacity` | Current number of block capacity | | `StaleDataNodes` | Current number of DataNodes marked stale due to delayed heartbeat | -| `TotalFiles` | Current number of files and directories (same as FilesTotal) | +| `TotalFiles` | Deprecated: Use FilesTotal instead | | `MissingReplOneBlocks` | Current number of missing blocks with replication factor 1 | | `NumFilesUnderConstruction` | Current number of files under construction | | `NumActiveClients` | Current number of active clients holding lease | http://git-wip-us.apache.org/repos/asf/hadoop/blob/c07fab5f/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 3d270bc..470f02d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1496,6 +1496,8 @@ Release 2.8.0 - UNRELEASED HDFS-9356. Decommissioning node does not have Last Contact value in the UI. (Surendra Singh Lilhore via wheat9) + HDFS-9024. Deprecate the TotalFiles metric. (Akira Ajisaka via wheat9) + Release 2.7.3 - UNRELEASED INCOMPATIBLE CHANGES http://git-wip-us.apache.org/repos/asf/hadoop/blob/c07fab5f/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java index bfbf3ff..085c0f8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java @@ -145,7 +145,7 @@ public class FSImage implements Closeable { } void format(FSNamesystem fsn, String clusterId) throws IOException { - long fileCount = fsn.getTotalFiles(); + long fileCount = fsn.getFilesTotal(); // Expect 1 file, which is the root inode Preconditions.checkState(fileCount == 1, "FSImage.format should be called with an uninitialized namesystem, has " + http://git-wip-us.apache.org/repos/asf/hadoop/blob/c07fab5f/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 9ef7f4e..9b33ffc 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 @@ -5927,6 +5927,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, return getBlocksTotal(); } + /** @deprecated Use {@link #getFilesTotal()} instead. */ + @Deprecated @Override // NameNodeMXBean @Metric public long getTotalFiles() { http://git-wip-us.apache.org/repos/asf/hadoop/blob/c07fab5f/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeMXBean.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeMXBean.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeMXBean.java index e2bca1f..46bbead 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeMXBean.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeMXBean.java @@ -140,9 +140,12 @@ public interface NameNodeMXBean { /** * Gets the total number of files on the cluster - * + * * @return the total number of files on the cluster + * @deprecated Use + * {@link org.apache.hadoop.hdfs.server.namenode.metrics.FSNamesystemMBean#getFilesTotal()} instead. */ + @Deprecated public long getTotalFiles(); /**