hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sur...@apache.org
Subject svn commit: r1076065 - in /hadoop/hdfs/branches/HDFS-1052: ./ src/java/org/apache/hadoop/hdfs/protocol/ src/java/org/apache/hadoop/hdfs/server/namenode/
Date Wed, 02 Mar 2011 00:25:17 GMT
Author: suresh
Date: Wed Mar  2 00:25:17 2011
New Revision: 1076065

URL: http://svn.apache.org/viewvc?rev=1076065&view=rev
Log:
HDFS-1664. Add block pool storage usage to Namenode WebUI. Contributed by Tanping Wang.

Modified:
    hadoop/hdfs/branches/HDFS-1052/CHANGES.txt
    hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java
    hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
    hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java

Modified: hadoop/hdfs/branches/HDFS-1052/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/CHANGES.txt?rev=1076065&r1=1076064&r2=1076065&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/CHANGES.txt (original)
+++ hadoop/hdfs/branches/HDFS-1052/CHANGES.txt Wed Mar  2 00:25:17 2011
@@ -108,6 +108,10 @@ Trunk (unreleased changes)
     HDFS-1655. Federation: DatablockScanner should scan blocks for 
     all the block pools. (jitendra)
 
+    HDFS-1664. Add block pool storage usage to Namenode WebUI.
+    (Tanping via suresh)
+    
+
   IMPROVEMENTS
 
     HDFS-1510. Added test-patch.properties required by test-patch.sh (nigel)

Modified: hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java?rev=1076065&r1=1076064&r2=1076065&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java
(original)
+++ hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java
Wed Mar  2 00:25:17 2011
@@ -530,6 +530,8 @@ public interface ClientProtocol extends 
    * <li> [3] contains number of under replicated blocks in the system.</li>
    * <li> [4] contains number of blocks with a corrupt replica. </li>
    * <li> [5] contains number of blocks without any good replicas left. </li>
+   * <li> [5] contains number of blocks without any good replicas left. </li>
+   * <li> [6] contains the total used space of the block pool. </li>
    * </ul>
    * Use public constants like {@link #GET_STATS_CAPACITY_IDX} in place of 
    * actual numbers to index into the array.

Modified: hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java?rev=1076065&r1=1076064&r2=1076065&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
(original)
+++ hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
Wed Mar  2 00:25:17 2011
@@ -3256,7 +3256,8 @@ public class FSNamesystem implements FSC
                          this.capacityRemaining,
                          getUnderReplicatedBlocks(),
                          getCorruptReplicaBlocks(),
-                         getMissingBlocksCount()};
+                         getMissingBlocksCount(),
+                         getBlockPoolUsedSpace()};
     }
   }
 

Modified: hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java?rev=1076065&r1=1076064&r2=1076065&view=diff
==============================================================================
--- hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java
(original)
+++ hadoop/hdfs/branches/HDFS-1052/src/java/org/apache/hadoop/hdfs/server/namenode/NamenodeJspHelper.java
Wed Mar  2 00:25:17 2011
@@ -34,6 +34,7 @@ import javax.servlet.http.HttpServletRes
 import javax.servlet.jsp.JspWriter;
 
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hdfs.DFSUtil;
 import org.apache.hadoop.hdfs.protocol.Block;
 import org.apache.hadoop.hdfs.protocol.DatanodeID;
 import org.apache.hadoop.hdfs.protocol.FSConstants.UpgradeAction;
@@ -42,9 +43,7 @@ import org.apache.hadoop.hdfs.server.com
 import org.apache.hadoop.hdfs.server.common.Storage;
 import org.apache.hadoop.hdfs.server.common.UpgradeStatusReport;
 import org.apache.hadoop.hdfs.server.common.Storage.StorageDirectory;
-import org.apache.hadoop.hdfs.server.datanode.DatanodeJspHelper;
 import org.apache.hadoop.io.Text;
