[ 
https://issues.apache.org/jira/browse/HDFS-1114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12862118#action_12862118
 ] 

Tsz Wo (Nicholas), SZE commented on HDFS-1114:
----------------------------------------------

The data structure we need in BlocksMap is a GettableSet.
{code}
/**
 * A set which supports the get operation.
 * @param <E> The type of the elements.
 */
public interface GettableSet<E> extends Iterable<E> {
  /**
   * @return the size of this set.
   */
  int size();

  /**
   * @return true if the given element equals to a stored element.
   *         Otherwise, return false.
   */
  boolean contains(Object element);

  /**
   * @return the stored element if there is any.  Otherwise, return null.
   */
  E get(Object element);

  /**
   * Add the given element to this set.
   * @return the previous stored element if there is any.
   *         Otherwise, return null.
   */
  E add(E element);

  /**
   * Remove the element from the set.
   * @return the stored element if there is any.  Otherwise, return null.
   */
  E remove(Object element);
}
{code}

> Reducing NameNode memory usage by an alternate hash table
> ---------------------------------------------------------
>
>                 Key: HDFS-1114
>                 URL: https://issues.apache.org/jira/browse/HDFS-1114
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>          Components: name-node
>            Reporter: Tsz Wo (Nicholas), SZE
>            Assignee: Tsz Wo (Nicholas), SZE
>
> NameNode uses a java.util.HashMap to store BlockInfo objects.  When there are 
> many blocks in HDFS, this map uses a lot of memory in the NameNode.  We may 
> optimize the memory usage by a light weight hash table implementation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to