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

Kai Zheng commented on HDFS-7859:
---------------------------------

Thanks [~Sammi] for the update!

Some comments so far:
1. Did you notice some failure or error for the current behavior of 
{{ElasticByteBufferPool->getBuffer(boolean direct, int length)}}? It looks 
reasonable to me that it can return a ByteBuffer of larger capacity than 
required; it can the caller's responsibility to use it well. Anyway, it's not 
relevant to this issue, so would you please handle it separately? Thanks.
{code}
--- 
a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/ElasticByteBufferPool.java
+++ 
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/ElasticByteBufferPool.java
@@ -96,7 +96,8 @@ public synchronized ByteBuffer getBuffer(boolean direct, int 
length) {
                       ByteBuffer.allocate(length);
     }
     tree.remove(entry.getKey());
-    return entry.getValue();
+    // The reused ByteBuffer may have more capacity than required(length)
+    return (ByteBuffer) entry.getValue().limit(length);
   }
{code}

2. Similarly, please also do the large portion of changes in 
{{CodecRegistry/CodecUtil}} separately. It's really not very relevant to this.

3. Again, in {{DFSStripedOutputStream}} please do it elsewhere (better with 
some test), I wish this could focus on the NN side changes when possible.
{code}
     private void clear() {
       for (int i = 0; i< numAllBlocks; i++) {
         buffers[i].clear();
+        buffers[i] = (ByteBuffer) buffers[i].limit(cellSize);
       }
     }
{code}

> Erasure Coding: Persist erasure coding policies in NameNode
> -----------------------------------------------------------
>
>                 Key: HDFS-7859
>                 URL: https://issues.apache.org/jira/browse/HDFS-7859
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Kai Zheng
>            Assignee: SammiChen
>              Labels: hdfs-ec-3.0-must-do
>         Attachments: HDFS-7859.001.patch, HDFS-7859.002.patch, 
> HDFS-7859.004.patch, HDFS-7859.005.patch, HDFS-7859.006.patch, 
> HDFS-7859.007.patch, HDFS-7859.008.patch, HDFS-7859.009.patch, 
> HDFS-7859.010.patch, HDFS-7859.011.patch, HDFS-7859.012.patch, 
> HDFS-7859-HDFS-7285.002.patch, HDFS-7859-HDFS-7285.002.patch, 
> HDFS-7859-HDFS-7285.003.patch
>
>
> In meetup discussion with [~zhz] and [~jingzhao], it's suggested that we 
> persist EC schemas in NameNode centrally and reliably, so that EC zones can 
> reference them by name efficiently.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to