hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r569019 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/dfs/Block.java src/java/org/apache/hadoop/dfs/BlocksMap.java
Date Thu, 23 Aug 2007 14:41:45 GMT
Author: cutting
Date: Thu Aug 23 07:41:44 2007
New Revision: 569019

URL: http://svn.apache.org/viewvc?rev=569019&view=rev
Log:
HADOOP-1766.  Save memory in namenode by having BlockInfo extend Block.  Contributed by Konstantin.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/Block.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/BlocksMap.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=569019&r1=569018&r2=569019&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Thu Aug 23 07:41:44 2007
@@ -44,6 +44,10 @@
     HADOOP-1759.  Change file name in INode from String to byte[],
     saving memory on the namenode. (Konstantin Shvachko via cutting)
 
+    HADOOP-1766.  Save memory in namenode by having BlockInfo extend
+    Block, and replace many uses of Block with BlockInfo.
+    (Konstantin Shvachko via cutting)
+
   BUG FIXES
 
     HADOOP-1463.  HDFS report correct usage statistics for disk space

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/Block.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/Block.java?rev=569019&r1=569018&r2=569019&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/Block.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/Block.java Thu Aug 23 07:41:44 2007
@@ -18,7 +18,6 @@
 package org.apache.hadoop.dfs;
 
 import java.io.*;
-import java.util.*;
 import org.apache.hadoop.io.*;
 
 /**************************************************
@@ -63,6 +62,13 @@
   public Block(long blkid, long len) {
     this.blkid = blkid;
     this.len = len;
+  }
+
+  /**
+   */
+  public Block(Block blk) {
+    this.blkid = blk.blkid;
+    this.len = blk.len;
   }
 
   /**

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/BlocksMap.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/BlocksMap.java?rev=569019&r1=569018&r2=569019&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/BlocksMap.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/BlocksMap.java Thu Aug 23 07:41:44
2007
@@ -29,7 +29,7 @@
   /**
    * Internal class for block metadata.
    */
-  static class BlockInfo {
+  private static class BlockInfo extends Block {
     private INodeFile          inode;
       
     /** nodes could contain some null entries at the end, so 
@@ -37,7 +37,10 @@
      *  if nodes != null then nodes[0] != null.
      */
     private DatanodeDescriptor[]           nodes;
-    private Block                          block; //block that was inserted.   
+
+    BlockInfo(Block blk) {
+      super(blk);
+    }
   }
       
   private static class NodeIterator implements Iterator<DatanodeDescriptor> {
@@ -66,8 +69,7 @@
   private BlockInfo checkBlockInfo(Block b) {
     BlockInfo info = map.get(b);
     if (info == null) {
-      info = new BlockInfo();
-      info.block = b;
+      info = new BlockInfo(b);
       map.put(b, info);
     }
     return info;
@@ -96,7 +98,7 @@
   /** Returns the block object it it exists in the map. */
   public Block getStoredBlock(Block b) {
     BlockInfo info = map.get(b);
-    return (info != null) ? info.block : null;
+    return (info != null) ? info : null;
   }
     
   /** Returned Iterator does not support. */



Mime
View raw message