-import org.apache.hadoop.io.WritableUtils;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.util.ServletUtil;
@@ -245,10 +244,8 @@ class NamenodeJspHelper {
       long used = fsnStats[1];
       long nonDFS = total - remaining - used;
       nonDFS = nonDFS < 0 ? 0 : nonDFS;
-      float percentUsed = total <= 0 ? 0f : ((float) used * 100.0f)
-          / (float) total;
-      float percentRemaining = total <= 0 ? 100f : ((float) remaining * 100.0f)
-          / (float) total;
+      float percentUsed = DFSUtil.getPercentUsed(used, total);
+      float percentRemaining = DFSUtil.getPercentRemaining(used, total);
       float median = 0;
       float max = 0;
       float min = 0;
@@ -274,6 +271,9 @@ class NamenodeJspHelper {
         dev = (float) Math.sqrt(dev/usages.length);
       }
 
+      long bpUsed = fsnStats[6];
+      float percentBpUsed = DFSUtil.getPercentUsed(bpUsed, total);
+      
       out.print("<div id=\"dfstable\"> <table>\n" + rowTxt() + colTxt()
           + "Configured Capacity" + colTxt() + ":" + colTxt()
           + StringUtils.byteDesc(total) + rowTxt() + colTxt() + "DFS Used"
@@ -286,6 +286,10 @@ class NamenodeJspHelper {
           + StringUtils.limitDecimalTo2(percentUsed) + " %" + rowTxt()
           + colTxt() + "DFS Remaining%" + colTxt() + ":" + colTxt()
           + StringUtils.limitDecimalTo2(percentRemaining) + " %"
+          + rowTxt() + colTxt() + "Block Pool Used" + colTxt() + ":" + colTxt()
+          + StringUtils.byteDesc(bpUsed) + rowTxt()
+          + colTxt() + "Block Pool Used%"+ colTxt() + ":" + colTxt()
+          + StringUtils.limitDecimalTo2(percentBpUsed) + " %" 
           + rowTxt() + colTxt() + "DataNodes usages" + colTxt() + ":" + colTxt()
           + "Min %" + colTxt() + "Median %" + colTxt() + "Max %" + colTxt()
           + "stdev %" + rowTxt() + colTxt() + colTxt() + colTxt()
@@ -468,6 +472,11 @@ class NamenodeJspHelper {
 
       long timestamp = d.getLastUpdate();
       long currentTime = System.currentTimeMillis();
+      
+      long bpUsed = d.getBlockPoolUsed();
+      String percentBpUsed = StringUtils.limitDecimalTo2(d
+          .getBlockPoolUsedPercent());
+
       out.print("<td class=\"lastcontact\"> "
           + ((currentTime - timestamp) / 1000)
           + "<td class=\"adminstate\">"
@@ -484,9 +493,15 @@ class NamenodeJspHelper {
           + percentUsed
           + "<td class=\"pcused\">"
           + ServletUtil.percentageGraph((int) Double.parseDouble(percentUsed),
-              100) + "<td align=\"right\" class=\"pcremaining`\">"
-          + percentRemaining + "<td title=" + "\"blocks scheduled : "
-          + d.getBlocksScheduled() + "\" class=\"blocks\">" + d.numBlocks()
+              100) 
+          + "<td align=\"right\" class=\"pcremaining`\">"
+          + percentRemaining 
+          + "<td title=" + "\"blocks scheduled : "
+          + d.getBlocksScheduled() + "\" class=\"blocks\">" + d.numBlocks()+"\n"
+          + "<td align=\"right\" class=\"bpused\">"
+          + StringUtils.limitDecimalTo2(bpUsed * 1.0 / diskBytes)
+          + "<td align=\"right\" class=\"pcbpused\">"
+          + percentBpUsed
           + "\n");
     }
 
@@ -565,7 +580,11 @@ class NamenodeJspHelper {
                 + "> Used <br>(%) <th " + nodeHeaderStr("pcused")
                 + "> Used <br>(%) <th " + nodeHeaderStr("pcremaining")
                 + "> Remaining <br>(%) <th " + nodeHeaderStr("blocks")
-                + "> Blocks\n");
+                + "> Blocks <th "
+                + nodeHeaderStr("bpused") + "> Block Pool<br>Used (" 
+                + diskByteStr + ") <th "
+                + nodeHeaderStr("pcbpused")
+                + "> Block Pool<br>Used (%)\n");
 
             JspHelper.sortNodeList(live, sorterField, sorterOrder);
             for (int i = 0; i < live.size(); i++) {



Mime
View raw message