hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject svn commit: r737138 - in /hadoop/core/trunk: ./ src/hdfs/org/apache/hadoop/hdfs/server/namenode/ src/hdfs/org/apache/hadoop/hdfs/server/namenode/metrics/ src/test/org/apache/hadoop/hdfs/server/namenode/
Date Fri, 23 Jan 2009 18:37:28 GMT
Author: szetszwo
Date: Fri Jan 23 10:37:27 2009
New Revision: 737138

URL: http://svn.apache.org/viewvc?rev=737138&view=rev
Log:
HADOOP-5037  Deprecate static FSNamesystem.getFSNamesystem().  (szetszwo)

Modified:
    hadoop/core/trunk/CHANGES.txt
    hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
    hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMetrics.java
    hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/server/namenode/TestFileLimit.java

Modified: hadoop/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=737138&r1=737137&r2=737138&view=diff
==============================================================================
--- hadoop/core/trunk/CHANGES.txt (original)
+++ hadoop/core/trunk/CHANGES.txt Fri Jan 23 10:37:27 2009
@@ -45,6 +45,8 @@
     HADOOP-5070. Increment copyright year to 2009, remove assertions of ASF
     copyright to licensed files. (Tsz Wo (Nicholas), SZE via cdouglas)
 
+    HADOOP-5037  Deprecate static FSNamesystem.getFSNamesystem().  (szetszwo)
+
   OPTIMIZATIONS
 
   BUG FIXES

Modified: hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=737138&r1=737137&r2=737138&view=diff
==============================================================================
--- hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java (original)
+++ hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java Fri
Jan 23 10:37:27 2009
@@ -243,7 +243,7 @@
    */
   private int replIndex = 0;
 
-  public static FSNamesystem fsNamesystemObject;
+  private static FSNamesystem fsNamesystemObject;
   /** NameNode RPC address */
   private InetSocketAddress nameNodeAddress = null; // TODO: name-node has this field, it
should be removed here
   private SafeModeInfo safeMode;  // safe mode information
@@ -436,8 +436,10 @@
   }
   
   /** Return the FSNamesystem object
-   * 
+   * @deprecated FSNamesystem object should be obtained from the container
+   *             object such as a NameNode object. 
    */
+  @Deprecated
   public static FSNamesystem getFSNamesystem() {
     return fsNamesystemObject;
   } 
