hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kai Zheng (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-12685) Input buffer position after encode/decode not consistent between different kinds of buffers
Date Tue, 05 Jan 2016 00:21:39 GMT

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

Kai Zheng commented on HADOOP-12685:
------------------------------------

Now I thought it wouldn't be bad to enforce the refined behavior in the abstract layer as
you did in the patch, even concrete coders may do that already.

Ref. the following change:
{noformat}
+    // dataLen bytes consumed
     for (int i = 0; i < inputs.length; ++i) {
-      buffer = inputs[i];
-      if (buffer != null) {
-        // dataLen bytes consumed
-        buffer.position(buffer.position() + dataLen);
+      // move the position forward only if it's not moved during decoding
+      if (inputs[i] != null && inputs[i].position() == inputPositions[i]) {
+        inputs[i].position(inputs[i].position() + dataLen);
       }
     }
{noformat}

Can be better:
{code}
// dataLen bytes consumed
for (int i = 0; i < inputs.length; i++) {
   buffer = inputs[i];
   if (buffer != null) {
     // dataLen bytes consumed
     buffer.position(inputPositions[i] + dataLen);
   }
}
{code}

> Input buffer position after encode/decode not consistent between different kinds of buffers
> -------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-12685
>                 URL: https://issues.apache.org/jira/browse/HADOOP-12685
>             Project: Hadoop Common
>          Issue Type: Sub-task
>            Reporter: Rui Li
>            Assignee: Rui Li
>            Priority: Minor
>         Attachments: HADOOP-12685.1.patch
>
>
> As reported by [~jack_liuquan] in this [comment|https://issues.apache.org/jira/browse/HADOOP-11828?focusedCommentId=15071796&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15071796],
the input buffer position change behavior is not consistent between direct and non-direct
buffers.



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

Mime
View raw message