hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Colin Patrick McCabe (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-9598) Use heap buffer in PacketReceiver If hdfs client has no enough free direct buffer.
Date Tue, 26 Jan 2016 20:19:39 GMT

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

Colin Patrick McCabe commented on HDFS-9598:
--------------------------------------------

Hmm.  It looks like the code already has a fallback.

{code}
  /**
   * Allocate a direct buffer of the specified size, in bytes.
   * If a pooled buffer is available, returns that. Otherwise
   * allocates a new one.
   */
  public ByteBuffer getBuffer(int size) {
    Queue<WeakReference<ByteBuffer>> list = buffersBySize.get(size);
    if (list == null) {
      // no available buffers for this size
      return ByteBuffer.allocateDirect(size);
    }
    
    WeakReference<ByteBuffer> ref;
    while ((ref = list.poll()) != null) {
      ByteBuffer b = ref.get();
      if (b != null) {
        return b;
      }
    }
  
    return ByteBuffer.allocateDirect(size);
  }
{code}

It sounds like what is happening here is that we failed to allocate a direct byte buffer.
 I'm not sure what we should do in this case...

> Use heap buffer in PacketReceiver If hdfs client has no enough free direct buffer.
> ----------------------------------------------------------------------------------
>
>                 Key: HDFS-9598
>                 URL: https://issues.apache.org/jira/browse/HDFS-9598
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>            Reporter: Yong Zhang
>            Assignee: Yong Zhang
>         Attachments: HDFS-9598.001.patch, HDFS-9598.002.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message