Procházet zdrojové kódy

HDFS-9024. Deprecate the TotalFiles metric. Contributed by Akira Ahisaka.

Haohui Mai před 9 roky
rodič
revize
c07fab5f6f

+ 1 - 1
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 |

+ 2 - 0
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

+ 1 - 1
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 " +

+ 2 - 0
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() {

+ 4 - 1
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();
   
   /**