@@ -4379,7 +4381,7 @@
     // package naming for mbeans and their impl.
     StandardMBean bean;
     try {
-      myFSMetrics = new FSNamesystemMetrics(conf);
+      myFSMetrics = new FSNamesystemMetrics(this, conf);
       bean = new StandardMBean(this,FSNamesystemMBean.class);
       mbeanName = MBeanUtil.registerMBean("NameNode", "FSNamesystemState", bean);
     } catch (NotCompliantMBeanException e) {

Modified: hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMetrics.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMetrics.java?rev=737138&r1=737137&r2=737138&view=diff
==============================================================================
--- hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMetrics.java
(original)
+++ hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/metrics/FSNamesystemMetrics.java
Fri Jan 23 10:37:27 2009
@@ -43,19 +43,23 @@
 public class FSNamesystemMetrics implements Updater {
   private static Log log = LogFactory.getLog(FSNamesystemMetrics.class);
   private final MetricsRecord metricsRecord;
-  public MetricsRegistry registry = new MetricsRegistry();
+  private final MetricsRegistry registry = new MetricsRegistry();
 
    
-  public MetricsIntValue filesTotal = new MetricsIntValue("FilesTotal", registry);
-  public MetricsLongValue blocksTotal = new MetricsLongValue("BlocksTotal", registry);
-  public MetricsIntValue capacityTotalGB = new MetricsIntValue("CapacityTotalGB", registry);
-  public MetricsIntValue capacityUsedGB = new MetricsIntValue("CapacityUsedGB", registry);
-  public MetricsIntValue capacityRemainingGB = new MetricsIntValue("CapacityRemainingGB",
registry);
-  public MetricsIntValue totalLoad = new MetricsIntValue("TotalLoad", registry);
-  public MetricsIntValue pendingReplicationBlocks = new MetricsIntValue("PendingReplicationBlocks",
registry);
-  public MetricsIntValue underReplicatedBlocks = new MetricsIntValue("UnderReplicatedBlocks",
registry);
-  public MetricsIntValue scheduledReplicationBlocks = new MetricsIntValue("ScheduledReplicationBlocks",
registry);
-  public FSNamesystemMetrics(Configuration conf) {
+  private final MetricsIntValue filesTotal = new MetricsIntValue("FilesTotal", registry);
+  private final MetricsLongValue blocksTotal = new MetricsLongValue("BlocksTotal", registry);
+  private final MetricsIntValue capacityTotalGB = new MetricsIntValue("CapacityTotalGB",
registry);
+  private final MetricsIntValue capacityUsedGB = new MetricsIntValue("CapacityUsedGB", registry);
+  private final MetricsIntValue capacityRemainingGB = new MetricsIntValue("CapacityRemainingGB",
registry);
+  private final MetricsIntValue totalLoad = new MetricsIntValue("TotalLoad", registry);
+  private final MetricsIntValue pendingReplicationBlocks = new MetricsIntValue("PendingReplicationBlocks",
registry);
+  private final MetricsIntValue underReplicatedBlocks = new MetricsIntValue("UnderReplicatedBlocks",
registry);
+  private final MetricsIntValue scheduledReplicationBlocks = new MetricsIntValue("ScheduledReplicationBlocks",
registry);
+
+  private final FSNamesystem fsNameSystem;
+
+  public FSNamesystemMetrics(FSNamesystem fsNameSystem, Configuration conf) {
+    this.fsNameSystem = fsNameSystem;
     String sessionId = conf.get("session.id");
      
     // Create a record for FSNamesystem metrics
@@ -91,7 +95,6 @@
      * we could avoid copying the values on each update.
      */
     synchronized (this) {
-      FSNamesystem fsNameSystem = FSNamesystem.getFSNamesystem();
       filesTotal.set((int)fsNameSystem.getFilesTotal());
       blocksTotal.set((int)fsNameSystem.getBlocksTotal());
       capacityTotalGB.set(roundBytesToGBytes(fsNameSystem.getCapacityTotal()));

Modified: hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/server/namenode/TestFileLimit.java
URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/server/namenode/TestFileLimit.java?rev=737138&r1=737137&r2=737138&view=diff
==============================================================================
--- hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/server/namenode/TestFileLimit.java (original)
+++ hadoop/core/trunk/src/test/org/apache/hadoop/hdfs/server/namenode/TestFileLimit.java Fri
Jan 23 10:37:27 2009
@@ -17,20 +17,16 @@
  */
 package org.apache.hadoop.hdfs.server.namenode;
 
-import junit.framework.TestCase;
-import java.io.*;
-import java.net.*;
+import java.io.IOException;
 import java.util.Random;
 
+import junit.framework.TestCase;
+
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FsShell;
+import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.util.StringUtils;
-import org.apache.hadoop.fs.FSDataOutputStream;
-import org.apache.hadoop.fs.FSDataInputStream;
 import org.apache.hadoop.hdfs.MiniDFSCluster;
-import org.apache.hadoop.hdfs.protocol.FSConstants.DatanodeReportType;
 import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset;
 
 
@@ -43,17 +39,7 @@
   static final int blockSize = 8192;
   boolean simulatedStorage = false;
 
-  // The test file is 2 times the blocksize plus one. This means that when the
-  // entire file is written, the first two blocks definitely get flushed to
-  // the datanodes.
-
-  private static String TEST_ROOT_DIR =
-    new Path(System.getProperty("test.build.data","/tmp"))
-    .toString().replace(' ', '+');
-  
-  //
   // creates a zero file.
-  //
   private void createFile(FileSystem fileSys, Path name)
     throws IOException {
     FSDataOutputStream stm = fileSys.create(name, true,
@@ -99,8 +85,7 @@
     }
     MiniDFSCluster cluster = new MiniDFSCluster(conf, 1, true, null);
     FileSystem fs = cluster.getFileSystem();
-    FSNamesystem namesys = FSNamesystem.fsNamesystemObject;
-    NameNode namenode = cluster.getNameNode();
+    FSNamesystem namesys = cluster.getNamesystem();
     try {
 
       //



Mime
View raw message